]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix dir mtime/ctime
authorSage Weil <sage@newdream.net>
Mon, 30 Jun 2008 19:49:42 +0000 (12:49 -0700)
committerSage Weil <sage@newdream.net>
Mon, 30 Jun 2008 19:49:42 +0000 (12:49 -0700)
src/mds/CInode.cc
src/mds/Locker.cc
src/mds/Server.cc

index 85fa6b017faf5f14d144c5c35a2d8e9687423868..95b0e6f52af74b75950f047739ca6aa653b2a549 100644 (file)
@@ -759,6 +759,7 @@ void CInode::finish_scatter_gather_update(int type)
          dout(20) << "    ignoring OLD accounted_fragstat " << pf->fragstat << dendl;
        }
       }
+      pi->mtime = pi->ctime = pi->dirstat.mtime;
       pi->dirstat.version++;
       dout(20) << "        final dirstat " << pi->dirstat << dendl;
       assert(pi->dirstat.size() >= 0);
index bc3ab37265b0ae9a3607146310ec0a70a7b03ddc..ecd16cb516c2a3efe5f301428ea349285d55df62 100644 (file)
@@ -1274,6 +1274,10 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob,
   bool do_parent_mtime = flags & PREDIRTY_DIR;
   bool shallow = flags & PREDIRTY_SHALLOW;
 
+  // declare now?
+  if (mut->now == utime_t())
+    mut->now = g_clock.real_now();
+
   dout(10) << "predirty_nested"
           << (do_parent_mtime ? " do_parent_mtime":"")
           << " linkunlink=" <<  linkunlink
@@ -1320,10 +1324,13 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob,
     pf->version = parent->pre_dirty();
 
     if (do_parent_mtime) {
-      dout(10) << "predirty_nested updating mtime on " << *parent << dendl;
       pf->fragstat.mtime = mut->now;
-      if (mut->now > pf->fragstat.rctime)
+      if (mut->now > pf->fragstat.rctime) {
+       dout(10) << "predirty_nested updating mtime on " << *parent << dendl;
        pf->fragstat.rctime = mut->now;
+      } else {
+       dout(10) << "predirty_nested updating mtime UNDERWATER on " << *parent << dendl;
+      }
     }
     if (linkunlink) {
       dout(10) << "predirty_nested updating size on " << *parent << dendl;
@@ -1405,6 +1412,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob,
     dout(15) << "predirty_nested take_diff " << pf->fragstat << dendl;
     dout(15) << "predirty_nested         - " << pf->accounted_fragstat << dendl;
     pi->dirstat.take_diff(pf->fragstat, pf->accounted_fragstat);
+    pi->mtime = pi->ctime = pi->dirstat.mtime;
     dout(15) << "predirty_nested     gives " << pi->dirstat << " on " << *pin << dendl;
 
     // next parent!
index 3bec4929f996c51430d36e63b7c1b2766d929bf1..b4d1a5b9f8c7f76de85352fe519aab810e7904b5 100644 (file)
@@ -2228,7 +2228,7 @@ void Server::_link_local(MDRequest *mdr, CDentry *dn, CInode *targeti)
   // log + wait
   EUpdate *le = new EUpdate(mdlog, "link_local");
   le->metablob.add_client_req(mdr->reqid);
-  mds->locker->predirty_nested(mdr, &le->metablob, targeti, dn->dir, PREDIRTY_DIR, 1); // new dn
+  mds->locker->predirty_nested(mdr, &le->metablob, targeti, dn->dir, PREDIRTY_DIR, 1);      // new dn
   mds->locker->predirty_nested(mdr, &le->metablob, targeti, 0, PREDIRTY_PRIMARY);           // targeti
   le->metablob.add_remote_dentry(dn, true, targeti->ino(), 
                                 MODE_TO_DT(targeti->inode.mode));  // new remote