rbd: re-submit read request for flattened clone
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)
commit02c74fbad9d4a5149756eb35be7300736e4904e9
tree927c54fd4815af9d7fa5d10100618febe6f87642
parent392a9dad7e777296fe79d97a6b3acd735ad2eb5f
rbd: re-submit read request for flattened clone

If a clone image gets flattened while a parent read request is
underway, the original rbd object request needs to be resubmitted.

The reason is that by the time we get the response to the parent
read request, the data read from the parent may be out of date.
In other words, we could see this sequence of events:

    rbd client                      parent image/osd
    ----------                      ----------------
    original object ENOENT;
        issue parent read
                                    respond to parent read
                                    child image flattened
    original image header refresh
             <--- original object written independently here
    parent read response received

Add code to rbd_img_parent_read_callback() to detect when a clone's
parent image has disappeared (as evidenced by its parent overlap
becoming 0), and re-submit the original read request in that case.

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