Red Hat Bugzilla – Bug 1462969
Peer-file parsing is too fragile
Last modified: 2017-12-08 12:33:42 EST
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.
REVIEW: https://review.gluster.org/17885 (glusterd: make peerfile parsing more robust) posted (#1) for review on master by Jeff Darcy (email@example.com)
REVIEW: https://review.gluster.org/17885 (glusterd: make peerfile parsing more robust) posted (#2) for review on master by Jeff Darcy (firstname.lastname@example.org)
REVIEW: https://review.gluster.org/17885 (glusterd: make peerfile parsing more robust) posted (#3) for review on master by Jeff Darcy (email@example.com)
COMMIT: https://review.gluster.org/17885 committed in master by Atin Mukherjee (firstname.lastname@example.org)
Author: Jeff Darcy <email@example.com>
Date: Tue Jul 25 17:40:49 2017 -0700
glusterd: make peerfile parsing more robust
Differential Revision: https://phabricator.intern.facebook.com/D5498639
Signed-off-by: Jeff Darcy <firstname.lastname@example.org>
Smoke: Gluster Build System <email@example.com>
Tested-by: Jeff Darcy <firstname.lastname@example.org>
Reviewed-by: Prashanth Pai <email@example.com>
CentOS-regression: Gluster Build System <firstname.lastname@example.org>
Reviewed-by: Atin Mukherjee <email@example.com>
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.13.0, please open a new bug report.
glusterfs-3.13.0 has been announced on the Gluster mailinglists , packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist  and the update infrastructure for your distribution.