Commit d0265de7 authored by Josh Durgin's avatar Josh Durgin Committed by Ilya Dryomov

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: default avatarJosh Durgin <josh.durgin@inktank.com>
parent bef95455
...@@ -1767,6 +1767,9 @@ static void rbd_osd_discard_callback(struct rbd_obj_request *obj_request) ...@@ -1767,6 +1767,9 @@ static void rbd_osd_discard_callback(struct rbd_obj_request *obj_request)
* it to our originally-requested length. * it to our originally-requested length.
*/ */
obj_request->xferred = obj_request->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); obj_request_done_set(obj_request);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment