summaryrefslogtreecommitdiff
path: root/src/librbd.cc
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2012-06-08 08:04:12 -0700
committerJosh Durgin <josh.durgin@inktank.com>2012-06-08 16:38:22 -0700
commit00f4e84153df35815d49440b711c783d5f5fcb36 (patch)
tree7ff0a88ec34f6f82a21e464b06e7ea129c941762 /src/librbd.cc
parent4eb2138e63e72ace18f11725c3bbd4aa2ce16995 (diff)
downloadceph-00f4e84153df35815d49440b711c783d5f5fcb36.tar.gz
librbd: check that the current snapid for a snap name matches
Checking that it exists doesn't prevent you from having the snapshot change out from under you in the following situation: You have the image open at snapshot "foo". Someone removes snapshot "foo", writes some data to the image, and creates a new snapshot called "foo". This second snapshot will have a different id, but nothing prevents it from having the name of a previously deleted snapshot. Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'src/librbd.cc')
-rw-r--r--src/librbd.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librbd.cc b/src/librbd.cc
index d3a78fb569a..737d0161ff0 100644
--- a/src/librbd.cc
+++ b/src/librbd.cc
@@ -1388,7 +1388,7 @@ int ictx_refresh(ImageCtx *ictx)
ictx->snapc = new_snapc;
if (ictx->snapid != CEPH_NOSNAP &&
- ictx->get_snapid(ictx->snapname) == CEPH_NOSNAP) {
+ ictx->get_snapid(ictx->snapname) != ictx->snapid) {
lderr(cct) << "tried to read from a snapshot that no longer exists: "
<< ictx->snapname << dendl;
ictx->snap_exists = false;