diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2014-04-04 20:47:52 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@redhat.com> | 2014-10-14 13:03:32 -0400 |
commit | bef95455a44e2533fcea376740bb1a5cbd71269f (patch) | |
tree | efa29053bad92a2b961dbc702351f73e7e27678a /drivers/block/rbd.c | |
parent | 3c5df89367761d09d76454a2c4301a73bf2d46ce (diff) |
rbd: fix snapshot context reference count for discards
Discards take a reference to the snapshot context of an image when
they are created. This reference needs to be cleaned up when the
request is done just as it is for regular writes.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 31ace3dd33e4..de1520ccc0d4 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2170,7 +2170,8 @@ static void rbd_img_request_destroy(struct kref *kref) | |||
2170 | rbd_dev_parent_put(img_request->rbd_dev); | 2170 | rbd_dev_parent_put(img_request->rbd_dev); |
2171 | } | 2171 | } |
2172 | 2172 | ||
2173 | if (img_request_write_test(img_request)) | 2173 | if (img_request_write_test(img_request) || |
2174 | img_request_discard_test(img_request)) | ||
2174 | ceph_put_snap_context(img_request->snapc); | 2175 | ceph_put_snap_context(img_request->snapc); |
2175 | 2176 | ||
2176 | kmem_cache_free(rbd_img_request_cache, img_request); | 2177 | kmem_cache_free(rbd_img_request_cache, img_request); |