Skip to content

Commit

Permalink
rbd: tolerate -ENOENT for discard operations
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jdurgin authored and idryomov committed Oct 14, 2014
1 parent bef9545 commit d0265de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d0265de

Please sign in to comment.