From: Fengnan Chang <changfengnan@vivo.com>
To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org
Cc: Fengnan Chang <changfengnan@vivo.com>
Subject: [PATCH] fuse: fix inconsistent status between faccess and mkdir
Date: Fri, 14 May 2021 09:55:17 +0800 [thread overview]
Message-ID: <20210514015517.258-1-changfengnan@vivo.com> (raw)
since FUSE caches dentries and attributes with separate timeout, It may
happen that checking the permission returns -ENOENT, but because the
dentries cache has not timed out, creating the file returns -EEXIST.
Fix this by when return ENOENT, mark the entry as stale.
Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
---
fs/fuse/dir.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 06a18700a845..154dd4578762 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1065,6 +1065,14 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
fuse_fillattr(inode, &outarg.attr, stat);
}
}
+ if (err == -ENOENT) {
+ struct dentry *entry;
+
+ entry = d_obtain_alias(inode);
+ if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID)
+ fuse_invalidate_entry_cache(entry);
+ }
+
return err;
}
@@ -1226,6 +1234,14 @@ static int fuse_access(struct inode *inode, int mask)
fm->fc->no_access = 1;
err = 0;
}
+ if (err == -ENOENT) {
+ struct dentry *entry;
+
+ entry = d_obtain_alias(inode);
+ if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID)
+ fuse_invalidate_entry_cache(entry);
+ }
+
return err;
}
--
2.29.0
next reply other threads:[~2021-05-14 1:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 1:55 Fengnan Chang [this message]
2021-05-14 2:26 ` [PATCH] fuse: fix inconsistent status between faccess and mkdir Matthew Wilcox
2021-05-14 3:27 ` 答复: " changfengnan
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=20210514015517.258-1-changfengnan@vivo.com \
--to=changfengnan@vivo.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.