diff mbox series

[3/4] ceph: record updated mon_addr on remount

Message ID 20210628075545.702106-4-vshankar@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: new mount device syntax | expand

Commit Message

Venky Shankar June 28, 2021, 7:55 a.m. UTC
Note that the new monitors are just shown in /proc/mounts.
Ceph does not (re)connect to new monitors yet.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 fs/ceph/super.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jeff Layton June 28, 2021, 3:19 p.m. UTC | #1
On Mon, 2021-06-28 at 13:25 +0530, Venky Shankar wrote:
> Note that the new monitors are just shown in /proc/mounts.
> Ceph does not (re)connect to new monitors yet.
> 

I wasn't sure we'd want to do that anyway, but now I think it might be a
good idea. Being able to re-point a client to a new set of mons manually
seems like a reasonable thing to be able to do in a disaster recovery
situation or the like.

> Signed-off-by: Venky Shankar <vshankar@redhat.com>
> ---
>  fs/ceph/super.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index 84bc06e51680..48493ac372fa 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -1250,6 +1250,12 @@ static int ceph_reconfigure_fc(struct fs_context *fc)
>  	else
>  		ceph_clear_mount_opt(fsc, ASYNC_DIROPS);
>  
> +	if (strcmp(fsc->mount_options->mon_addr, fsopt->mon_addr)) {
> +		kfree(fsc->mount_options->mon_addr);
> +		fsc->mount_options->mon_addr = kstrdup(fsopt->mon_addr,
> +						       GFP_KERNEL);
> +	}
> +

It's probably worth logging a KERN_NOTICE message or something that the
new monitor addresses were ignored. That way, if you implement
connecting to the new mons on remount later you'd have a way to tell.


>  	sync_filesystem(fc->root->d_sb);
>  	return 0;
>  }
diff mbox series

Patch

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 84bc06e51680..48493ac372fa 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1250,6 +1250,12 @@  static int ceph_reconfigure_fc(struct fs_context *fc)
 	else
 		ceph_clear_mount_opt(fsc, ASYNC_DIROPS);
 
+	if (strcmp(fsc->mount_options->mon_addr, fsopt->mon_addr)) {
+		kfree(fsc->mount_options->mon_addr);
+		fsc->mount_options->mon_addr = kstrdup(fsopt->mon_addr,
+						       GFP_KERNEL);
+	}
+
 	sync_filesystem(fc->root->d_sb);
 	return 0;
 }