From: Josh Durgin Date: Sat, 5 Apr 2014 00:47:52 +0000 (-0700) Subject: rbd: fix snapshot context reference count for discards X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bef95455a44e2533fcea376740bb1a5cbd71269f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 --- 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) rbd_dev_parent_put(img_request->rbd_dev); } - if (img_request_write_test(img_request)) + if (img_request_write_test(img_request) || + img_request_discard_test(img_request)) ceph_put_snap_context(img_request->snapc); kmem_cache_free(rbd_img_request_cache, img_request);