Skip to content

Commit

Permalink
rbd: restore zeroing past the overlap when reading from parent
Browse files Browse the repository at this point in the history
The parent image is read only up to the overlap point, the rest of
the buffer should be zeroed.  This snuck in because as it turns out
the overlap test case has not been triggering this code path for
a while now.

Fixes: a9b67e6 ("rbd: replace obj_req->tried_parent with obj_req->read_state")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Ilya Dryomov committed Aug 28, 2019
1 parent e8c9920 commit d435c9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3038,6 +3038,17 @@ static bool rbd_obj_advance_read(struct rbd_obj_request *obj_req, int *result)
}
return true;
case RBD_OBJ_READ_PARENT:
/*
* The parent image is read only up to the overlap -- zero-fill
* from the overlap to the end of the request.
*/
if (!*result) {
u32 obj_overlap = rbd_obj_img_extents_bytes(obj_req);

if (obj_overlap < obj_req->ex.oe_len)
rbd_obj_zero_range(obj_req, obj_overlap,
obj_req->ex.oe_len - obj_overlap);
}
return true;
default:
BUG();
Expand Down

0 comments on commit d435c9a

Please sign in to comment.