From: Jeff Layton <jlayton@kernel.org>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] btrfs: update target inode's ctime on unlink
Date: Mon, 12 Aug 2024 12:30:52 -0400 [thread overview]
Message-ID: <20240812-btrfs-unlink-v1-1-ee5c2ef538eb@kernel.org> (raw)
Unlink changes the link count on the target inode. POSIX mandates that
the ctime must also change when this occurs.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Found using the nfstest_posix testsuite with knfsd exporting btrfs.
---
fs/btrfs/inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 333b0e8587a2..b1b6564ab68f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4195,6 +4195,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_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode));
ret = btrfs_update_inode(trans, dir);
---
base-commit: 7c626ce4bae1ac14f60076d00eafe71af30450ba
change-id: 20240812-btrfs-unlink-77293421e416
Best regards,
--
Jeff Layton <jlayton@kernel.org>
next reply other threads:[~2024-08-12 16:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 16:30 Jeff Layton [this message]
2024-08-12 16:42 ` [PATCH] btrfs: update target inode's ctime on unlink David Sterba
2024-08-12 16:51 ` Jeff Layton
2024-08-13 13:00 ` David Sterba
2024-08-12 23:27 ` Qu Wenruo
2024-08-13 13:27 ` Christoph Hellwig
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=20240812-btrfs-unlink-v1-1-ee5c2ef538eb@kernel.org \
--to=jlayton@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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