Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373541
b: refs/heads/master
c: 15228ed
h: refs/heads/master
i:
  373539: 2afd4aa
v: v3
  • Loading branch information
Alex Elder committed May 2, 2013
1 parent 991c215 commit c1549fe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33dca39f5c0c750d37d3d89ce8ae66be08280a45
refs/heads/master: 15228ede7d9437b0dcfe9331c9830b3646fdadf7
23 changes: 23 additions & 0 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,25 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev)
return ret;
}

/*
* Clear the rbd device's EXISTS flag if the snapshot it's mapped to
* has disappeared from the (just updated) snapshot context.
*/
static void rbd_exists_validate(struct rbd_device *rbd_dev)
{
u64 snap_id;

if (!test_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags))
return;

snap_id = rbd_dev->spec->snap_id;
if (snap_id == CEPH_NOSNAP)
return;

if (rbd_dev_snap_index(rbd_dev, snap_id) == BAD_SNAP_INDEX)
clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
}

static int rbd_dev_refresh(struct rbd_device *rbd_dev)
{
u64 image_size;
Expand All @@ -3126,6 +3145,10 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev)
ret = rbd_dev_v1_refresh(rbd_dev);
else
ret = rbd_dev_v2_refresh(rbd_dev);

/* If it's a mapped snapshot, validate its EXISTS flag */

rbd_exists_validate(rbd_dev);
mutex_unlock(&ctl_mutex);
if (ret)
rbd_warn(rbd_dev, "got notification but failed to "
Expand Down

0 comments on commit c1549fe

Please sign in to comment.