aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2014-04-07 19:54:10 -0400
committerIlya Dryomov <idryomov@redhat.com>2014-10-14 13:03:33 -0400
commitd0265de7c358d71a494dcd1ee28206b32754bb0f (patch)
tree47ddd34a1db3d1f6adeea09624733f1301ab10a8 /drivers/block
parentbef95455a44e2533fcea376740bb1a5cbd71269f (diff)
rbd: tolerate -ENOENT for discard operations
Discard may try to delete an object from a non-layered image that does not exist. If this occurs, the image already has no data in that range, so change the result to success. Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index de1520ccc0d4..835a96a09a6b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1767,6 +1767,9 @@ static void rbd_osd_discard_callback(struct rbd_obj_request *obj_request)
1767 * it to our originally-requested length. 1767 * it to our originally-requested length.
1768 */ 1768 */
1769 obj_request->xferred = obj_request->length; 1769 obj_request->xferred = obj_request->length;
1770 /* discarding a non-existent object is not a problem */
1771 if (obj_request->result == -ENOENT)
1772 obj_request->result = 0;
1770 obj_request_done_set(obj_request); 1773 obj_request_done_set(obj_request);
1771} 1774}
1772 1775