From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jeff Layton <jlayton@kernel.org>, David Sterba <dsterba@suse.com>,
Sasha Levin <sashal@kernel.org>,
clm@fb.com, josef@toxicpanda.com, linux-btrfs@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 9/9] btrfs: update target inode's ctime on unlink
Date: Fri, 23 Aug 2024 10:04:56 -0400 [thread overview]
Message-ID: <20240823140507.1975524-9-sashal@kernel.org> (raw)
In-Reply-To: <20240823140507.1975524-1-sashal@kernel.org>
From: Jeff Layton <jlayton@kernel.org>
[ Upstream commit 3bc2ac2f8f0b78a13140fc72022771efe0c9b778 ]
Unlink changes the link count on the target inode. POSIX mandates that
the ctime must also change when this occurs.
According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html:
"Upon successful completion, unlink() shall mark for update the last data
modification and last file status change timestamps of the parent
directory. Also, if the file's link count is not 0, the last file status
change timestamp of the file shall be marked for update."
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
[ add link to the opengroup docs ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 07c6ab4ba0d43..ac68be3290ddd 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4199,6 +4199,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
btrfs_i_size_write(dir, dir->vfs_inode.i_size - name_len * 2);
inode_inc_iversion(&inode->vfs_inode);
+ inode_set_ctime_current(&inode->vfs_inode);
inode_inc_iversion(&dir->vfs_inode);
inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime =
dir->vfs_inode.i_ctime = current_time(&inode->vfs_inode);
--
2.43.0
next prev parent reply other threads:[~2024-08-23 14:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 14:04 [PATCH AUTOSEL 5.15 1/9] usbnet: ipheth: race between ipheth_close and error handling Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 2/9] usbnet: ipheth: fix carrier detection in modes 1 and 4 Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 3/9] net: ethernet: use ip_hdrlen() instead of bit shift Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 4/9] net: phy: vitesse: repair vsc73xx autonegotiation Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 5/9] powerpc/mm: Fix boot warning with hugepages and CONFIG_DEBUG_VIRTUAL Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 6/9] Squashfs: sanity check symbolic link size Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 7/9] of/irq: Prevent device address out-of-bounds read in interrupt map walk Sasha Levin
2024-08-23 14:04 ` [PATCH AUTOSEL 5.15 8/9] lib/generic-radix-tree.c: Fix rare race in __genradix_ptr_alloc() Sasha Levin
2024-08-23 14:04 ` Sasha Levin [this message]
2024-10-12 11:28 [PATCH AUTOSEL 5.15 1/9] usbnet: ipheth: race between ipheth_close and error handling Sasha Levin
2024-10-12 11:28 ` [PATCH AUTOSEL 5.15 9/9] btrfs: update target inode's ctime on unlink Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823140507.1975524-9-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®