From: Chen Linxuan via B4 Relay <devnull+chenlinxuan.uniontech.com@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Amir Goldstein <amir73il@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Linxuan <chenlinxuan@uniontech.com>
Subject: [PATCH v3 3/3] fs: fuse: add more information to fdinfo
Date: Fri, 09 May 2025 14:33:55 +0800 [thread overview]
Message-ID: <20250509-fusectl-backing-files-v3-3-393761f9b683@uniontech.com> (raw)
In-Reply-To: <20250509-fusectl-backing-files-v3-0-393761f9b683@uniontech.com>
From: Chen Linxuan <chenlinxuan@uniontech.com>
This commit add fuse connection device id, open_flags and backing
files, to fdinfo of opened fuse files.
Related discussions can be found at links below.
Link: https://lore.kernel.org/all/CAOQ4uxgS3OUy9tpphAJKCQFRAn2zTERXXa0QN_KvP6ZOe2KVBw@mail.gmail.com/
Link: https://lore.kernel.org/all/CAOQ4uxgkg0uOuAWO2wOPNkMmD9wqd5wMX+gTfCT-zVHBC8CkZg@mail.gmail.com/
Cc: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
---
fs/fuse/file.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 754378dd9f7159f20fde6376962d45c4c706b868..1e54965780e9d625918c22a3dea48ba5a9a5ed1b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -8,6 +8,8 @@
#include "fuse_i.h"
+#include "linux/idr.h"
+#include "linux/rcupdate.h"
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/kernel.h>
@@ -3392,6 +3394,21 @@ static ssize_t fuse_copy_file_range(struct file *src_file, loff_t src_off,
return ret;
}
+static void fuse_file_show_fdinfo(struct seq_file *seq, struct file *f)
+{
+ struct fuse_file *ff = f->private_data;
+ struct fuse_conn *fc = ff->fm->fc;
+ struct file *backing_file = fuse_file_passthrough(ff);
+
+ seq_printf(seq, "fuse conn:%u open_flags:%u\n", fc->dev, ff->open_flags);
+
+ if (backing_file) {
+ seq_puts(seq, "fuse backing_file: ");
+ seq_file_path(seq, backing_file, " \t\n\\");
+ seq_puts(seq, "\n");
+ }
+}
+
static const struct file_operations fuse_file_operations = {
.llseek = fuse_file_llseek,
.read_iter = fuse_file_read_iter,
@@ -3411,6 +3428,9 @@ static const struct file_operations fuse_file_operations = {
.poll = fuse_file_poll,
.fallocate = fuse_file_fallocate,
.copy_file_range = fuse_copy_file_range,
+#ifdef CONFIG_PROC_FS
+ .show_fdinfo = fuse_file_show_fdinfo,
+#endif
};
static const struct address_space_operations fuse_file_aops = {
--
2.43.0
next prev parent reply other threads:[~2025-05-09 6:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 6:33 [PATCH v3 0/3] fuse: Expose more information of fuse backing files to userspace Chen Linxuan via B4 Relay
2025-05-09 6:33 ` [PATCH v3 1/3] fs: fuse: add const qualifier to fuse_ctl_file_conn_get() Chen Linxuan via B4 Relay
2025-05-09 7:21 ` Amir Goldstein
2025-05-09 6:33 ` [PATCH v3 2/3] fs: fuse: add backing_files control file Chen Linxuan via B4 Relay
2025-05-09 7:20 ` Amir Goldstein
2025-05-09 7:40 ` Chen Linxuan
2025-05-09 7:39 ` Chen Linxuan
2025-05-09 9:14 ` Amir Goldstein
2025-05-09 14:00 ` Miklos Szeredi
2025-05-09 14:43 ` Chen Linxuan
2025-05-09 14:59 ` Miklos Szeredi
2025-05-09 15:10 ` Chen Linxuan
2025-05-09 15:16 ` Miklos Szeredi
2025-05-11 9:55 ` Chen Linxuan
2025-05-12 8:27 ` Miklos Szeredi
2025-05-12 9:17 ` Christian Brauner
2025-05-12 9:23 ` Amir Goldstein
2025-05-12 10:06 ` Miklos Szeredi
2025-05-13 7:39 ` Christian Brauner
2025-05-13 7:57 ` Miklos Szeredi
2025-05-13 14:49 ` Miklos Szeredi
2025-06-20 6:12 ` Chen Linxuan
2025-07-02 5:11 ` Miklos Szeredi
2025-05-09 15:19 ` Amir Goldstein
2025-05-09 15:41 ` Miklos Szeredi
2025-05-09 6:33 ` Chen Linxuan via B4 Relay [this message]
2025-05-09 6:40 ` [PATCH v3 3/3] fs: fuse: add more information to fdinfo Chen Linxuan
2025-05-09 7:13 ` Amir Goldstein
2025-05-09 16:05 ` Miklos Szeredi
2025-05-09 7:36 ` [PATCH v3 0/3] fuse: Expose more information of fuse backing files to userspace Amir Goldstein
2025-05-09 13:14 ` Miklos Szeredi
2025-05-13 18:52 ` Joanne Koong
2025-05-14 8:50 ` Miklos Szeredi
2025-05-14 23:03 ` Joanne Koong
2025-05-15 3:17 ` Chen Linxuan
2025-05-15 19:02 ` Joanne Koong
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=20250509-fusectl-backing-files-v3-3-393761f9b683@uniontech.com \
--to=devnull+chenlinxuan.uniontech.com@kernel.org \
--cc=amir73il@gmail.com \
--cc=chenlinxuan@uniontech.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 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).