]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: infer 'follows' in journal_dirty_inode on non-head inodes
authorSage Weil <sage@newdream.net>
Mon, 15 Feb 2010 21:47:41 +0000 (13:47 -0800)
committerSage Weil <sage@newdream.net>
Mon, 15 Feb 2010 21:47:50 +0000 (13:47 -0800)
There are lots of callers to journal_dirty_inode that may
unwittingly be dealing with a non-head inode (e.g.
check_file_max).  If the provided inode is snapped, infer an
appropriate follows values so as not to cow_inode() again.

src/mds/MDCache.cc

index dc73cb970f63715f3835dfc3497cd08963108b03..64c710440cb7c96ad766e140e3397abb0de8ced1 100644 (file)
@@ -1405,6 +1405,8 @@ inode_t *MDCache::journal_dirty_inode(Mutation *mut, EMetaBlob *metablob, CInode
   if (in->is_root()) {
     return metablob->add_root(true, in, in->get_projected_inode());
   } else {
+    if (follows == CEPH_NOSNAP && in->last != CEPH_NOSNAP)
+      follows = in->first - 1;
     CDentry *dn = in->get_projected_parent_dn();
     if (!dn->get_projected_linkage()->is_null())  // no need to cow a null dentry
       journal_cow_dentry(mut, metablob, dn, follows);