Re: [ceph-users] cephfs snap mkdir strange timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ CC'ing Jeff and ceph-devel@ ]

On Tue, Mar 10, 2020 at 11:41:19AM +0100, Marc Roos wrote:
>  
> 
> If I make a directory in linux the directory has the date of now, why is 
> this not with creating a snap dir? Is this not a bug? One expects this 
> to be the same as in linux not????

I've noticed that long time ago, but I never checked the fuse client
behaviour, which turns out to be different.  The fuse client seems to set
ctime and atime to the same value as the parent directory (see
Client::open_snapdir()).

The patch below mimics that behaviour, by simply copying those timestamps
from the parent inode.

Cheers,
--
Luis

>From 2c8e06e66e5453ddf8b634cf1689a812dc05a0c6 Mon Sep 17 00:00:00 2001
From: Luis Henriques <lhenriques@xxxxxxxx>
Date: Tue, 10 Mar 2020 13:35:11 +0000
Subject: [PATCH] ceph: fix snapshot dir ctime and mtime

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 to those of the parent
directory.

Signed-off-by: Luis Henriques <lhenriques@xxxxxxxx>
---
 fs/ceph/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index d01710a16a4a..f4e78ade0871 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -82,6 +82,8 @@ 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_op = &ceph_snapdir_iops;
 	inode->i_fop = &ceph_snapdir_fops;
 	ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux