Commit 15e52d9a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

Pull Ceph fix from Sage Weil:
 "This fixes a corner case for cloned RBD images"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  rbd: handle parent_overlap on writes correctly
parents d91d66e8 9638556a
...@@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request) ...@@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request)
return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0;
} }
static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request)
{
struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
return obj_request->img_offset <
round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header));
}
static void rbd_obj_request_get(struct rbd_obj_request *obj_request) static void rbd_obj_request_get(struct rbd_obj_request *obj_request)
{ {
dout("%s: obj %p (was %d)\n", __func__, obj_request, dout("%s: obj %p (was %d)\n", __func__, obj_request,
...@@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request) ...@@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
*/ */
if (!img_request_write_test(img_request) || if (!img_request_write_test(img_request) ||
!img_request_layered_test(img_request) || !img_request_layered_test(img_request) ||
rbd_dev->parent_overlap <= obj_request->img_offset || !obj_request_overlaps_parent(obj_request) ||
((known = obj_request_known_test(obj_request)) && ((known = obj_request_known_test(obj_request)) &&
obj_request_exists_test(obj_request))) { obj_request_exists_test(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