]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
SQUASH: Revert "mds: ensure that change_attr reflects metadata changes on clients...
authorJeff Layton <jlayton@redhat.com>
Thu, 1 Sep 2016 15:16:05 +0000 (11:16 -0400)
committerJeff Layton <jlayton@redhat.com>
Thu, 1 Sep 2016 18:36:15 +0000 (14:36 -0400)
This reverts commit 26ab2fa10041ce34b25aa1535715131a2709a27f.

I don't think this is necessary. We don't necessarily need to increment
the change attribute on every change, as long as we ensure that it gets
bumped iff there were changes since the last time you queried for it.

IOW: it's ok to have a single change_attr change encompass a large set
of changes, as long as you ensure that that it is larger by at least 1
after all of those changes.

In order to look at (and potentially cache) other attributes under that
change_attribute (e.g. owner or mode), you need to recall any outstanding
exclusive caps for those attrs. That causes their change_attrs to be
synched to the largest, which is enough to ensure that it changed in
some way.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/mds/Locker.cc

index 6a262f34e979a1ee9141ef303033d41583790d4d..b65dd9f286dc46ba1a6fcf67401325ad3f6e6789 100644 (file)
@@ -2978,6 +2978,12 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *
     pi->ctime = m->get_ctime();
   }
 
+  if (dirty && m->get_change_attr() > pi->change_attr) {
+    dout(7) << "  change_attr " << pi->change_attr << " -> " << m->get_change_attr()
+           << " for " << *in << dendl;
+    pi->change_attr = m->get_change_attr();
+  }
+
   // file
   if (dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR)) {
     utime_t atime = m->get_atime();
@@ -3047,24 +3053,6 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *
     }
   }
 
-  /*
-   * Different clients can hold different exclusive caps on the same inode,
-   * but the change_attr field is under the aegis of the FILE cap. If the
-   * client isn't returning the FILE_EXCL cap, and the change_attr in the
-   * MClientCaps is not newer than the one in the inode, then we must bump it
-   * an extra time to ensure that any client that _does_ hold FILE_EXCL sees
-   * a new change_attr.
-   */
-  if (dirty) {
-    if (m->get_change_attr() > pi->change_attr) {
-      dout(7) << "  change_attr " << pi->change_attr << " -> " << m->get_change_attr()
-             << " for " << *in << dendl;
-      pi->change_attr = m->get_change_attr();
-    } else if (!(dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR))) {
-      pi->change_attr++;
-    }
-  }
-
 }
 
 /*