]> Pileus Git - ~andy/linux/commit
rbd: detect when clone image is flattened
authorAlex Elder <elder@inktank.com>
Mon, 6 May 2013 22:40:33 +0000 (17:40 -0500)
committerAlex Elder <elder@inktank.com>
Mon, 13 May 2013 20:06:45 +0000 (15:06 -0500)
commit392a9dad7e777296fe79d97a6b3acd735ad2eb5f
tree3007be625c9d59c38184bce538c20bf233441b06
parenta2acd00e7964dbb1668a5956c9d0a4bdeb838c4a
rbd: detect when clone image is flattened

A format 2 clone image can be the subject of a "flatten" operation,
during which all of its data gets "copied up" from its parent image,
leaving the image fully populated.  Once this is complete, the
clone's association with the parent is abolished.

Since this can occur when a clone is mapped, we need to detect when
it has occurred and handle it accordingly.  We know an image has
been flattened when we know it at one time had a parent, but we have
learned (via a "get_parent" object class method call) it no longer
has one.

There might be in-flight requests at the point we learn an image has
been flattened, so we can't simply clean up parent data structures
right away.  Instead, we'll drop the initial parent reference when
the parent has disappeared (rather than when the image gets
destroyed), which will allow the last in-flight reference to clean
things up when it's complete.

We leverage the fact that a zero parent overlap renders an image
effectively unlayered.  We set the overlap to 0 at the point we
detect the clone image has flattened, which allows the unlayered
behavior to take effect immediately, while keeping other parent
structures in place until in-flight requests to complete.

This and the next few patches resolve:
    http://tracker.ceph.com/issues/3763

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c