On 09/04/2021 23:56, Goldwyn Rodrigues wrote:
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 exclusively if exclop is set to BTRFS_EXCL_NONE.
---
SOB missing.
common/utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common/utils.c b/common/utils.c
index 57e41432..2e5175c3 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -2326,6 +2326,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);
+ if (exclop == BTRFS_EXCL_NONE)
+ ret = 0;
continue;
}
}
This is bit inconsistent from what is done a few lines above:
exclop = get_fs_exclop(fd);
if (exclop <= 0) {
ret = 0;
goto out;
}
We return 0 for both BTRFS_EXCLOP_NONE || BTRFS_EXCLOP_UNKNOWN.
Thanks, Anand