]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge branch 'wip-4249' into wip-4249-master
authorJosh Durgin <josh.durgin@inktank.com>
Mon, 25 Feb 2013 20:05:16 +0000 (12:05 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 25 Feb 2013 20:12:04 +0000 (12:12 -0800)
Make snap_rollback() only take a read lock on snap_lock, since
it does not modify snapshot-related fields.
Conflicts:
src/librbd/internal.cc

1  2 
src/librbd/internal.cc

index d913b314edd4f9b61269348010285ea68850fcf0,a4c25dfaa524a9c66e2b114090cf885ef3b0d95f..9c8276fd4fd534b3b3e93fe3be4d3b5db568afe0
@@@ -1735,18 -1748,24 +1735,24 @@@ reprotect_and_return_err
      if (r < 0)
        return r;
  
 -    Mutex::Locker l(ictx->md_lock);
 +    RWLock::WLocker l(ictx->md_lock);
-     RWLock::WLocker l2(ictx->snap_lock);
-     if (!ictx->snap_exists)
-       return -ENOENT;
+     snap_t snap_id;
+     uint64_t new_size;
+     {
+       // need to drop snap_lock before invalidating cache
 -      Mutex::Locker l2(ictx->snap_lock);
++      RWLock::RLocker l2(ictx->snap_lock);
+       if (!ictx->snap_exists)
+       return -ENOENT;
  
-     if (ictx->snap_id != CEPH_NOSNAP || ictx->read_only)
-       return -EROFS;
+       if (ictx->snap_id != CEPH_NOSNAP || ictx->read_only)
+       return -EROFS;
  
-     snap_t snap_id = ictx->get_snap_id(snap_name);
-     if (snap_id == CEPH_NOSNAP) {
-       lderr(cct) << "No such snapshot found." << dendl;
-       return -ENOENT;
+       snap_id = ictx->get_snap_id(snap_name);
+       if (snap_id == CEPH_NOSNAP) {
+       lderr(cct) << "No such snapshot found." << dendl;
+       return -ENOENT;
+       }
+       new_size = ictx->get_image_size(ictx->snap_id);
      }
  
      // need to flush any pending writes before resizing and rolling back -