From: Josh Durgin Date: Mon, 7 Apr 2014 23:54:10 +0000 (-0700) Subject: rbd: tolerate -ENOENT for discard operations X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d0265de7c358d71a494dcd1ee28206b32754bb0f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 --- 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) * it to our originally-requested length. */ obj_request->xferred = obj_request->length; + /* discarding a non-existent object is not a problem */ + if (obj_request->result == -ENOENT) + obj_request->result = 0; obj_request_done_set(obj_request); }