summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2020-03-11 11:05:38 +0000
committerIlya Dryomov <idryomov@gmail.com>2020-03-30 12:42:43 +0200
commitef9157259fb7bb3bc2c61df227e36f1b861a4753 (patch)
treedc447f48fd161d3a35069631817f5ede6f0d3247
parent9bccb76574ad9ba6f5868b09053179fa2e72f8e0 (diff)
downloadlinux-ef9157259fb7bb3bc2c61df227e36f1b861a4753.tar.gz
linux-ef9157259fb7bb3bc2c61df227e36f1b861a4753.tar.bz2
linux-ef9157259fb7bb3bc2c61df227e36f1b861a4753.zip
ceph: fix snapshot directory timestamps
The .snap directory timestamps are kept at 0 (1970-01-01 00:00), which isn't consistent with what the fuse client does. This patch makes the behaviour consistent, by setting these timestamps (atime, btime, ctime, mtime) to those of the parent directory. Cc: Marc Roos <M.Roos@f1-outsourcing.eu> Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index ee40ba7e0e77..7fef94fd1e55 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -82,10 +82,14 @@ struct inode *ceph_get_snapdir(struct inode *parent)
inode->i_mode = parent->i_mode;
inode->i_uid = parent->i_uid;
inode->i_gid = parent->i_gid;
+ inode->i_mtime = parent->i_mtime;
+ inode->i_ctime = parent->i_ctime;
+ inode->i_atime = parent->i_atime;
inode->i_op = &ceph_snapdir_iops;
inode->i_fop = &ceph_snapdir_fops;
ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */
ci->i_rbytes = 0;
+ ci->i_btime = ceph_inode(parent)->i_btime;
if (inode->i_state & I_NEW)
unlock_new_inode(inode);