From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org
Subject: [PATCH v2 1/3] fs: rename FMODE_NOACCOUNT to FMODE_INTERNAL
Date: Sun, 11 Jun 2023 16:27:30 +0300 [thread overview]
Message-ID: <20230611132732.1502040-2-amir73il@gmail.com> (raw)
In-Reply-To: <20230611132732.1502040-1-amir73il@gmail.com>
Rename the flag FMODE_NOACCOUNT that is used to mark internal files of
overlayfs and cachefiles to the more generic name FMODE_INTERNAL, which
also indicates that the file's f_path is possibly "fake".
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/file_table.c | 6 +++---
fs/internal.h | 5 +++--
fs/namei.c | 2 +-
fs/open.c | 2 +-
include/linux/fs.h | 4 ++--
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/fs/file_table.c b/fs/file_table.c
index 372653b92617..d64d3933f3e4 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -55,7 +55,7 @@ static void file_free_rcu(struct rcu_head *head)
static inline void file_free(struct file *f)
{
security_file_free(f);
- if (!(f->f_mode & FMODE_NOACCOUNT))
+ if (!(f->f_mode & FMODE_INTERNAL))
percpu_counter_dec(&nr_files);
call_rcu(&f->f_rcuhead, file_free_rcu);
}
@@ -205,12 +205,12 @@ struct file *alloc_empty_file(int flags, const struct cred *cred)
*
* Should not be used unless there's a very good reason to do so.
*/
-struct file *alloc_empty_file_noaccount(int flags, const struct cred *cred)
+struct file *alloc_empty_file_internal(int flags, const struct cred *cred)
{
struct file *f = __alloc_file(flags, cred);
if (!IS_ERR(f))
- f->f_mode |= FMODE_NOACCOUNT;
+ f->f_mode |= FMODE_INTERNAL;
return f;
}
diff --git a/fs/internal.h b/fs/internal.h
index bd3b2810a36b..018605caf597 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -97,8 +97,9 @@ extern void chroot_fs_refs(const struct path *, const struct path *);
/*
* file_table.c
*/
-extern struct file *alloc_empty_file(int, const struct cred *);
-extern struct file *alloc_empty_file_noaccount(int, const struct cred *);
+extern struct file *alloc_empty_file(int flags, const struct cred *cred);
+extern struct file *alloc_empty_file_internal(int flags,
+ const struct cred *cred);
static inline void put_file_access(struct file *file)
{
diff --git a/fs/namei.c b/fs/namei.c
index e4fe0879ae55..167f5acb0acf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3721,7 +3721,7 @@ struct file *vfs_tmpfile_open(struct mnt_idmap *idmap,
struct file *file;
int error;
- file = alloc_empty_file_noaccount(open_flag, cred);
+ file = alloc_empty_file_internal(open_flag, cred);
if (!IS_ERR(file)) {
error = vfs_tmpfile(idmap, parentpath, file, mode);
if (error) {
diff --git a/fs/open.c b/fs/open.c
index 81444ebf6091..23f862708a4f 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1124,7 +1124,7 @@ EXPORT_SYMBOL(dentry_create);
struct file *open_with_fake_path(const struct path *path, int flags,
struct inode *inode, const struct cred *cred)
{
- struct file *f = alloc_empty_file_noaccount(flags, cred);
+ struct file *f = alloc_empty_file_internal(flags, cred);
if (!IS_ERR(f)) {
int error;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 21a981680856..13eec1e8ca86 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -180,8 +180,8 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
/* File represents mount that needs unmounting */
#define FMODE_NEED_UNMOUNT ((__force fmode_t)0x10000000)
-/* File does not contribute to nr_files count */
-#define FMODE_NOACCOUNT ((__force fmode_t)0x20000000)
+/* File is kernel internal does not contribute to nr_files count */
+#define FMODE_INTERNAL ((__force fmode_t)0x20000000)
/* File supports async buffered reads */
#define FMODE_BUF_RASYNC ((__force fmode_t)0x40000000)
--
2.34.1
next prev parent reply other threads:[~2023-06-11 13:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-11 13:27 [PATCH v2 0/3] Handle notifications on overlayfs fake path files Amir Goldstein
2023-06-11 13:27 ` Amir Goldstein [this message]
2023-06-12 4:27 ` [PATCH v2 1/3] fs: rename FMODE_NOACCOUNT to FMODE_INTERNAL Christoph Hellwig
2023-06-12 6:08 ` Amir Goldstein
2023-06-12 6:11 ` Christoph Hellwig
2023-06-12 6:15 ` Christoph Hellwig
2023-06-12 6:32 ` Amir Goldstein
2023-06-12 6:35 ` Christoph Hellwig
2023-06-11 13:27 ` [PATCH v2 2/3] fs: introduce f_real_path() helper Amir Goldstein
2023-06-12 4:36 ` Christoph Hellwig
2023-06-12 6:28 ` Amir Goldstein
2023-06-12 6:36 ` Christoph Hellwig
2023-06-12 8:13 ` Amir Goldstein
2023-06-11 13:27 ` [PATCH v2 3/3] ovl: enable fsnotify events on underlying real files Amir Goldstein
2023-06-11 14:23 ` [PATCH v2 0/3] Handle notifications on overlayfs fake path files Miklos Szeredi
2023-06-11 16:55 ` Amir Goldstein
2023-06-11 17:52 ` Amir Goldstein
2023-06-11 19:12 ` Miklos Szeredi
2023-06-11 19:25 ` Amir Goldstein
2023-06-11 19:37 ` Miklos Szeredi
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=20230611132732.1502040-2-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/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).