Skip to contentSkip to conversation

ceph: fs add reconfiguring superblock parameters support

PATCH New [email protected] 1 participant 1 message Feb 14, 2020 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ceph: fs add reconfiguring superblock parameters support

From: Xiubo Li <[email protected]>

This will enable the remount and reconfiguring superblock params for the fs. Currently some mount options are not allowed to be reconfigured.

It will working like:

$ mount.ceph :/ /mnt/cephfs -o remount,mount_timeout=100

URL:https://tracker.ceph.com/issues/44071

---

Changed in V2:
- remove low level options from reconfiguration.
- switch to seqlock

 fs/ceph/addr.c       |  10 +++-
 fs/ceph/caps.c       |  14 +++--
 fs/ceph/mds_client.c |   5 +-
 fs/ceph/super.c      | 137 ++++++++++++++++++++++++++++++++++++-------
 fs/ceph/super.h      |   2 +
 5 files changed, 138 insertions(+), 30 deletions(-)
fs/ceph/addr.c +8 -2
index d14392b58f16..5c0e6c2d3fde 100644
@@ -882,6 +882,7 @@ static int ceph_writepages_start(struct address_space *mapping,
 	struct ceph_writeback_ctl ceph_wbc;
 	bool should_loop, range_whole = false;
 	bool done = false;
+	unsigned int seq;
 
 	dout("writepages_start %p (mode=%s)\n", inode,
 	     wbc->sync_mode == WB_SYNC_NONE ? "NONE" :
@@ -896,8 +897,13 @@ static int ceph_writepages_start(struct address_space *mapping,
 		mapping_set_error(mapping, -EIO);
 		return -EIO; /* we're in a forced umount, don't write! */
 	}
-	if (fsc->mount_options->wsize < wsize)
-		wsize = fsc->mount_options->wsize;
+
+	do {
+		seq = read_seqbegin(&fsc->mount_options->opt_seqlock);
+
+		if (fsc->mount_options->wsize < wsize)
+			wsize = fsc->mount_options->wsize;
+	} while (read_seqretry(&fsc->mount_options->opt_seqlock, seq));
 
 	pagevec_init(&pvec);
 
fs/ceph/caps.c +10 -4
index b4f122eb74bb..daa7eef13e3a 100644
@@ -490,11 +490,17 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
 			       struct ceph_inode_info *ci)
 {
 	struct ceph_mount_options *opt = mdsc->fsc->mount_options;
+	unsigned int seq;
+
+	do {
+		seq = read_seqbegin(&opt->opt_seqlock);
+
+		ci->i_hold_caps_min = round_jiffies(jiffies +
+					opt->caps_wanted_delay_min * HZ);
+		ci->i_hold_caps_max = round_jiffies(jiffies +
+					opt->caps_wanted_delay_max * HZ);
+	} while (read_seqretry(&opt->opt_seqlock, seq));
 
-	ci->i_hold_caps_min = round_jiffies(jiffies +
-					    opt->caps_wanted_delay_min * HZ);
-	ci->i_hold_caps_max = round_jiffies(jiffies +
-					    opt->caps_wanted_delay_max * HZ);
 	dout("__cap_set_timeouts %p min %lu max %lu\n", &ci->vfs_inode,
 	     ci->i_hold_caps_min - jiffies, ci->i_hold_caps_max - jiffies);
 }
fs/ceph/mds_client.c +3 -2
index 376e7cf1685f..451c3727cd0b 100644
@@ -2099,6 +2099,7 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
 	struct ceph_inode_info *ci = ceph_inode(dir);
 	struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
 	struct ceph_mount_options *opt = req->r_mdsc->fsc->mount_options;
+	unsigned int max_readdir = opt->max_readdir;
 	size_t size = sizeof(struct ceph_mds_reply_dir_entry);
 	unsigned int num_entries;
 	int order;
@@ -2107,7 +2108,7 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
 	num_entries = ci->i_files + ci->i_subdirs;
 	spin_unlock(&ci->i_ceph_lock);
 	num_entries = max(num_entries, 1U);
-	num_entries = min(num_entries, opt->max_readdir);
+	num_entries = min(num_entries, max_readdir);
 
 	order = get_order(size * num_entries);
 	while (order >= 0) {
@@ -2122,7 +2123,7 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
 		return -ENOMEM;
 
 	num_entries = (PAGE_SIZE << order) / size;
-	num_entries = min(num_entries, opt->max_readdir);
+	num_entries = min(num_entries, max_readdir);
 
 	rinfo->dir_buf_size = PAGE_SIZE << order;
 	req->r_num_caps = num_entries + 1;
fs/ceph/super.c +115 -22

176 lines not on this page · raw message

fs/ceph/super.h +2 -0
index 2acc9cc2d23a..aa0e7217a62f 100644
@@ -96,6 +96,8 @@ struct ceph_mount_options {
 	char *mds_namespace;  /* default NULL */
 	char *server_path;    /* default  "/" */
 	char *fscache_uniq;   /* default NULL */
+
+	seqlock_t opt_seqlock;
 };
 
 struct ceph_fs_client {
Signature · 1 line
2.21.0