From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f196.google.com ([209.85.217.196]:32913 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdFBA03 (ORCPT ); Thu, 1 Jun 2017 20:26:29 -0400 MIME-Version: 1.0 In-Reply-To: References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> <1491613030-11599-5-git-send-email-deepa.kernel@gmail.com> From: "Yan, Zheng" Date: Fri, 2 Jun 2017 08:26:27 +0800 Message-ID: Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() To: Arnd Bergmann Cc: Deepa Dinamani , Linux Kernel Mailing List , Andrew Morton , Thomas Gleixner , Al Viro , gregkh , "Dilger, Andreas" , "J. Bruce Fields" , Chris Mason , David Miller , David Sterba , Evgeniy Dushistov , Eric Paris , Jaegeuk Kim , Josef Bacik , Jeff Layton , John Stultz , James Simmons , Ingo Molnar , "Drokin, Oleg" , Paul Moore , Steven Rostedt , yuchao0@huawei.com, ceph-devel , devel@driverdev.osuosl.org, linux-audit@redhat.com, linux-btrfs , linux-cifs@vger.kernel.org, "Linux F2FS DEV, Mailing List" , Linux FS-devel Mailing List , linux-mtd , LSM List , Lustre Development List , Networking , samba-technical@lists.samba.org, y2038 Mailman List Content-Type: text/plain; charset="UTF-8" Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann wrote: > On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng wrote: >> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani 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. > > Do you still see problems if you use current_kernel_time() instead of > ktime_get_real_ts()? The problem disappears after using current_kernel_time(). https://github.com/ceph/ceph-client/commit/2e0f648da23167034a3cf1500bc90ec60aef2417 Regards Yan, Zheng > > Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yan, Zheng" Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() Date: Fri, 2 Jun 2017 08:26:27 +0800 Message-ID: References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> <1491613030-11599-5-git-send-email-deepa.kernel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: yuchao0@huawei.com, "J. Bruce Fields" , Chris Mason , linux-mtd , Deepa Dinamani , Evgeniy Dushistov , Jeff Layton , ceph-devel , devel@driverdev.osuosl.org, linux-cifs@vger.kernel.org, Paul Moore , y2038 Mailman List , Ingo Molnar , Steven Rostedt , "Drokin, Oleg" , John Stultz , Al Viro , David Sterba , Jaegeuk Kim , Thomas Gleixner , "Dilger, Andreas" , Josef Bacik , gregkh , samba-technical@lists.samba.org, Linux Kernel Mailing List To: Arnd Bergmann Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: linux-cifs.vger.kernel.org On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann wrote: > On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng wrote: >> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani 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. > > Do you still see problems if you use current_kernel_time() instead of > ktime_get_real_ts()? The problem disappears after using current_kernel_time(). https://github.com/ceph/ceph-client/commit/2e0f648da23167034a3cf1500bc90ec60aef2417 Regards Yan, Zheng > > Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbdFBA0d (ORCPT ); Thu, 1 Jun 2017 20:26:33 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:32913 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdFBA03 (ORCPT ); Thu, 1 Jun 2017 20:26:29 -0400 MIME-Version: 1.0 In-Reply-To: References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> <1491613030-11599-5-git-send-email-deepa.kernel@gmail.com> From: "Yan, Zheng" Date: Fri, 2 Jun 2017 08:26:27 +0800 Message-ID: Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() To: Arnd Bergmann Cc: Deepa Dinamani , Linux Kernel Mailing List , Andrew Morton , Thomas Gleixner , Al Viro , gregkh , "Dilger, Andreas" , "J. Bruce Fields" , Chris Mason , David Miller , David Sterba , Evgeniy Dushistov , Eric Paris , Jaegeuk Kim , Josef Bacik , Jeff Layton , John Stultz , James Simmons , Ingo Molnar , "Drokin, Oleg" , Paul Moore , Steven Rostedt , yuchao0@huawei.com, ceph-devel , devel@driverdev.osuosl.org, linux-audit@redhat.com, linux-btrfs , linux-cifs@vger.kernel.org, "Linux F2FS DEV, Mailing List" , Linux FS-devel Mailing List , linux-mtd , LSM List , Lustre Development List , Networking , samba-technical@lists.samba.org, y2038 Mailman List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann wrote: > On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng wrote: >> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani 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. > > Do you still see problems if you use current_kernel_time() instead of > ktime_get_real_ts()? The problem disappears after using current_kernel_time(). https://github.com/ceph/ceph-client/commit/2e0f648da23167034a3cf1500bc90ec60aef2417 Regards Yan, Zheng > > Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: ukernel@gmail.com (Yan, Zheng) Date: Fri, 2 Jun 2017 08:26:27 +0800 Subject: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() In-Reply-To: References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> <1491613030-11599-5-git-send-email-deepa.kernel@gmail.com> Message-ID: To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann wrote: > On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng wrote: >> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani 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. > > Do you still see problems if you use current_kernel_time() instead of > ktime_get_real_ts()? The problem disappears after using current_kernel_time(). https://github.com/ceph/ceph-client/commit/2e0f648da23167034a3cf1500bc90ec60aef2417 Regards Yan, Zheng > > Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yan, Zheng" Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() Date: Fri, 2 Jun 2017 08:26:27 +0800 Message-ID: References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> <1491613030-11599-5-git-send-email-deepa.kernel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: Arnd Bergmann Cc: yuchao0@huawei.com, "J. Bruce Fields" , Chris Mason , linux-mtd , Deepa Dinamani , Evgeniy Dushistov , Jeff Layton , ceph-devel , devel@driverdev.osuosl.org, linux-cifs@vger.kernel.org, Paul Moore , y2038 Mailman List , Ingo Molnar , Steven Rostedt , "Drokin, Oleg" , John Stultz , Al Viro , David Sterba , Jaegeuk Kim , Thomas Gleixner , "Dilger, Andreas" , Josef Bacik , gregkh , samba-technical@lists.samba.org, Linux List-Id: ceph-devel.vger.kernel.org On Thu, Jun 1, 2017 at 6:22 PM, Arnd Bergmann wrote: > On Thu, Jun 1, 2017 at 11:56 AM, Yan, Zheng wrote: >> On Sat, Apr 8, 2017 at 8:57 AM, Deepa Dinamani 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. > > Do you still see problems if you use current_kernel_time() instead of > ktime_get_real_ts()? The problem disappears after using current_kernel_time(). https://github.com/ceph/ceph-client/commit/2e0f648da23167034a3cf1500bc90ec60aef2417 Regards Yan, Zheng > > Arnd