diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-05-01 10:03:40 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-06-25 11:49:28 +0300 |
commit | 7b06a826e7c52d77ce801e5960ecf0338eafe886 (patch) | |
tree | cb4f7bc04116a3a4d673152096bc994131304574 /fs/ceph/snap.c | |
parent | b01da6a08c523f5d1cd1a51107f8cca061040f45 (diff) | |
download | linux-stable-7b06a826e7c52d77ce801e5960ecf0338eafe886.tar.gz linux-stable-7b06a826e7c52d77ce801e5960ecf0338eafe886.tar.bz2 linux-stable-7b06a826e7c52d77ce801e5960ecf0338eafe886.zip |
ceph: use empty snap context for uninline_data and get_pool_perm
Cached_context in ceph_snap_realm is directly accessed by
uninline_data() and get_pool_perm(). This is racy in theory.
both uninline_data() and get_pool_perm() do not modify existing
object, they only create new object. So we can pass the empty
snap context to them. Unlike cached_context in ceph_snap_realm,
we do not need to protect the empty snap context.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/snap.c')
-rw-r--r-- | fs/ceph/snap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index a97e39f09ba6..b2a945345d2b 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -296,7 +296,7 @@ static int cmpu64_rev(const void *a, const void *b) } -static struct ceph_snap_context *empty_snapc; +struct ceph_snap_context *ceph_empty_snapc; /* * build the snap context for a given realm. @@ -338,9 +338,9 @@ static int build_snap_context(struct ceph_snap_realm *realm) return 0; } - if (num == 0 && realm->seq == empty_snapc->seq) { - ceph_get_snap_context(empty_snapc); - snapc = empty_snapc; + if (num == 0 && realm->seq == ceph_empty_snapc->seq) { + ceph_get_snap_context(ceph_empty_snapc); + snapc = ceph_empty_snapc; goto done; } @@ -482,7 +482,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) cap_snap. lucky us. */ dout("queue_cap_snap %p already pending\n", inode); kfree(capsnap); - } else if (ci->i_snap_realm->cached_context == empty_snapc) { + } else if (ci->i_snap_realm->cached_context == ceph_empty_snapc) { dout("queue_cap_snap %p empty snapc\n", inode); kfree(capsnap); } else if (dirty & (CEPH_CAP_AUTH_EXCL|CEPH_CAP_XATTR_EXCL| @@ -964,14 +964,14 @@ out: int __init ceph_snap_init(void) { - empty_snapc = ceph_create_snap_context(0, GFP_NOFS); - if (!empty_snapc) + ceph_empty_snapc = ceph_create_snap_context(0, GFP_NOFS); + if (!ceph_empty_snapc) return -ENOMEM; - empty_snapc->seq = 1; + ceph_empty_snapc->seq = 1; return 0; } void ceph_snap_exit(void) { - ceph_put_snap_context(empty_snapc); + ceph_put_snap_context(ceph_empty_snapc); } |