]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: sync object_map object in lfn_remove when nlink > 1
authorSamuel Just <sam.just@inktank.com>
Wed, 27 Jun 2012 22:16:42 +0000 (15:16 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 28 Jun 2012 16:53:19 +0000 (09:53 -0700)
In the following sequence:

1) create (a, 1)
2) setattr (a, 1)
3) link (a, 1), (b, 1)
4) remove (a, 1)

If we play 1-4 and then replay 1-4 again, we will end up removing
(b, 1)'s attributes since nlink for (a, 1) the second time through
is 1.  We fix this by marking spos on the object_map header for
(a, 1) when we remove (a, 1) but not eh attributes.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/os/FileStore.cc

index 41433e7683977334acd207a18c9ddc702b3f409b..e664d476267e75455d520ea8848fd7964af5add7 100644 (file)
@@ -389,6 +389,12 @@ int FileStore::lfn_unlink(coll_t cid, const hobject_t& o,
       r = object_map->clear(o, &spos);
       if (r < 0 && r != -ENOENT)
        return r;
+    } else {
+      /* Ensure that replay of this op doesn't result in the object_map
+       * going away.
+       */
+      if (!btrfs_stable_commits)
+       object_map->sync(&o, &spos);
     }
   }
   return index->unlink(o);