Skip to content

Commit d579814

Browse files
andypriceAndreas Gruenbacher
authored andcommitted
gfs2: Fix initialisation of args for remount
When gfs2 was converted to use fs_context, the initialisation of the mount args structure to the currently active args was lost with the removal of gfs2_remount_fs(), so the checks of the new args on remount became checks against the default values instead of the current ones. This caused unexpected remount behaviour and test failures (xfstests generic/294, generic/306 and generic/452). Reinstate the args initialisation, this time in gfs2_init_fs_context() and conditional upon fc->purpose, as that's the only time we get control before the mount args are parsed in the remount process. Fixes: 1f52aa0 ("gfs2: Convert gfs2 to fs_context") Signed-off-by: Andrew Price <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent d6d5df1 commit d579814

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

fs/gfs2/ops_fstype.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,17 +1540,23 @@ static int gfs2_init_fs_context(struct fs_context *fc)
15401540
{
15411541
struct gfs2_args *args;
15421542

1543-
args = kzalloc(sizeof(*args), GFP_KERNEL);
1543+
args = kmalloc(sizeof(*args), GFP_KERNEL);
15441544
if (args == NULL)
15451545
return -ENOMEM;
15461546

1547-
args->ar_quota = GFS2_QUOTA_DEFAULT;
1548-
args->ar_data = GFS2_DATA_DEFAULT;
1549-
args->ar_commit = 30;
1550-
args->ar_statfs_quantum = 30;
1551-
args->ar_quota_quantum = 60;
1552-
args->ar_errors = GFS2_ERRORS_DEFAULT;
1547+
if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
1548+
struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info;
15531549

1550+
*args = sdp->sd_args;
1551+
} else {
1552+
memset(args, 0, sizeof(*args));
1553+
args->ar_quota = GFS2_QUOTA_DEFAULT;
1554+
args->ar_data = GFS2_DATA_DEFAULT;
1555+
args->ar_commit = 30;
1556+
args->ar_statfs_quantum = 30;
1557+
args->ar_quota_quantum = 60;
1558+
args->ar_errors = GFS2_ERRORS_DEFAULT;
1559+
}
15541560
fc->fs_private = args;
15551561
fc->ops = &gfs2_context_ops;
15561562
return 0;

0 commit comments

Comments
 (0)