lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <28455341-ca26-d203-8b54-792bae002251@huawei.com>
Date:   Mon, 20 Mar 2023 13:04:34 +0800
From:   Zhiqiang Liu <liuzhiqiang26@...wei.com>
To:     <linux-ext4@...r.kernel.org>
CC:     "Theodore Y. Ts'o" <tytso@....edu>, <adilger@...mcloud.com>,
        Jan Kara <jack@...e.cz>, linfeilong <linfeilong@...wei.com>,
        wuguanghao <wuguanghao3@...wei.com>,
        zhanchengbin <zhanchengbin1@...wei.com>, <libaokun1@...wei.com>
Subject: [PATCH] tune2fs: check whether filesystem is in use for I_flag and
 Q_flag test

From: Zhiqiang Liu <liuzhiqiang26@...wei.com>

For changing inode size (-I) and setting quota fearture (-Q), tune2fs
only check whether the filesystem is umounted. Considering mount
namepspaces, the filesystem is umounted, however it already be left
in other mount namespace.
So we add one check whether the filesystem is not in use with using
EXT2_MF_BUSY flag, which can indicate the device is already opened
with O_EXCL, as suggested by Ted.

Reported-by: Baokun Li <libaokun1@...wei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
Signed-off-by: zhanchengbin <zhanchengbin1@...wei.com>
---
 misc/tune2fs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 458f7cf6..d75f4d94 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3520,9 +3520,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
 	}

 	if (Q_flag) {
-		if (mount_flags & EXT2_MF_MOUNTED) {
+		if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) {
 			fputs(_("The quota feature may only be changed when "
-				"the filesystem is unmounted.\n"), stderr);
+				"the filesystem is unmounted and not in use.\n"), stderr);
 			rc = 1;
 			goto closefs;
 		}
@@ -3673,10 +3673,10 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
 	}

 	if (I_flag) {
-		if (mount_flags & EXT2_MF_MOUNTED) {
+		if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) {
 			fputs(_("The inode size may only be "
 				"changed when the filesystem is "
-				"unmounted.\n"), stderr);
+				"unmounted and not in use.\n"), stderr);
 			rc = 1;
 			goto closefs;
 		}
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ