linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Bo <yyyeer.bo@gmail.com>
To: stable@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, mszeredi@redhat.com,
	Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>,
	Zhang Tianci <zhangtianci.1997@bytedance.com>,
	Yang Bo <yb203166@antfin.com>
Subject: [PATCH 5/6] fuse: always revalidate rename target dentry
Date: Wed, 12 Apr 2023 12:19:34 +0800	[thread overview]
Message-ID: <20230412041935.1556-6-yb203166@antfin.com> (raw)
In-Reply-To: <20230412041935.1556-1-yb203166@antfin.com>

From: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>

commit ccc031e26afe60d2a5a3d93dabd9c978210825fb upstream.

[backport for 5.10.y]

The previous commit df8629af2934 ("fuse: always revalidate if exclusive
create") ensures that the dentries are revalidated on O_EXCL creates.  This
commit complements it by also performing revalidation for rename target
dentries.  Otherwise, a rename target file that only exists in kernel
dentry cache but not in the filesystem will result in EEXIST if
RENAME_NOREPLACE flag is used.

Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Signed-off-by: Zhang Tianci <zhangtianci.1997@bytedance.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Yang Bo <yb203166@antfin.com>
---
 fs/fuse/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 80a9e50392a0..bdb04bea0da9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -205,7 +205,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
 	if (inode && fuse_is_bad(inode))
 		goto invalid;
 	else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
-		 (flags & (LOOKUP_EXCL | LOOKUP_REVAL))) {
+		 (flags & (LOOKUP_EXCL | LOOKUP_REVAL | LOOKUP_RENAME_TARGET))) {
 		struct fuse_entry_out outarg;
 		FUSE_ARGS(args);
 		struct fuse_forget_link *forget;
-- 
2.40.0


  parent reply	other threads:[~2023-04-12  4:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  4:19 [PATCH 0/6] Backport several patches to 5.10.y Yang Bo
2023-04-12  4:19 ` [PATCH 1/6] virtiofs: clean up error handling in virtio_fs_get_tree() Yang Bo
2023-04-12  4:19 ` [PATCH 2/6] virtiofs: split requests that exceed virtqueue size Yang Bo
2023-04-12  4:19 ` [PATCH 3/6] fuse: check s_root when destroying sb Yang Bo
2023-04-12  4:19 ` [PATCH 4/6] fuse: fix attr version comparison in fuse_read_update_size() Yang Bo
2023-04-12  4:19 ` Yang Bo [this message]
2023-04-12  4:19 ` [PATCH 6/6] fuse: fix deadlock between atomic O_TRUNC and page invalidation Yang Bo
2023-04-18 10:34 ` [PATCH 0/6] Backport several patches to 5.10.y Greg KH
2023-04-19  9:48 [PATCH 0/6] Backport several fuse " Yang Bo
2023-04-19  9:48 ` [PATCH 5/6] fuse: always revalidate rename target dentry Yang Bo

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=20230412041935.1556-6-yb203166@antfin.com \
    --to=yyyeer.bo@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=yb203166@antfin.com \
    --cc=zhangjiachen.jaycee@bytedance.com \
    --cc=zhangtianci.1997@bytedance.com \
    /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;
as well as URLs for NNTP newsgroup(s).