From 9fee8de25ab5c155cd6a3d32a71e45630a5ded15 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 (cherry picked from commit 0ea20a668cf859881c49b33d1b6db4e636eda18a) --- 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 74305b9cbf639..3aea3ad84a958 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2769,11 +2769,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; @@ -2783,11 +2790,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.39.5