btrfs-progs: tune: fix the missing close() of filesystem fd
(cherry picked from commit 0b774edec61d6b0ae73d5188f325a40c100bb5af)
This commit is contained in:
parent
1be905cf95
commit
9358ae5182
@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: btrfs-progs
|
||||
Version: 6.6.3
|
||||
Release: 8
|
||||
Release: 9
|
||||
Summary: btrfs userspace programs
|
||||
License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT
|
||||
URL: https://btrfs.wiki.kernel.org/index.php/Main_Page
|
||||
@ -13,6 +13,7 @@ Patch0004: 0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch
|
||||
Patch0005: 0005-btrfs-progs-fix-freeing-of-device-after-error-in-btr.patch
|
||||
Patch0006: 0006-fix-double-free-on-error-in-read_raid56.patch
|
||||
Patch0007: 0007-btrfs-progs-fi-show-canonicalize-path-when-using-blk.patch
|
||||
Patch0008: 0008-btrfs-progs-tune-fix-the-missing-close-of-filesystem.patch
|
||||
|
||||
BuildRequires: python3-devel >= 3.4
|
||||
BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel
|
||||
@ -78,6 +79,9 @@ make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir
|
||||
%{_mandir}/man8/*.gz
|
||||
|
||||
%changelog
|
||||
* Tue Jul 2 2024 cenhuilin <cenhuilin@kylinos.cn> - 6.6.3-9
|
||||
- btrfs-progs: tune: fix the missing close() of filesystem fd
|
||||
|
||||
* Mon Jul 1 2024 liuh <liuhuan01@kylinos.cn> - 6.6.3-8
|
||||
- btrfs-progs: fi show: canonicalize path when using blkid and -d
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user