aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhiqiang Liu <liuzhiqiang26@huawei.com>2023-03-20 13:04:34 +0800
committerTheodore Ts'o <tytso@mit.edu>2024-02-08 11:03:19 -0500
commit2e42f7bfd1d818899684b2f694be24970704e39a (patch)
treea16e841e319175d27e02062e9eb563fc49e32098
parent196cd1224ccaf5ca76540fc0a6238695d4476ca9 (diff)
downloade2fsprogs-2e42f7bfd1d818899684b2f694be24970704e39a.tar.gz
tune2fs: check whether filesystem is in use for I_flag and Q_flag test
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@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> Link: https://lore.kernel.org/r/28455341-ca26-d203-8b54-792bae002251@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/tune2fs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index cb5f575a3..c32d93c89 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3263,9 +3263,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;
}
@@ -3379,10 +3379,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;
}