From 2b6093b3af1a9c6a20890164646131eed91db8c3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 25 Jul 2008 07:21:10 -0700 Subject: [PATCH] kclient: fix multiple subdir mounts from same client (remove path from mount_args) --- src/kernel/super.c | 26 ++++++++++++++------------ src/kernel/super.h | 1 - 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/kernel/super.c b/src/kernel/super.c index d624a8a67f9b2..e5c47ae3d0a8c 100644 --- a/src/kernel/super.c +++ b/src/kernel/super.c @@ -418,7 +418,7 @@ bad: } static int parse_mount_args(int flags, char *options, const char *dev_name, - struct ceph_mount_args *args) + struct ceph_mount_args *args, const char **path) { char *c; int len, err; @@ -453,11 +453,9 @@ static int parse_mount_args(int flags, char *options, const char *dev_name, /* path on server */ c++; while (*c == '/') c++; /* remove leading '/'(s) */ - if (strlen(c) >= sizeof(args->path)) - return -ENAMETOOLONG; - strcpy(args->path, c); + *path = c; - dout(15, "server path '%s'\n", args->path); + dout(15, "server path '%s'\n", *path); /* parse mount options */ while ((c = strsep(&options, ",")) != NULL) { @@ -635,7 +633,8 @@ static int have_all_maps(struct ceph_client *client) client->mdsc.mdsmap && client->mdsc.mdsmap->m_epoch; } -static struct dentry *open_root_dentry(struct ceph_client *client) +static struct dentry *open_root_dentry(struct ceph_client *client, + const char *path) { struct ceph_mds_client *mdsc = &client->mdsc; struct ceph_mds_request *req = 0; @@ -644,9 +643,9 @@ static struct dentry *open_root_dentry(struct ceph_client *client) struct dentry *root; /* open dir */ - dout(30, "open_root_inode opening '%s'\n", client->mount_args.path); + dout(30, "open_root_inode opening '%s'\n", path); req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, - 1, client->mount_args.path, 0, 0, + 1, path, 0, 0, NULL, USE_ANY_MDS); if (IS_ERR(req)) return ERR_PTR(PTR_ERR(req)); @@ -668,7 +667,8 @@ static struct dentry *open_root_dentry(struct ceph_client *client) /* * mount: join the ceph cluster. */ -int ceph_mount(struct ceph_client *client, struct vfsmount *mnt) +int ceph_mount(struct ceph_client *client, struct vfsmount *mnt, + const char *path) { struct ceph_entity_addr *myaddr = 0; struct ceph_msg *mount_msg; @@ -730,7 +730,7 @@ int ceph_mount(struct ceph_client *client, struct vfsmount *mnt) } dout(30, "mount opening base mountpoint\n"); - root = open_root_dentry(client); + root = open_root_dentry(client, path); if (IS_ERR(root)) { err = PTR_ERR(root); goto out; @@ -894,6 +894,7 @@ static int ceph_get_sb(struct file_system_type *fs_type, struct ceph_client *client; int err; int (*compare_super)(struct super_block *, void *) = ceph_compare_super; + const char *path; dout(25, "ceph_get_sb\n"); @@ -902,7 +903,8 @@ static int ceph_get_sb(struct file_system_type *fs_type, if (IS_ERR(client)) return PTR_ERR(client); - err = parse_mount_args(flags, data, dev_name, &client->mount_args); + err = parse_mount_args(flags, data, dev_name, + &client->mount_args, &path); if (err < 0) goto out; @@ -922,7 +924,7 @@ static int ceph_get_sb(struct file_system_type *fs_type, } else dout(20, "get_sb using new client %p\n", client); - err = ceph_mount(client, mnt); + err = ceph_mount(client, mnt, path); if (err < 0) goto out_splat; dout(22, "root ino %llx\n", ceph_ino(mnt->mnt_root->d_inode)); diff --git a/src/kernel/super.h b/src/kernel/super.h index f08f3589f9c62..476515a56a0a9 100644 --- a/src/kernel/super.h +++ b/src/kernel/super.h @@ -103,7 +103,6 @@ struct ceph_mount_args { struct ceph_entity_addr my_addr; int num_mon; struct ceph_entity_addr mon_addr[5]; - char path[100]; int wsize; int osd_timeout; }; -- 2.39.5