btrfs-progs: correct check_running_fs_exclop() return value

check_running_fs_exclop() can return 1 when exclop is changed to "none"
The ret is set by the return value of the select() operation. Checking
the exclusive op changes just the exclop variable while ret is still
set to 1.

Set ret = 0 if exclop is set to BTRFS_EXCL_NONE or BTRFS_EXCL_UNKNOWN.
Remove unnecessary continue statement at the end of the block.

The command appears to have executed, but does not. This was found when
balance which typically reports chunks relocated did not print anything
on screen.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Goldwyn Rodrigues 2021-06-28 14:40:00 -05:00 committed by David Sterba
parent 5ffbbcedb1
commit a7ed5b0ced
1 changed files with 2 additions and 1 deletions

View File

@ -1795,7 +1795,8 @@ int check_running_fs_exclop(int fd, enum exclusive_operation start, bool enqueue
tv.tv_sec /= 2;
ret = select(sysfs_fd + 1, NULL, NULL, &fds, &tv);
exclop = get_fs_exclop(fd);
continue;
if (exclop <= 0)
ret = 0;
}
}
out: