fix LTP regression in fanotify22
cover fix LTP regression in fanotify22
Jan,
I noticed that fanotify22, the FAN_FS_ERROR test has regressed in the 5.15.y stable tree.
This is because commit d3476f3dad4a ("ext4: don't set SB_RDONLY after filesystem errors") was backported to 5.15.y and the later Fixes commit could not be cleanly applied to 5.15.y over the new mount api re-factoring.
I am not sure it is critical to fix this regression, because it is mostly a regression in a test feature, but I think the backport is pretty simple, although I could be missing something.
Please ACK if you agree that this backport should be applied to 5.15.y.
Thanks,
Amir.
Amir Goldstein (2):
ext4: make 'abort' mount option handling standard
ext4: avoid remount errors with 'abort' mount option
fs/ext4/ext4.h | 1 + fs/ext4/super.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
Signature · 1 line
2.47.1
PATCH 1/2 ext4: make 'abort' mount option handling standard
[ Upstream commit 22b8d707b07e6e06f50fe1d9ca8756e1f894eb0d ]
[amir: partial backport to 5.15.y without removing s_mount_flags]
'abort' mount option is the only mount option that has special handling and sets a bit in sbi->s_mount_flags. There is not strong reason for that so just simplify the code and make 'abort' set a bit in sbi->s_mount_opt2 as any other mount option. This simplifies the code and will allow us to drop EXT4_MF_FS_ABORTED completely in the following patch.
Stable-dep-of: 76486b104168 ("ext4: avoid remount errors with 'abort' mount option")
--- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -1255,6 +1255,7 @@ struct ext4_inode_info {#define EXT4_MOUNT2_MB_OPTIMIZE_SCAN 0x00000080/* Optimize group * scanning in mballoc */ +#define EXT4_MOUNT2_ABORT 0x00000100/* Abort filesystem */ #define clear_opt (sb, opt) EXT4_SB(sb)->s_mount_opt &= \ ~EXT4_MOUNT_##opt
fs/ext4/super.c +2 -4
@@ -2023,6 +2023,7 @@ static const struct mount_opts { MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY}, {Opt_fc_debug_max_replay, 0, MOPT_GTE0}, #endif + {Opt_abort, EXT4_MOUNT2_ABORT, MOPT_SET | MOPT_2}, {Opt_err, 0, 0} };
@@ -2143,9 +2144,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,case Opt_removed:ext4_msg (sb,KERN_WARNING ,"Ignoring removed %s option" , opt);return 1 ; -case Opt_abort: -ext4_set_mount_flag (sb,EXT4_MF_FS_ABORTED ); -return 1 ;case Opt_i_version: sb->s_flags |=SB_I_VERSION ;return 1 ;
@@ -5851,7 +5849,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } -if (ext4_test_mount_flag (sb,EXT4_MF_FS_ABORTED )) +if (test_opt2 (sb,ABORT ))ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
Signature · 1 line
2.47.1
Sasha Levin
maintainerRe: [PATCH 5.15 1/2] ext4: make 'abort' mount option handling standard
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 22b8d707b07e6e06f50fe1d9ca8756e1f894eb0d
WARNING: Author mismatch between patch and upstream commit:
Backport author: Amir Goldstein<[email protected]> Commit author: Jan Kara<[email protected]>
Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (different SHA1: a8dad6db0ed6)
Note: The patch differs from the upstream commit:
---
1: 22b8d707b07e6 < -: ------------- ext4: make 'abort' mount option handling standard -: ------------- > 1: 448450a6537d0 ext4: make 'abort' mount option handling standard
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |
PATCH 2/2 ext4: avoid remount errors with 'abort' mount option
In reply to Amir Goldstein[ Upstream commit 76486b104168ae59703190566e372badf433314b ]
[amir: backport to 5.15.y pre new mount api]
When we remount filesystem with 'abort' mount option while changing other mount options as well (as is LTP test doing), we can return error from the system call after commit d3476f3dad4a ("ext4: don't set SB_RDONLY after filesystem errors") because the application of mount option changes detects shutdown filesystem and refuses to do anything. The behavior of application of other mount options in presence of 'abort' mount option is currently rather arbitary as some mount option changes are handled before 'abort' and some after it.
Move aborting of the filesystem to the end of remount handling so all requested changes are properly applied before the filesystem is shutdown to have a reasonably consistent behavior.
--- fs/ext4/super.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/ext4/super.c +8 -3
@@ -5849,9 +5849,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } -if (test_opt2 (sb,ABORT )) -ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); - sb->s_flags = (sb->s_flags & ~SB_POSIXACL ) | (test_opt (sb,POSIX_ACL ) ?SB_POSIXACL :0 );
@@ -6027,6 +6024,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)*/ *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags); +/* +* Handle aborting the filesystem as the last thing during remount to +* avoid obsure errors during remount when some option changes fail to +* apply due to shutdown filesystem. +*/ +if (test_opt2 (sb,ABORT )) +ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); +ext4_msg (sb,KERN_INFO ,"re-mounted. Opts: %s. Quota mode: %s." , orig_data,ext4_quota_mode (sb));kfree (orig_data);
Signature · 1 line
2.47.1
Re: [PATCH 5.15 2/2] ext4: avoid remount errors with 'abort' mount option
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 76486b104168ae59703190566e372badf433314b
WARNING: Author mismatch between patch and upstream commit:
Backport author: Amir Goldstein<[email protected]> Commit author: Jan Kara<[email protected]>
Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (different SHA1: 26cc5063e3c2) 6.6.y | Present (different SHA1: 6c63de9b4d0e) 6.1.y | Present (different SHA1: dfc2eb29016f)
Note: The patch differs from the upstream commit:
---
1: 76486b104168a ! 1: 73557e9fd536a ext4: avoid remount errors with 'abort' mount option
@@
## Metadata ##
-Author: Jan Kara <[email protected]>
+Author: Amir Goldstein <[email protected]>
## Commit message ##
ext4: avoid remount errors with 'abort' mount option
+ [ Upstream commit 76486b104168ae59703190566e372badf433314b ]
+
+ [amir: backport to 5.15.y pre new mount api]
+
When we remount filesystem with 'abort' mount option while changing other mount options as well (as is LTP test doing), we can return error from the system call after commit d3476f3dad4a ("ext4: don't set
@@ Commit message
+ Signed-off-by: Amir Goldstein <[email protected]>
## fs/ext4/super.c ##
-@@ fs/ext4/super.c: static int __ext4_remount(struct fs_context *fc, struct super_block *sb) +@@ fs/ext4/super.c: static int ext4_remount(struct super_block *sb, int *flags, char *data)
goto restore_opts;
}
@@ fs/ext4/super.c: static int __ext4_remount(struct fs_context *fc, struct super_b
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
-@@ fs/ext4/super.c: static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
- if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb))
- ext4_stop_mmpd(sbi);
+@@ fs/ext4/super.c: static int ext4_remount(struct super_block *sb, int *flags, char *data)
+ */
+ *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags);
+ /*
+ * Handle aborting the filesystem as the last thing during remount to
@@ fs/ext4/super.c: static int __ext4_remount(struct fs_context *fc, struct super_b
+ if (test_opt2(sb, ABORT))
+ ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
+
- return 0;
-
- restore_opts:
+ ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s. Quota mode: %s.",
+ orig_data, ext4_quota_mode(sb));
+ kfree(orig_data);
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |
[CC to the correct LTP list address]
Quoted 31 lines · Amir Goldstein
Jan,
I noticed that fanotify22, the
FAN_FS_ERRORtest has regressed in the 5.15.y stable tree.This is because commit
d3476f3dad4a("ext4: don't setSB_RDONLYafter filesystem errors") was backported to 5.15.y and the later Fixes commit could not be cleanly applied to 5.15.y over the new mount api re-factoring.I am not sure it is critical to fix this regression, because it is mostly a regression in a test feature, but I think the backport is pretty simple, although I could be missing something.
Please ACK if you agree that this backport should be applied to 5.15.y.
Thanks,
Amir.Amir Goldstein (2):
ext4: make 'abort' mount option handling standard
ext4: avoid remount errors with 'abort' mount optionfs/ext4/ext4.h | 1 + fs/ext4/super.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)--
2.47.1
Hi!
Quoted 8 lines · Amir Goldstein
I noticed that fanotify22, the
FAN_FS_ERRORtest has regressed in the 5.15.y stable tree.This is because commit
d3476f3dad4a("ext4: don't setSB_RDONLYafter filesystem errors") was backported to 5.15.y and the later Fixes commit could not be cleanly applied to 5.15.y over the new mount api re-factoring.
Quoted 5 lines
I am not sure it is critical to fix this regression, because it is mostly a regression in a test feature, but I think the backport is pretty simple, although I could be missing something.
Please ACK if you agree that this backport should be applied to 5.15.y.
Yes, I think these are fine to pull into 5.15 kernels...
Honza
Quoted 15 lines
Thanks,
Amir.Amir Goldstein (2):
ext4: make 'abort' mount option handling standard
ext4: avoid remount errors with 'abort' mount optionfs/ext4/ext4.h | 1 + fs/ext4/super.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)Signature · 1 line
2.47.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR