@@ -333,8 +333,8 @@ static int build_snap_context(struct ceph_snap_realm *realm)
if (num == 0 && realm->seq == empty_snapc->seq) {
ceph_get_snap_context(empty_snapc);
- realm->cached_context = empty_snapc;
- return 0;
+ snapc = empty_snapc;
+ goto done;
}
/* alloc new snap context */
@@ -374,6 +374,7 @@ static int build_snap_context(struct ceph_snap_realm *realm)
realm->ino, realm, snapc, snapc->seq,
(unsigned int) snapc->num_snaps);
+done:
ceph_put_snap_context(realm->cached_context);
realm->cached_context = snapc;
return 0;
@@ -939,13 +940,12 @@ out:
return;
}
-int ceph_snap_init(void)
+int __init ceph_snap_init(void)
{
empty_snapc = ceph_create_snap_context(0, GFP_NOFS);
if (!empty_snapc)
return -ENOMEM;
empty_snapc->seq = 1;
- empty_snapc->num_snaps = 0;
return 0;
}
@@ -1031,13 +1031,13 @@ static int __init init_ceph(void)
goto out_xattr;
ret = register_filesystem(&ceph_fs_type);
if (ret)
- goto out_icache;
+ goto out_snap;
pr_info("loaded (mds proto %d)\n", CEPH_MDSC_PROTOCOL);
return 0;
-out_icache:
+out_snap:
ceph_snap_exit();
out_xattr:
ceph_xattr_exit();
@@ -701,7 +701,7 @@ extern void ceph_queue_cap_snap(struct ceph_inode_info *ci);
extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
struct ceph_cap_snap *capsnap);
extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc);
-extern int __init ceph_snap_init(void);
+extern int ceph_snap_init(void);
extern void ceph_snap_exit(void);
/*