aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/super.c')
-rw-r--r--fs/ceph/super.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 43ca3b763875..eab1359d0553 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -602,6 +602,8 @@ static int extra_mon_dispatch(struct ceph_client *client, struct ceph_msg *msg)
602 602
603/* 603/*
604 * create a new fs client 604 * create a new fs client
605 *
606 * Success or not, this function consumes @fsopt and @opt.
605 */ 607 */
606static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, 608static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
607 struct ceph_options *opt) 609 struct ceph_options *opt)
@@ -609,17 +611,20 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
609 struct ceph_fs_client *fsc; 611 struct ceph_fs_client *fsc;
610 int page_count; 612 int page_count;
611 size_t size; 613 size_t size;
612 int err = -ENOMEM; 614 int err;
613 615
614 fsc = kzalloc(sizeof(*fsc), GFP_KERNEL); 616 fsc = kzalloc(sizeof(*fsc), GFP_KERNEL);
615 if (!fsc) 617 if (!fsc) {
616 return ERR_PTR(-ENOMEM); 618 err = -ENOMEM;
619 goto fail;
620 }
617 621
618 fsc->client = ceph_create_client(opt, fsc); 622 fsc->client = ceph_create_client(opt, fsc);
619 if (IS_ERR(fsc->client)) { 623 if (IS_ERR(fsc->client)) {
620 err = PTR_ERR(fsc->client); 624 err = PTR_ERR(fsc->client);
621 goto fail; 625 goto fail;
622 } 626 }
627 opt = NULL; /* fsc->client now owns this */
623 628
624 fsc->client->extra_mon_dispatch = extra_mon_dispatch; 629 fsc->client->extra_mon_dispatch = extra_mon_dispatch;
625 fsc->client->osdc.abort_on_full = true; 630 fsc->client->osdc.abort_on_full = true;
@@ -677,6 +682,9 @@ fail_client:
677 ceph_destroy_client(fsc->client); 682 ceph_destroy_client(fsc->client);
678fail: 683fail:
679 kfree(fsc); 684 kfree(fsc);
685 if (opt)
686 ceph_destroy_options(opt);
687 destroy_mount_options(fsopt);
680 return ERR_PTR(err); 688 return ERR_PTR(err);
681} 689}
682 690
@@ -1042,8 +1050,6 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
1042 fsc = create_fs_client(fsopt, opt); 1050 fsc = create_fs_client(fsopt, opt);
1043 if (IS_ERR(fsc)) { 1051 if (IS_ERR(fsc)) {
1044 res = ERR_CAST(fsc); 1052 res = ERR_CAST(fsc);
1045 destroy_mount_options(fsopt);
1046 ceph_destroy_options(opt);
1047 goto out_final; 1053 goto out_final;
1048 } 1054 }
1049 1055