1 Star 0 Fork 18

liuh/btrfs-progs

forked from src-openEuler/btrfs-progs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0008-btrfs-progs-tune-fix-the-missing-close-of-filesystem.patch 940 Bytes
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuh0329/btrfs-progs.git
git@gitee.com:liuh0329/btrfs-progs.git
liuh0329
btrfs-progs
btrfs-progs
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385