From: Sage Weil Date: Mon, 15 Feb 2010 21:47:41 +0000 (-0800) Subject: mds: infer 'follows' in journal_dirty_inode on non-head inodes X-Git-Tag: v0.19~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b1a90e648fc26b286b6c08a4063dc74071bcde1;p=ceph.git mds: infer 'follows' in journal_dirty_inode on non-head inodes 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. --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index dc73cb970f63..64c710440cb7 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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);