[Bugs] [Bug 1462969] New: Peer-file parsing is too fragile

bugzilla at redhat.com bugzilla at redhat.com
Mon Jun 19 18:54:17 UTC 2017


https://bugzilla.redhat.com/show_bug.cgi?id=1462969

            Bug ID: 1462969
           Summary: Peer-file parsing is too fragile
           Product: GlusterFS
           Version: mainline
         Component: glusterd
          Assignee: bugs at gluster.org
          Reporter: jeff at pl.atyp.us
                CC: bugs at gluster.org



Description of problem:

In glusterd_store_retrieve_peers we will open *any* file that we can find in
$workdir/peers even if neither its name (which should look like a UUID) nor
anything else about it suggests that it is in fact a peerfile.  If parsing it
as a peerfile then fails, this causes the *entire* glusterd startup to fail. 
Now, imagine what happens if some other kind of file happens to get dropped in
that directory.  In my case it was a .gdb-history from debugging a
zero-length-peer-file problem (no we don't even skip hidden files).  If you
guessed that the mere presence of such an abomination caused startup to fail
and debugging the original problem to be more difficult, give yourself a
cookie.  Unless you wrote that code.  Then no cookie for you.

A better approach would be to check whether the file actually looks like a
peerfile (i.e. the name is a UUID) before we even attempt to open it.  Then, if
parsing still fails, just *skip it*.  The worst case is no worse than what
happens now.  The more common case is that glusterd startup will succeed *and
everything will be fine*, whereas now it just barfs in a non-obvious way.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list