From patchwork Mon Jun 12 10:45:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5B48C7EE25 for ; Mon, 12 Jun 2023 10:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237145AbjFLK5y (ORCPT ); Mon, 12 Jun 2023 06:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236952AbjFLK5e (ORCPT ); Mon, 12 Jun 2023 06:57:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D8E59D2; Mon, 12 Jun 2023 03:45:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70BA062418; Mon, 12 Jun 2023 10:45:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0036FC4339B; Mon, 12 Jun 2023 10:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566731; bh=U7K8PnSDrmyymIFt6bT08pkz1Ns5zBOLh78eoHWTYGs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i06u1gEYX2bd4j+uPzysbIxDaAwT6/CTUZOpnTs1UyXa7/5s7cUOEwUqZ3dlGz3O4 jFNXbxogq3HUsHaG8qzS2pUjFsLZ0pwm34sHEhWINSBx3x3GHErV87Ysw0Qytwbwe8 fFUrKe3sgWnKHIxnfLIjIUsPaN3Sh8LJvyjX55+rRGLxXbSB1eObzfgCW6lRFnH3r+ h9bCABGuEIoV6ij5WT16QU8p0vaVIMpWRciWV/eJdOCZn29lSLhV+99EbZsWG/Pglk 4MesuWDQf7yKM7JEJ5xr1+7Gp2JHA67EJFTynNQZaj0+fP9ZhYPuRC0fRqK+SN0Ale ksZ9p+qMIL1gg== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 1/8] ibmvmc: update ctime in conjunction with mtime on write Date: Mon, 12 Jun 2023 06:45:17 -0400 Message-Id: <20230612104524.17058-2-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org POSIX says: "Upon successful completion, where nbyte is greater than 0, write() shall mark for update the last data modification and last file status change timestamps of the file..." Signed-off-by: Jeff Layton --- drivers/misc/ibmvmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c index cbaf6d35e854..d7c7f0305257 100644 --- a/drivers/misc/ibmvmc.c +++ b/drivers/misc/ibmvmc.c @@ -1124,7 +1124,7 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer, goto out; inode = file_inode(file); - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); mark_inode_dirty(inode); dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n", From patchwork Mon Jun 12 10:45:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67EFEC7EE45 for ; Mon, 12 Jun 2023 10:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237279AbjFLK6F (ORCPT ); Mon, 12 Jun 2023 06:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236960AbjFLK5g (ORCPT ); Mon, 12 Jun 2023 06:57:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26DB8E572; Mon, 12 Jun 2023 03:45:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A2DD162450; Mon, 12 Jun 2023 10:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AB4FC433D2; Mon, 12 Jun 2023 10:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566735; bh=f+sv9c83YeZdEFyBLfaVXVS9uGARTf71K6hxZfrcSr4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XNPqT5xCR/WjIlqL84s4wlNFJCgGYAqKwg9zWLKMlluT43pgIvq6UYpc7QjKUhuWL nVIrZgjKf9Le2yKWvchiJV4LBbC0ljP1qKKTZdnKa3LICWwFNHz7sMCYSAO1yPGWJc ixIaxMQwn51TByDyIFIJ4whm3OajAgo0a8S2bf51eFvXRyczHtk84FQpWxkDHAGszp 9PgkQIWwHJTlHW8C02GLU7kZQHk3jA/g7J+XX7rjLsmWIk6SAhbZ3n7MsZXHbQi8fq 1BN620+hBAnd5L8CGYKibFXxe0Hxle4OVCsDLjX9mMgrdf+RzkMkt3m7jsKCrQeUGe l++bREhCo36qQ== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 2/8] usb: update the ctime as well when updating mtime after an ioctl Date: Mon, 12 Jun 2023 06:45:18 -0400 Message-Id: <20230612104524.17058-3-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org In general, POSIX requires that when the mtime is updated that the ctime be updated as well. Add the missing timestamp updates to the usb ioctls. Signed-off-by: Jeff Layton --- drivers/usb/core/devio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index fcf68818e999..1268d313a8df 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -2640,21 +2640,21 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, snoop(&dev->dev, "%s: CONTROL\n", __func__); ret = proc_control(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_BULK: snoop(&dev->dev, "%s: BULK\n", __func__); ret = proc_bulk(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_RESETEP: snoop(&dev->dev, "%s: RESETEP\n", __func__); ret = proc_resetep(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_RESET: @@ -2666,7 +2666,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__); ret = proc_clearhalt(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_GETDRIVER: @@ -2693,7 +2693,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, snoop(&dev->dev, "%s: SUBMITURB\n", __func__); ret = proc_submiturb(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; #ifdef CONFIG_COMPAT @@ -2701,14 +2701,14 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, snoop(&dev->dev, "%s: CONTROL32\n", __func__); ret = proc_control_compat(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_BULK32: snoop(&dev->dev, "%s: BULK32\n", __func__); ret = proc_bulk_compat(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_DISCSIGNAL32: @@ -2720,7 +2720,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, snoop(&dev->dev, "%s: SUBMITURB32\n", __func__); ret = proc_submiturb_compat(ps, p); if (ret >= 0) - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); break; case USBDEVFS_IOCTL32: From patchwork Mon Jun 12 10:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65CE1C87FDD for ; Mon, 12 Jun 2023 10:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237246AbjFLK6A (ORCPT ); Mon, 12 Jun 2023 06:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237094AbjFLK5h (ORCPT ); Mon, 12 Jun 2023 06:57:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40316E576; Mon, 12 Jun 2023 03:45:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C90E9615CB; Mon, 12 Jun 2023 10:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53A4BC433A8; Mon, 12 Jun 2023 10:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566738; bh=8dWgF0uA6APXTiliajrD56DAKjnBaeRdxdQyPjiYPP0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VNA1yc1YyUY8iRFte4FmbUVtUf3xLJi9hXnJ6eWRWnAhBF+pd7YKghWhRecMCbgZ7 yr57R+PZlxmUOpKdY6vogdgf5Gr4klr4agBTonta+PtTNZoD86j0g27zvORW3eK9OK ckKAln6kq/vdGBqDPxe0AphUUeibkpmZMvXEy35ssAkNPNlLtCWCucxt0cbrWCXW9/ a+Glo0O8+HA/jny1S2QTYqeGAXtduUlAp2ea5Gda6IIdGCnuOB1R0PcM6OVZvKiBvR LUcA7rvDLDnW/kSTwRPVhk1jLDA13CgKbUj/bA6NF07G9p+lglD/zt4af6w3SGbIYA guYVuHpahZfuw== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 3/8] autofs: set ctime as well when mtime changes on a dir Date: Mon, 12 Jun 2023 06:45:19 -0400 Message-Id: <20230612104524.17058-4-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org When adding entries to a directory, POSIX generally requires that the ctime also be updated alongside the mtime. Signed-off-by: Jeff Layton Acked-by: Ian Kent --- fs/autofs/root.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 6baf90b08e0e..93046c9dc461 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -600,7 +600,7 @@ static int autofs_dir_symlink(struct mnt_idmap *idmap, p_ino = autofs_dentry_ino(dentry->d_parent); p_ino->count++; - dir->i_mtime = current_time(dir); + dir->i_mtime = dir->i_ctime = current_time(dir); return 0; } @@ -633,7 +633,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry) d_inode(dentry)->i_size = 0; clear_nlink(d_inode(dentry)); - dir->i_mtime = current_time(dir); + dir->i_mtime = dir->i_ctime = current_time(dir); spin_lock(&sbi->lookup_lock); __autofs_add_expiring(dentry); @@ -749,7 +749,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap, p_ino = autofs_dentry_ino(dentry->d_parent); p_ino->count++; inc_nlink(dir); - dir->i_mtime = current_time(dir); + dir->i_mtime = dir->i_ctime = current_time(dir); return 0; } From patchwork Mon Jun 12 10:45:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B00B9C7EE2E for ; Mon, 12 Jun 2023 10:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237229AbjFLK57 (ORCPT ); Mon, 12 Jun 2023 06:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236875AbjFLK5i (ORCPT ); Mon, 12 Jun 2023 06:57:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F63E579; Mon, 12 Jun 2023 03:45:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F239862450; Mon, 12 Jun 2023 10:45:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C4EAC433EF; Mon, 12 Jun 2023 10:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566741; bh=aJO98WciVZrVlZcCKv5j2euy0SAQyZ/0j96e4FBSwR4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oZstYoY1+IwPBj84Mr1zP4YDtRIv3werVGAJ2+b6CsAytp4SAJPSGU+zc4JlpYmBP i0I0UZNtMxsP37aH5z4pL54IcZZ1yygHjAAFPKpFU9x2lRdApQdrTuBFVjz/WeesZ7 C3h04CZRRWYbEH7sB4n6OEWq6BaO6VbnwTsQzY8j062H/Fz0/sgsOt4zwb1ayIP6fZ 7cG77M+iHxmvYKtuE/PcT/tB175OdEWjDJjk/JilIiutctTDWoidSZHK1hO15R4iQz 14MIjGOy5mac9sUGgBUCVdt16OnQDBpiwG4wJs6H+LwyCTwvuMy4yWgpjzdVRTkyEd 39wCWXoZtMX3Q== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 4/8] bfs: update ctime in addition to mtime when adding entries Date: Mon, 12 Jun 2023 06:45:20 -0400 Message-Id: <20230612104524.17058-5-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org When adding entries to a directory, POSIX generally requires that the ctime be updated alongside the mtime. Signed-off-by: Jeff Layton --- fs/bfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 040d5140e426..d2e8a2a56b05 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -294,7 +294,7 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino) dir->i_size += BFS_DIRENT_SIZE; dir->i_ctime = current_time(dir); } - dir->i_mtime = current_time(dir); + dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); de->ino = cpu_to_le16((u16)ino); for (i = 0; i < BFS_NAMELEN; i++) From patchwork Mon Jun 12 10:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA5CC8300C for ; Mon, 12 Jun 2023 10:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237260AbjFLK6D (ORCPT ); Mon, 12 Jun 2023 06:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236903AbjFLK5j (ORCPT ); Mon, 12 Jun 2023 06:57:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA3EE57D; Mon, 12 Jun 2023 03:45:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23BE962418; Mon, 12 Jun 2023 10:45:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5433C433D2; Mon, 12 Jun 2023 10:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566744; bh=9ZN85s2F3/oEy5pkv6yI4Tv5XU9EfGqK4A7t1kaGRdY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Sv98hIAW85F4HBftzDcqOyvM/R3EukSSckezqktp1nVmTUG16TJv0cTmZ7SZqrheb d4IypswNbwiWEDy/oOarsubCsCA3ax3zQ3H9iLKzVTYSmCKzyXYNS/5sahPEso7cuj 2VuMf+UQPbv18bzClnCD63+Vm3dpGSjDADvHTxD0cbM7bauFma36sYcKjJBaAT7/JB bPGjUyszcMJqtojtlNPoeTxFbjM4KhWRNKx0efDE8UgBAAQbbgtog1Y5rePrnTS841 IkhITd1epcN0mh1bQ6Jk4cLEMA1nMm2CbuaTOSCBgqEts5gyguTJNTvyuSzqq9k91F PZ1odKwWKFr2A== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 5/8] efivarfs: update ctime when mtime changes on a write Date: Mon, 12 Jun 2023 06:45:21 -0400 Message-Id: <20230612104524.17058-6-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org POSIX says: "Upon successful completion, where nbyte is greater than 0, write() shall mark for update the last data modification and last file status change timestamps of the file..." Add the missing ctime update. Signed-off-by: Jeff Layton --- fs/efivarfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index d57ee15874f9..375576111dc3 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c @@ -51,7 +51,7 @@ static ssize_t efivarfs_file_write(struct file *file, } else { inode_lock(inode); i_size_write(inode, datasize + sizeof(attributes)); - inode->i_mtime = current_time(inode); + inode->i_mtime = inode->i_ctime = current_time(inode); inode_unlock(inode); } From patchwork Mon Jun 12 10:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276338 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A157C7EE25 for ; Mon, 12 Jun 2023 10:58:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237339AbjFLK6V (ORCPT ); Mon, 12 Jun 2023 06:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237104AbjFLK5q (ORCPT ); Mon, 12 Jun 2023 06:57:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C820B127C4; Mon, 12 Jun 2023 03:45:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D3C562418; Mon, 12 Jun 2023 10:45:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDF9EC4339B; Mon, 12 Jun 2023 10:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566747; bh=KX7S7KoBIOHdIFvOtciMzqUF0ZVLgZ3kkDz1+nuzm5g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oz4WHLbO2jQN18Ove6Yj01Q8O4ys1wPwCmlNiLDNkmgWHI4GseN0zZLHEM92GYoGu boxFJi841L5bbyrUSD3RGup9DgX4l4qriaT0pGf+w6tErLMj+72DpzQ0vSvdMBFlbu KXSDAZv890DWx+cavMPVeGecLZIAIS0tENSJ08AMARyzUalS9uU1veHX9UzzI6FQoK GQ5IcM6JEkKLV02OZ7r4bZ+rjgcKQTK9aoJXpooAwIGA1rf40OBNSpEW02hvFu/dDK 7SNhtVCZvEX/ybEeXtinwolY6QwBsyPmrCP8B9kIeImVk/kMoxXe8UPrCWqnyVaGqr GlER8Exgmr4Sg== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 6/8] exfat: ensure that ctime is updated whenever the mtime is Date: Mon, 12 Jun 2023 06:45:22 -0400 Message-Id: <20230612104524.17058-7-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org When removing entries from a directory, the ctime must also be updated alongside the mtime. Signed-off-by: Jeff Layton --- fs/exfat/namei.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index e0ff9d156f6f..d9b46fa36bff 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -817,7 +817,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) ei->dir.dir = DIR_DELETED; inode_inc_iversion(dir); - dir->i_mtime = dir->i_atime = current_time(dir); + dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir); exfat_truncate_atime(&dir->i_atime); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); @@ -825,7 +825,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) mark_inode_dirty(dir); clear_nlink(inode); - inode->i_mtime = inode->i_atime = current_time(inode); + inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); exfat_truncate_atime(&inode->i_atime); exfat_unhash_inode(inode); exfat_d_version_set(dentry, inode_query_iversion(dir)); @@ -979,7 +979,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) ei->dir.dir = DIR_DELETED; inode_inc_iversion(dir); - dir->i_mtime = dir->i_atime = current_time(dir); + dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir); exfat_truncate_atime(&dir->i_atime); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); @@ -988,7 +988,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) drop_nlink(dir); clear_nlink(inode); - inode->i_mtime = inode->i_atime = current_time(inode); + inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); exfat_truncate_atime(&inode->i_atime); exfat_unhash_inode(inode); exfat_d_version_set(dentry, inode_query_iversion(dir)); From patchwork Mon Jun 12 10:45:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5137C7EE2E for ; Mon, 12 Jun 2023 10:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236431AbjFLK7C (ORCPT ); Mon, 12 Jun 2023 06:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236646AbjFLK5u (ORCPT ); Mon, 12 Jun 2023 06:57:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FD759D1; Mon, 12 Jun 2023 03:45:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A6D862451; Mon, 12 Jun 2023 10:45:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03C7EC4339C; Mon, 12 Jun 2023 10:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566750; bh=wKObH6RqfDSKn8NJ5P1Az5k/GApq/hL/pKFLfNG4hQ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LmmZkhNyD5zDhN30iflITZjik39GhWUe9Zp2752cKSdJF2l1rVLjseSvmT8FZAnUW Tt+Rk6fBUYPjKCd4SxlgSiLiIF8+vtYo5Sb5QtZpNg3apDbKEGO4QI+cdJ3s+yXJw9 Bi8/f7AqA8ESRTQKcBuEh6nTtDgtKi4wFVDK8wQLx0Zo25LDolbf5jZMc1ZTwyb7pe 0dKP/F7COKkhUtTASLHTMB7PzYC874EBAcrWbqIGcZW5hdEJiHjrXkVqvdBBmZWCPM ITZ9AnpeSKjuXFRWezYx5SYvEEwPZRK+EnpN6qR/ONpj6ISjGT7cQvL7MV0db9dJMg f0/ADoTJDBpSw== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 7/8] apparmor: update ctime whenever the mtime changes on an inode Date: Mon, 12 Jun 2023 06:45:23 -0400 Message-Id: <20230612104524.17058-8-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org In general, when updating the mtime on an inode, one must also update the ctime. Add the missing ctime updates. Signed-off-by: Jeff Layton --- security/apparmor/apparmorfs.c | 7 +++++-- security/apparmor/policy_unpack.c | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index db7a51acf9db..c06053718836 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1554,8 +1554,11 @@ void __aafs_profile_migrate_dents(struct aa_profile *old, for (i = 0; i < AAFS_PROF_SIZEOF; i++) { new->dents[i] = old->dents[i]; - if (new->dents[i]) - new->dents[i]->d_inode->i_mtime = current_time(new->dents[i]->d_inode); + if (new->dents[i]) { + struct inode *inode = d_inode(new->dents[i]); + + inode->i_mtime = inode->i_ctime = current_time(inode); + } old->dents[i] = NULL; } } diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index cf2ceec40b28..48a97c1800b9 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -86,10 +86,13 @@ void __aa_loaddata_update(struct aa_loaddata *data, long revision) data->revision = revision; if ((data->dents[AAFS_LOADDATA_REVISION])) { - d_inode(data->dents[AAFS_LOADDATA_DIR])->i_mtime = - current_time(d_inode(data->dents[AAFS_LOADDATA_DIR])); - d_inode(data->dents[AAFS_LOADDATA_REVISION])->i_mtime = - current_time(d_inode(data->dents[AAFS_LOADDATA_REVISION])); + struct inode *inode; + + inode = d_inode(data->dents[AAFS_LOADDATA_DIR]); + inode->i_mtime = inode->i_ctime = current_time(inode); + + inode = d_inode(data->dents[AAFS_LOADDATA_REVISION]); + inode->i_mtime = inode->i_ctime = current_time(inode); } } From patchwork Mon Jun 12 10:45:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13276340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 138F5C7EE43 for ; Mon, 12 Jun 2023 10:59:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236717AbjFLK7H (ORCPT ); Mon, 12 Jun 2023 06:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236256AbjFLK5w (ORCPT ); Mon, 12 Jun 2023 06:57:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186026EAB; Mon, 12 Jun 2023 03:45:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1A6D62451; Mon, 12 Jun 2023 10:45:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E347C433D2; Mon, 12 Jun 2023 10:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686566754; bh=n83nlEjKdfIOBmYidDyhQMkFJfDZwR7ta+gYJd+TVCQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=q+YkQNa328pMVFsA2bRAmz5UMjgF+DnvTPqv88BK4VXVNKMksbd7Idlt4Ynx5ayzp 0mpe940TUN7nIlv6rm8JohB1cnuug/RTPS8ZSK+Gqpfo935WqDt6AQW29cfrzEWyI0 hntdqRNzxTdjhNixoS4zPOB7ooqWzN4tqKdIHQzS3XjVL+czdUWoPRcWhg6kxtbJ6I Cr9pv+DlyR4FK0jjAjwunzAxUmuLz2ahMFQjJr+odeexqZ9ZZh/jTAkvwuE5rDARGz WM34MHMRkkLBu8ZnBc5JXo2/ZX2kgl5ccHEvr2qcjhgn1OBiH3soWsvGTwYWhRxGiM bCPjv8pHoyx6w== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Sebastian Reichel , Alan Stern , Suren Baghdasaryan , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH v2 8/8] cifs: update the ctime on a partial page write Date: Mon, 12 Jun 2023 06:45:24 -0400 Message-Id: <20230612104524.17058-9-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612104524.17058-1-jlayton@kernel.org> References: <20230612104524.17058-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org POSIX says: "Upon successful completion, where nbyte is greater than 0, write() shall mark for update the last data modification and last file status change timestamps of the file..." Add the missing ctime update. Signed-off-by: Jeff Layton --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index df88b8c04d03..a00038a326cf 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2596,7 +2596,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) write_data, to - from, &offset); cifsFileInfo_put(open_file); /* Does mm or vfs already set times? */ - inode->i_atime = inode->i_mtime = current_time(inode); + inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); if ((bytes_written > 0) && (offset)) rc = 0; else if (bytes_written < 0)