Skip to content

Commit

Permalink
cephfs: mtime should not update rctime
Browse files Browse the repository at this point in the history
mtime is a user modifiable field and someone can alter it to reflect a modification time in the future or past.
rctime should be depended only on ctime which itself is system depended (based on how POSIX works).
By setting an mtime in the future, we render the usage of rctime redundant until the future timestamp is met.

Signed-off-by: Theofilos Mouratidis <t.mour@cern.ch>
  • Loading branch information
thmour committed Nov 3, 2020
1 parent 799f65e commit 687f8b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 3 additions & 7 deletions src/mds/Locker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2849,11 +2849,9 @@ bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
pi.inode->rstat.rbytes = new_size;
dout(10) << "check_inode_max_size mtime " << pi.inode->mtime << " -> " << new_mtime << dendl;
pi.inode->mtime = new_mtime;
if (new_mtime > pi.inode->ctime) {
pi.inode->ctime = new_mtime;
if (new_mtime > pi.inode->rstat.rctime)
pi.inode->rstat.rctime = new_mtime;
}
pi.inode->ctime = ceph_clock_now();
if (pi.inode->ctime > pi.inode->rstat.rctime)
pi.inode->rstat.rctime = pi.inode->ctime;
}

// use EOpen if the file is still open; otherwise, use EUpdate.
Expand Down Expand Up @@ -3684,8 +3682,6 @@ void Locker::_update_cap_fields(CInode *in, int dirty, const cref_t<MClientCaps>
dout(7) << " mtime " << pi->mtime << " -> " << mtime
<< " for " << *in << dendl;
pi->mtime = mtime;
if (mtime > pi->rstat.rctime)
pi->rstat.rctime = mtime;
}
if (in->is_file() && // ONLY if regular file
size > pi->size) {
Expand Down
6 changes: 0 additions & 6 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2220,12 +2220,6 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
pf->fragstat.mtime = mut->get_op_stamp();
pf->fragstat.change_attr++;
dout(10) << "predirty_journal_parents bumping change_attr to " << pf->fragstat.change_attr << " on " << parent << dendl;
if (pf->fragstat.mtime > pf->rstat.rctime) {
dout(10) << "predirty_journal_parents updating mtime on " << *parent << dendl;
pf->rstat.rctime = pf->fragstat.mtime;
} else {
dout(10) << "predirty_journal_parents updating mtime UNDERWATER on " << *parent << dendl;
}
}
if (linkunlink) {
dout(10) << "predirty_journal_parents updating size on " << *parent << dendl;
Expand Down

0 comments on commit 687f8b2

Please sign in to comment.