The only way for a parent to disappear is a racing flatten completing,
or possibly in the future the image being forcibly removed. In either
case, continuing to flatten makes no sense, so stop early.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit
a1ae8562877d1b902918e866a1699214090c40bd)
assert(object_overlap <= object_size);
RWLock::RLocker l(ictx->parent_lock);
+ // stop early if the parent went away - it just means
+ // another flatten finished first, so this one is useless.
+ if (!ictx->parent) {
+ r = 0;
+ goto err;
+ }
if ((r = read(ictx->parent, objectx, buf, NULL)) < 0) {
lderr(ictx->cct) << "reading from parent failed" << dendl;
goto err;