39 lines
940 B
Diff
39 lines
940 B
Diff
|
|
From ace7d241ccf2582e832c4c4a75eb6b638a0f543b Mon Sep 17 00:00:00 2001
|
||
|
|
From: Qu Wenruo <wqu@suse.com>
|
||
|
|
Date: Tue, 2 Jul 2024 10:51:55 +0800
|
||
|
|
Subject: [PATCH] btrfs-progs: tune: fix the missing close() of filesystem fd
|
||
|
|
|
||
|
|
[BUG]
|
||
|
|
In "btrfs tune" subcommand, we're using open_ctree_fd(), which
|
||
|
|
requires passing a valid fd, and the caller is responsible to properly
|
||
|
|
handling the lifespan of the fd.
|
||
|
|
|
||
|
|
But we just call close_ctree() and btrfs_close_all_devices(), without
|
||
|
|
closing the fd.
|
||
|
|
|
||
|
|
[FIX]
|
||
|
|
Just manually close the fd.
|
||
|
|
|
||
|
|
Reviewed-by: Anand Jain <anand.jain@oracle.com>
|
||
|
|
Signed-off-by: Qu Wenruo <wqu@suse.com>
|
||
|
|
Signed-off-by: David Sterba <dsterba@suse.com>
|
||
|
|
---
|
||
|
|
tune/main.c | 1 +
|
||
|
|
1 file changed, 1 insertion(+)
|
||
|
|
|
||
|
|
diff --git a/tune/main.c b/tune/main.c
|
||
|
|
index 9dcb559..0fbf37d 100644
|
||
|
|
--- a/tune/main.c
|
||
|
|
+++ b/tune/main.c
|
||
|
|
@@ -535,6 +535,7 @@ out:
|
||
|
|
}
|
||
|
|
close_ctree(root);
|
||
|
|
btrfs_close_all_devices();
|
||
|
|
+ close(fd);
|
||
|
|
|
||
|
|
free_out:
|
||
|
|
return ret;
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|