From: Alain Spineux Date: Tue, 27 Sep 2022 12:39:07 +0000 (+0200) Subject: Fix #9535 avoid "Will not descend from / to /good_dir" X-Git-Tag: Release-13.0.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adefbd44f169b2167f3718a95335d75ca53a6443;p=thirdparty%2Fbacula.git Fix #9535 avoid "Will not descend from / to /good_dir" - when attributes are backed up, a function check_current_fs() update FF_PKT::last_fstype without updating FF_PKT::last_fstypename this make fstype() not refresh last_fstypename when last_fstype match the the value returned by statfs - notice that fstype() whas alredy checking if last_fstypename[0] to force a refresh - IMPORTANT this patch change a little bit the behavior of the original function, if fstype() cannot give a name to the FS then the function return false, whil in the original function don't care about the name and only compare the numeric ID the check_current_fs() above the check the FS name (instead of its num ID) also return false in this situation - The problem is that the bacl.c and bxattr.c use this function to detect the change of filesystem (this is the problem) and if the new FS match one particular FS then set some flags. Detecting if the FS has changed is done only with the numeric "f_type" This is faster than comparing a string. This is probably why check_current_fs() don't call fstype() and call statfs() by himself. --- diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index 768750af5..df90b9563 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -646,14 +646,9 @@ bool check_current_fs(char *fname, FF_PKT *ff, uint64_t fstype_magic) if (fstype_magic > 0){ // get fsid for file - if (ff->last_fstype != 0){ - fsid = ff->last_fstype; - } else { - fsid = fstypeid(fname, ff); - ff->last_fstype = fsid; - } - if (fsid != 0){ - return fsid == fstype_magic; + char fsname[NAME_MAX]; + if (fstype(fname, ff, fsname, NAME_MAX)) { + return ff->last_fstype == fstype_magic; } } return false;