From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f68.google.com ([209.85.218.68]:33122 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbdFBKvS (ORCPT ); Fri, 2 Jun 2017 06:51:18 -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: Arnd Bergmann Date: Fri, 2 Jun 2017 12:51:16 +0200 Message-ID: Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() To: "Yan, Zheng" Cc: Deepa Dinamani , John Stultz , 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 , 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 Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() Date: Fri, 2 Jun 2017 12:51:16 +0200 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-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, "J. Bruce Fields" , Chris Mason , linux-mtd , Deepa Dinamani , Evgeniy Dushistov , Jeff Layton , ceph-devel , devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Paul Moore , y2038 Mailman List , Ingo Molnar , Steven Rostedt , "Drokin, Oleg" , John Stultz , Al Viro , David Sterba , Jaegeuk Kim , Thomas Gleixner , Josef Bacik , gregkh , samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org, Linux Kernel Mailing List , Eric Par To: "Yan, Zheng" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lustre-devel-bounces-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org Sender: "lustre-devel" List-Id: linux-cifs.vger.kernel.org On Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? 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 S1751230AbdFBKvW (ORCPT ); Fri, 2 Jun 2017 06:51:22 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33122 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbdFBKvS (ORCPT ); Fri, 2 Jun 2017 06:51:18 -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: Arnd Bergmann Date: Fri, 2 Jun 2017 12:51:16 +0200 X-Google-Sender-Auth: Cp-8lGgnqi2No4gMYCyljxXtASE Message-ID: Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() To: "Yan, Zheng" Cc: Deepa Dinamani , John Stultz , 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 , 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 Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Fri, 2 Jun 2017 12:51:16 +0200 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 Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? 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: Arnd Bergmann Subject: Re: [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() Date: Fri, 2 Jun 2017 12:51:16 +0200 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: lustre-devel-bounces-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org Sender: "lustre-devel" To: "Yan, Zheng" Cc: yuchao0-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, "J. Bruce Fields" , Chris Mason , linux-mtd , Deepa Dinamani , Evgeniy Dushistov , Jeff Layton , ceph-devel , devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Paul Moore , y2038 Mailman List , Ingo Molnar , Steven Rostedt , "Drokin, Oleg" , John Stultz , Al Viro , David Sterba , Jaegeuk Kim , Thomas Gleixner , Josef Bacik , gregkh , samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org, Linux Kernel Mailing List , Eric List-Id: ceph-devel.vger.kernel.org On Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Date: Fri, 2 Jun 2017 12:51:16 +0200 Subject: [lustre-devel] [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: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Yan, Zheng" Cc: yuchao0-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, "J. Bruce Fields" , Chris Mason , linux-mtd , Deepa Dinamani , Evgeniy Dushistov , Jeff Layton , ceph-devel , devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Paul Moore , y2038 Mailman List , Ingo Molnar , Steven Rostedt , "Drokin, Oleg" , John Stultz , Al Viro , David Sterba , Jaegeuk Kim , Thomas Gleixner , Josef Bacik , gregkh , samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org, Linux Kernel Mailing List , Eric On Fri, Jun 2, 2017 at 12:10 PM, Yan, Zheng wrote: > On Fri, Jun 2, 2017 at 5:45 PM, Arnd Bergmann wrote: >> On Fri, Jun 2, 2017 at 4:09 AM, Yan, Zheng wrote: >>> On Fri, Jun 2, 2017 at 8:57 AM, Deepa Dinamani wrote: >>>> On Thu, Jun 1, 2017 at 5:36 PM, John Stultz wrote: >>>>> On Thu, Jun 1, 2017 at 5:26 PM, Yan, Zheng wrote: >> >> I believe the bug you see is the result of the two timestamps >> currently being almost guaranteed to be different in the latest >> kernels. >> Changing r_stamp to use current_kernel_time() will make it the >> same value most of the time (as it was before Deepa's patch), >> but when the timer interrupt happens between the timestamps, >> the two are still different, it's just much harder to hit. >> >> I think the proper solution should be to change __ceph_setattr() >> in a way that has req->r_stamp always synchronized with i_ctime. >> If we copy i_ctime to r_stamp, that will also take care of the >> future issues with the planned changes to current_time(). >> > I already have a patch > https://github.com/ceph/ceph-client/commit/24f54cd18e195a002ee3d2ab50dbc952fd9f82af Looks good to me. In case anyone cares: Acked-by: Arnd Bergmann >> The part I don't understand is what else r_stamp (i.e. the time >> stamp in ceph_msg_data with type== >> CEPH_MSG_CLIENT_REQUEST) is used for, other than setting >> ctime in CEPH_MDS_OP_SETATTR. >> >> Will this be used to update the stored i_ctime for other operations >> too? If so, we would need to synchronize it with the in-memory >> i_ctime for all operations that do this. >> > > yes, mds uses it to update ctime of modified inodes. For example, > when handling mkdir, mds set ctime of both parent inode and new inode > to r_stamp. I see, so we may have a variation of that problem there as well: From my reading of the code, the child inode is not in memory yet, so that seems fine, but I could not find where the parent in-memory inode i_ctime is updated in ceph, but it is most likely not the same as req->r_stamp (assuming it gets updated at all). Would it make sense require all callers of ceph_mdsc_do_request() to update r_stamp at the same time as i_ctime to keep them in sync? Arnd