Skip to content

Commit d0265de

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

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/block/rbd.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,9 @@ static void rbd_osd_discard_callback(struct rbd_obj_request *obj_request)
17671767
* it to our originally-requested length.
17681768
*/
17691769
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;
17701773
obj_request_done_set(obj_request);
17711774
}
17721775

0 commit comments

Comments
 (0)