* [PATCH v4] fs: fuse: add more information to fdinfo
@ 2025-05-11 8:49 Chen Linxuan
2025-05-12 6:54 ` Miklos Szeredi
0 siblings, 1 reply; 4+ messages in thread
From: Chen Linxuan @ 2025-05-11 8:49 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Chen Linxuan, Amir Goldstein, linux-fsdevel, linux-kernel
This commit add fuse connection device id 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/
Link: https://lore.kernel.org/all/CAC1kPDOdDdPQVKs0C-LmgT1_MGBWbFqy4F+5TeunYBkA=xq7+Q@mail.gmail.com/
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
---
fs/fuse/file.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 754378dd9f715..a34fec685d3db 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3392,6 +3392,14 @@ 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;
+
+ seq_printf(seq, "fuse conn:%u\n", fc->dev);
+}
+
static const struct file_operations fuse_file_operations = {
.llseek = fuse_file_llseek,
.read_iter = fuse_file_read_iter,
@@ -3411,6 +3419,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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4] fs: fuse: add more information to fdinfo
2025-05-11 8:49 [PATCH v4] fs: fuse: add more information to fdinfo Chen Linxuan
@ 2025-05-12 6:54 ` Miklos Szeredi
2025-05-15 6:36 ` Chen Linxuan
0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2025-05-12 6:54 UTC (permalink / raw)
To: Chen Linxuan; +Cc: Amir Goldstein, linux-fsdevel, linux-kernel
On Sun, 11 May 2025 at 10:50, Chen Linxuan <chenlinxuan@uniontech.com> wrote:
>
> This commit add fuse connection device id to
> fdinfo of opened fuse files.
What I meant is adding this to fuse_dev_operations.
Thanks,
Miklos
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4] fs: fuse: add more information to fdinfo
2025-05-12 6:54 ` Miklos Szeredi
@ 2025-05-15 6:36 ` Chen Linxuan
2025-05-15 6:41 ` Chen Linxuan
0 siblings, 1 reply; 4+ messages in thread
From: Chen Linxuan @ 2025-05-15 6:36 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Chen Linxuan, Amir Goldstein, linux-fsdevel, linux-kernel
On Mon, May 12, 2025 at 2:55 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
> What I meant is adding this to fuse_dev_operations.
But it doesn't seem like exposing this information here would be a bad
idea either, does it?
For example, if a system administrator wants to write a script to
abort the FUSE connection
corresponding to a specific directory,
the script could use this information to locate the relevant connection.
Thanks,
Chen Linxuan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4] fs: fuse: add more information to fdinfo
2025-05-15 6:36 ` Chen Linxuan
@ 2025-05-15 6:41 ` Chen Linxuan
0 siblings, 0 replies; 4+ messages in thread
From: Chen Linxuan @ 2025-05-15 6:41 UTC (permalink / raw)
To: Chen Linxuan; +Cc: Miklos Szeredi, Amir Goldstein, linux-fsdevel, linux-kernel
On Thu, May 15, 2025 at 2:36 PM Chen Linxuan <chenlinxuan@uniontech.com> wrote:
> But it doesn't seem like exposing this information here would be a bad
> idea either, does it?
> For example, if a system administrator wants to write a script to
> abort the FUSE connection
> corresponding to a specific directory,
> the script could use this information to locate the relevant connection.
Oh I see I can get connection id via .st_dev from stat(2)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-15 6:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-11 8:49 [PATCH v4] fs: fuse: add more information to fdinfo Chen Linxuan
2025-05-12 6:54 ` Miklos Szeredi
2025-05-15 6:36 ` Chen Linxuan
2025-05-15 6:41 ` Chen Linxuan
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).