[PATCH] btrfs-progs: Correct check_running_fs_exclop() return value

From
Goldwyn Rodrigues <hidden>
Date
2021-06-28 19:40:05
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.

Signed-off-by: Goldwyn Rodrigues <redacted>
---
 common/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/utils.c b/common/utils.c
index 1627913a..3c562247 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -1771,7 +1771,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:
-- 
2.32.0


-- 
Goldwyn
Thread (3 messages) 3 messages, 2 authors, last reply 2021-07-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help