Skip to contentSkip to conversation

rbd: ignore zero-overlap parent

PATCH In review Alex Elder 2 participants 2 messages May 11, 2013

Subsystems (2)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 rbd: ignore zero-overlap parent

An rbd clone image that has an overlap with its parent of 0 is effectively not a layered image at all. Detect this case and treat such an image as non-layered. Issue a warning to be sure the user knows what's going on.

This resolves:

    http://tracker.ceph.com/issues/5028
---
 drivers/block/rbd.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/block/rbd.c +0 -0
index b9221a0..3a8135f 100644
@@ -3655,9 +3655,13 @@ static int rbd_dev_v2_parent_info(struct

rbd_device *rbd_dev)
ceph_decode_64_safe(&p, end, parent_spec->snap_id, out_err); ceph_decode_64_safe(&p, end, overlap, out_err);

- rbd_dev->parent_overlap = overlap;
- rbd_dev->parent_spec = parent_spec;
- parent_spec = NULL; /* rbd_dev now owns this */
+ if (overlap) {
+ rbd_dev->parent_spec = parent_spec;
+ parent_spec = NULL; /* rbd_dev now owns this */
+ rbd_dev->parent_overlap = overlap;
+ } else {
+ rbd_warn(rbd_dev, "ignoring parent of clone with overlap 0\n");
+ }
out:
ret = 0;
out_err:

Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 lines · Alex Elder

An rbd clone image that has an overlap with its parent of 0 is effectively not a layered image at all. Detect this case and treat such an image as non-layered. Issue a warning to be sure the user knows what's going on.

This resolves:

     http://tracker.ceph.com/issues/5028
---
  drivers/block/rbd.c |   10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/block/rbd.c +7 -3
index b9221a0..3a8135f 100644
@@ -3655,9 +3655,13 @@ static int rbd_dev_v2_parent_info(struct
 rbd_device *rbd_dev)
  	ceph_decode_64_safe(&p, end, parent_spec->snap_id, out_err);
  	ceph_decode_64_safe(&p, end, overlap, out_err);
 
-	rbd_dev->parent_overlap = overlap;
-	rbd_dev->parent_spec = parent_spec;
-	parent_spec = NULL;	/* rbd_dev now owns this */
+	if (overlap) {
+		rbd_dev->parent_spec = parent_spec;
+		parent_spec = NULL;	/* rbd_dev now owns this */
+		rbd_dev->parent_overlap = overlap;
+	} else {
+		rbd_warn(rbd_dev, "ignoring parent of clone with overlap 0\n");
+	}
  out:
  	ret = 0;

out_err: