diff options
author | Andrew Price <anprice@redhat.com> | 2019-10-30 04:16:43 -0400 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2019-10-30 07:16:53 -0400 |
commit | d5798141fd54cea074c3429d5803f6c41ade0ca8 (patch) | |
tree | c32781d27990e6f680b6bd183333c112e46c31d8 | |
parent | d6d5df1db6e9d7f8f76d2911707f7d5877251b02 (diff) |
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: 1f52aa08d12f ("gfs2: Convert gfs2 to fs_context")
Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | fs/gfs2/ops_fstype.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index dc61af2c4d5e..18daf494abab 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -1540,17 +1540,23 @@ static int gfs2_init_fs_context(struct fs_context *fc) | |||
1540 | { | 1540 | { |
1541 | struct gfs2_args *args; | 1541 | struct gfs2_args *args; |
1542 | 1542 | ||
1543 | args = kzalloc(sizeof(*args), GFP_KERNEL); | 1543 | args = kmalloc(sizeof(*args), GFP_KERNEL); |
1544 | if (args == NULL) | 1544 | if (args == NULL) |
1545 | return -ENOMEM; | 1545 | return -ENOMEM; |
1546 | 1546 | ||
1547 | args->ar_quota = GFS2_QUOTA_DEFAULT; | 1547 | if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) { |
1548 | args->ar_data = GFS2_DATA_DEFAULT; | 1548 | struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info; |
1549 | args->ar_commit = 30; | ||
1550 | args->ar_statfs_quantum = 30; | ||
1551 | args->ar_quota_quantum = 60; | ||
1552 | args->ar_errors = GFS2_ERRORS_DEFAULT; | ||
1553 | 1549 | ||
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 | } | ||
1554 | fc->fs_private = args; | 1560 | fc->fs_private = args; |
1555 | fc->ops = &gfs2_context_ops; | 1561 | fc->ops = &gfs2_context_ops; |
1556 | return 0; | 1562 | return 0; |