tune2fs: check whether filesystem is in use for I_flag and Q_flag test
PATCH 1/1 tune2fs: check whether filesystem is in use for I_flag and Q_flag test
From: Zhiqiang Liu <[email protected]>
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.
--- misc/tune2fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
misc/tune2fs.c +4 -4
@@ -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; }
Signature · 1 line
2.33.0
friendly ping...
Quoted 47 lines · Zhiqiang Liu
From: Zhiqiang Liu <[email protected]>
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 usingEXT2_MF_BUSYflag, which can indicate the device is already opened withO_EXCL, as suggested by Ted.Reported-by Baokun Li <[email protected]>Signed-off-by Zhiqiang Liu <[email protected]>Signed-off-by zhanchengbin <[email protected]>--- misc/tune2fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)misc/tune2fs.c +4
-4@@ -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; }
Theodore Ts'o
AppliedQuoted 9 lines · Zhiqiang Liu
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 usingEXT2_MF_BUSYflag, which can indicate the device is already opened withO_EXCL, as suggested by Ted.[...]
Applied, thanks!
[1/1] tune2fs: check whether filesystem is in use for I_flag and Q_flag test
(no commit info)
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>