On 2020/2/12 20:01, Jeff Layton wrote:
On Wed, 2020-02-12 at 03:54 -0500, xiubli@xxxxxxxxxx wrote:
[...]
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 9a21054059f2..8df506dd9039 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1175,7 +1175,57 @@ static void ceph_free_fc(struct fs_context *fc)
static int ceph_reconfigure_fc(struct fs_context *fc)
{
- sync_filesystem(fc->root->d_sb);
+ struct super_block *sb = fc->root->d_sb;
+ struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+ struct ceph_mount_options *fsopt = fsc->mount_options;
+ struct ceph_parse_opts_ctx *pctx = fc->fs_private;
+ struct ceph_mount_options *new_fsopt = pctx->opts;
+ int ret;
+
+ sync_filesystem(sb);
+
+ ret = ceph_reconfigure_copts(fc, pctx->copts, fsc->client->options);
+ if (ret)
+ return ret;
+
+ if (new_fsopt->snapdir_name != fsopt->snapdir_name)
+ return invalf(fc, "ceph: reconfiguration of snapdir_name not allowed");
+
+ if (new_fsopt->mds_namespace != fsopt->mds_namespace)
+ return invalf(fc, "ceph: reconfiguration of mds_namespace not allowed");
+
+ if (new_fsopt->wsize != fsopt->wsize)
+ return invalf(fc, "ceph: reconfiguration of wsize not allowed");
+ if (new_fsopt->rsize != fsopt->rsize)
+ return invalf(fc, "ceph: reconfiguration of rsize not allowed");
+ if (new_fsopt->rasize != fsopt->rasize)
+ return invalf(fc, "ceph: reconfiguration of rasize not allowed");
+
Odd. I would think the wsize, rsize and rasize are things you _could_
reconfigure at remount time.
In any case, I agree with Ilya. Not everything can be changed on a
remount. It'd be best to identify some small subset of mount options
that you do need to allow to be changed, and ensure we can do that.
Checked this again, the wsize/rasize should be okay for this.
But for the rsize, we need to apply the change to the bdi->io_pages,
which will be used in the ondemand_readahead(), likes:
392 /*
393 * If the request exceeds the readahead window, allow the
read to
394 * be up to the optimal hardware IO size
395 */
396 if (req_size > max_pages && bdi->io_pages > max_pages)
397 max_pages = min(req_size, bdi->io_pages);
For example:
Assume the max_pages = 100, req_size = 1000, the old bdi->io_pages = 10.
If the bdi->io_pages get changed from 10 --> 1000, between Line#396 and
Line#397, after Line#397 we are expecting to get max_pages = 10, but
actually we get 1000 instead.
But this should be okay for the page cache readahead stuff, it doesn't
matter here, right ? If so we can reconfigure the rsize then.
Thanks.