Skip to content

Commit bef9545

Browse files
jdurginidryomov
authored andcommitted
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>
1 parent 3c5df89 commit bef9545

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/block/rbd.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,8 @@ static void rbd_img_request_destroy(struct kref *kref)
21702170
rbd_dev_parent_put(img_request->rbd_dev);
21712171
}
21722172

2173-
if (img_request_write_test(img_request))
2173+
if (img_request_write_test(img_request) ||
2174+
img_request_discard_test(img_request))
21742175
ceph_put_snap_context(img_request->snapc);
21752176

21762177
kmem_cache_free(rbd_img_request_cache, img_request);

0 commit comments

Comments
 (0)