From 0ea20a668cf859881c49b33d1b6db4e636eda18a Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 29 Sep 2014 16:10:36 -0700 Subject: [PATCH] Locker: accept ctime updates from clients without dirty write caps The ctime changes any time the inode does. That can happen even without the file itself having changed, so we'd better accept the update whenever the auth caps have dirtied, without worrying about the file caps! Fixes: #9514 Backport: firefly Signed-off-by: Greg Farnum Reviewed-by: Sage Weil Reviewed-by: John Spray --- src/mds/Locker.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index c76582255c89..ba92196583a6 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2865,11 +2865,18 @@ void Locker::_do_snap_update(CInode *in, snapid_t snap, int dirty, snapid_t foll void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *pi) { + + utime_t ctime = m->get_ctime(); + if (dirty && ctime > pi->ctime) { + dout(7) << " ctime " << pi->ctime << " -> " << ctime + << " for " << *in << dendl; + pi->ctime = ctime; + } + // file if (dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR)) { utime_t atime = m->get_atime(); utime_t mtime = m->get_mtime(); - utime_t ctime = m->get_ctime(); uint64_t size = m->get_size(); version_t inline_version = m->inline_version; @@ -2879,11 +2886,6 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t * << " for " << *in << dendl; pi->mtime = mtime; } - if (ctime > pi->ctime) { - dout(7) << " ctime " << pi->ctime << " -> " << ctime - << " for " << *in << dendl; - pi->ctime = ctime; - } if (in->inode.is_file() && // ONLY if regular file size > pi->size) { dout(7) << " size " << pi->size << " -> " << size -- 2.47.3