btrfs-progs: handle case if fsid not in sysfs in device_is_seed

For older kernels, the sysfs interface providing the fsid may not be present yet.
Since 32c2e57c65 ("btrfs-progs: read fsid from the sysfs in
device_is_seed"), the fallback to the previous approach to determine
the fsid was not used anymore.

Ensure negative return values of sysfs_open_fsid_file are handled by
falling back to the dev_to_fsid in this case.

Pull-request: #599
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Oliver Freyermuth 2023-03-15 21:03:41 +01:00 committed by David Sterba
parent d82c2ca63c
commit 8e11c07269
1 changed files with 1 additions and 1 deletions

View File

@ -726,7 +726,7 @@ static int device_is_seed(int fd, const char *dev_path, u64 devid, const u8 *mnt
close(sysfs_fd);
}
if (ret) {
if (ret || sysfs_fd < 0) {
ret = dev_to_fsid(dev_path, fsid);
if (ret)
return ret;