From a9d6478a905dcab3c782325f1663c65ff8e79da3 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 1 Sep 2016 11:16:05 -0400 Subject: [PATCH] SQUASH: Revert "mds: ensure that change_attr reflects metadata changes on clients that hold CAP_FILE_EXCL" 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 --- src/mds/Locker.cc | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 6a262f34e97..b65dd9f286d 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -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++; - } - } - } /* -- 2.39.5