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>
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;