[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAM7YA=rdDSd_YFbDu1-mKoU8_hkBdPQ+jMc3jsUtfxo-Jm3GQ@mail.gmail.com>
Date: Fri, 2 Jun 2017 08:35:51 +0800
From: "Yan, Zheng" <ukernel@...il.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Deepa Dinamani <deepa.kernel@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Al Viro <viro@...iv.linux.org.uk>,
gregkh <gregkh@...uxfoundation.org>,
"Dilger, Andreas" <andreas.dilger@...el.com>,
"J. Bruce Fields" <bfields@...ldses.org>, Chris Mason <clm@...com>,
David Miller <davem@...emloft.net>,
David Sterba <dsterba@...e.com>,
Evgeniy Dushistov <dushistov@...l.ru>,
Eric Paris <eparis@...hat.com>,
Jaegeuk Kim <jaegeuk@...nel.org>, Josef Bacik <jbacik@...com>,
Jeff Layton <jlayton@...chiereds.net>,
John Stultz <john.stultz@...aro.org>,
James Simmons <jsimmons@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
"Drokin, Oleg" <oleg.drokin@...el.com>,
Paul Moore <paul@...l-moore.com>,
Steven Rostedt <rostedt@...dmis.org>, yuchao0@...wei.com,
ceph-devel <ceph-devel@...r.kernel.org>,
devel@...verdev.osuosl.org, linux-audit@...hat.com,
linux-btrfs <linux-btrfs@...r.kernel.org>,
linux-cifs@...r.kernel.org,
"Linux F2FS DEV, Mailing List"
<linux-f2fs-devel@...ts.sourceforge.net>,
Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
linux-mtd <linux-mtd@...ts.infradead.org>,
LSM List <linux-security-module@...r.kernel.org>,
Lustre Development List <lustre-devel@...ts.lustre.org>,
Networking <netdev@...r.kernel.org>,
samba-technical@...ts.samba.org,
y2038 Mailman List <y2038@...ts.linaro.org>
Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts()
On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann <arnd@...db.de> wrote:
> On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng <ukernel@...il.com> wrote:
>> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani <deepa.kernel@...il.com> wrote:
>
>>> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
>>> index 517838b..77204da 100644
>>> --- a/drivers/block/rbd.c
>>> +++ b/drivers/block/rbd.c
>>> @@ -1922,7 +1922,7 @@ static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request)
>>> {
>>> struct ceph_osd_request *osd_req = obj_request->osd_req;
>>>
>>> - osd_req->r_mtime = CURRENT_TIME;
>>> + ktime_get_real_ts(&osd_req->r_mtime);
>>> osd_req->r_data_offset = obj_request->offset;
>>> }
>>>
>>> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
>>> index c681762..1d3fa90 100644
>>> --- a/fs/ceph/mds_client.c
>>> +++ b/fs/ceph/mds_client.c
>>> @@ -1666,6 +1666,7 @@ struct ceph_mds_request *
>>> ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
>>> {
>>> struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS);
>>> + struct timespec ts;
>>>
>>> if (!req)
>>> return ERR_PTR(-ENOMEM);
>>> @@ -1684,7 +1685,8 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
>>> init_completion(&req->r_safe_completion);
>>> INIT_LIST_HEAD(&req->r_unsafe_item);
>>>
>>> - req->r_stamp = current_fs_time(mdsc->fsc->sb);
>>> + ktime_get_real_ts(&ts);
>>> + req->r_stamp = timespec_trunc(ts, mdsc->fsc->sb->s_time_gran);
>>
>> This change causes our kernel_untar_tar test case to fail (inode's
>> ctime goes back). The reason is that there is time drift between the
>> time stamps got by ktime_get_real_ts() and current_time(). We need to
>> revert this change until current_time() uses ktime_get_real_ts()
>> internally.
>
> Hmm, the change was not supposed to have a user-visible effect, so
> something has gone wrong, but I don't immediately see how it
> relates to what you observe.
>
> ktime_get_real_ts() and current_time() use the same time base, there
> is no drift, but there is a difference in resolution, as the latter uses
> the time stamp of the last jiffies update, which may be up to one jiffy
> (10ms) behind the exact time we put in the request stamps here.
>
It happens in following sequence of events
1. create a new file, the inode's ctime is set to ktime_get_real_ts()
2. chmod the new file, the inode's ctime is set to current_time().
Inode's ctime goes back when current_time() is behind ktime_get_real_ts().
Regards
Yan, Zheng
> Do you still see problems if you use current_kernel_time() instead of
> ktime_get_real_ts()?
>
> Arnd
Powered by blists - more mailing lists