Commit 132ca7e1 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: fix mounting same fs multiple times

Now __ceph_open_session() only accepts closed client. An opened
client will tigger BUG_ON().
Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
parent 45311267
...@@ -793,22 +793,20 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc, ...@@ -793,22 +793,20 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
struct dentry *root; struct dentry *root;
int first = 0; /* first vfsmount for this super_block */ int first = 0; /* first vfsmount for this super_block */
dout("mount start\n"); dout("mount start %p\n", fsc);
mutex_lock(&fsc->client->mount_mutex); mutex_lock(&fsc->client->mount_mutex);
err = __ceph_open_session(fsc->client, started); if (!fsc->sb->s_root) {
if (err < 0) err = __ceph_open_session(fsc->client, started);
goto out; if (err < 0)
goto out;
dout("mount opening root\n"); dout("mount opening root\n");
root = open_root_dentry(fsc, "", started); root = open_root_dentry(fsc, "", started);
if (IS_ERR(root)) { if (IS_ERR(root)) {
err = PTR_ERR(root); err = PTR_ERR(root);
goto out; goto out;
} }
if (fsc->sb->s_root) {
dput(root);
} else {
fsc->sb->s_root = root; fsc->sb->s_root = root;
first = 1; first = 1;
...@@ -818,6 +816,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc, ...@@ -818,6 +816,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
} }
if (path[0] == 0) { if (path[0] == 0) {
root = fsc->sb->s_root;
dget(root); dget(root);
} else { } else {
dout("mount opening base mountpoint\n"); dout("mount opening base mountpoint\n");
...@@ -833,16 +832,14 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc, ...@@ -833,16 +832,14 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
mutex_unlock(&fsc->client->mount_mutex); mutex_unlock(&fsc->client->mount_mutex);
return root; return root;
out:
mutex_unlock(&fsc->client->mount_mutex);
return ERR_PTR(err);
fail: fail:
if (first) { if (first) {
dput(fsc->sb->s_root); dput(fsc->sb->s_root);
fsc->sb->s_root = NULL; fsc->sb->s_root = NULL;
} }
goto out; out:
mutex_unlock(&fsc->client->mount_mutex);
return ERR_PTR(err);
} }
static int ceph_set_super(struct super_block *s, void *data) static int ceph_set_super(struct super_block *s, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment