]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
src/mds: increment directory inode's change attr by one
authorRamana Raja <rraja@redhat.com>
Thu, 22 Sep 2022 15:41:50 +0000 (11:41 -0400)
committerRamana Raja <rraja@redhat.com>
Fri, 14 Oct 2022 23:25:40 +0000 (19:25 -0400)
commit05fdd6c800875c537966540933c8b13e08a2cb17
tree65b8dc5f5b38cc20d7d611f37a01933265a5812e
parentd597100ed5a54378d1c4a4dff39805cfd321928c
src/mds: increment directory inode's change attr by one

... whenever the mtime or ctime of the directory inode is modified.

In CephFS subvolume clones exported using NFS-Ganesha, newly created
files using `touch` were not being listed. It was identified that the
create request sent to the Ceph MDS via NFS-Ganesha's libcephfs client
modified the mtime and ctime of the parent directory, but did not modify
the change_attr of the parent directory. Since the NFS client
didn't see a modification of the change attribute in the reply, it
didn't invalidate its readdir cache. The subsequent directory `ls` was
satisfied from the NFS client's stale readdir cache.

Whenever parent directory inode's  mtime was modified in
MDCache::predirty_journal_parents(), the parent inode's change_attr
was set to its dirstat->change_attr. The parent inode's
dirstat->change_attr doesn't track changes to parent's *ctime only*
changes such as setattr, setvxattr, etc. on the parent
directory. See commit 0d441dcd6af553d11d6be6df56d577c5659904a0 for more
details. This caused the directory inode's change_attr to not be updated
when an operation to change only its ctime was followed by an operation
to change its mtime and ctime.

Fix this by making changes to MDCache::predirty_journal_parents() and
CInode::finish_scatter_gather_update() to increment the directory
inode's change_attr by one instead of setting it to its
dirstat->change_attr.

Fixes: https://tracker.ceph.com/issues/57210
Signed-off-by: Ramana Raja <rraja@redhat.com>
src/mds/CInode.cc
src/mds/MDCache.cc