Skip to content

Commit 992dd5c

Browse files
shreeya-patel98PlaidCat
authored andcommitted
fs: fuse: add dev id to /dev/fuse fdinfo
jira SECO-511 commit-author Chen Linxuan <chenlinxuan@uniontech.com> commit f092229 upstream-diff | There were conflicts seen while applying this patch due to the following missing commit :- 786412a ("fuse: enable fuse-over-io-uring") This commit add fuse connection device id to fdinfo of opened /dev/fuse files. Related discussions can be found at links below. Link: https://lore.kernel.org/all/CAJfpegvEYUgEbpATpQx8NqVR33Mv-VK96C+gbTag1CEUeBqvnA@mail.gmail.com/ Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> (cherry picked from commit f092229) Signed-off-by: Shreeya Patel <spatel@ciq.com>
1 parent 5ce2a3e commit 992dd5c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

fs/fuse/dev.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/swap.h>
2222
#include <linux/splice.h>
2323
#include <linux/sched.h>
24+
#include <linux/seq_file.h>
2425

2526
#define CREATE_TRACE_POINTS
2627
#include "fuse_trace.h"
@@ -2469,6 +2470,17 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
24692470
}
24702471
}
24712472

2473+
#ifdef CONFIG_PROC_FS
2474+
static void fuse_dev_show_fdinfo(struct seq_file *seq, struct file *file)
2475+
{
2476+
struct fuse_dev *fud = fuse_get_dev(file);
2477+
if (!fud)
2478+
return;
2479+
2480+
seq_printf(seq, "fuse_connection:\t%u\n", fud->fc->dev);
2481+
}
2482+
#endif
2483+
24722484
const struct file_operations fuse_dev_operations = {
24732485
.owner = THIS_MODULE,
24742486
.open = fuse_dev_open,
@@ -2481,6 +2493,9 @@ const struct file_operations fuse_dev_operations = {
24812493
.fasync = fuse_dev_fasync,
24822494
.unlocked_ioctl = fuse_dev_ioctl,
24832495
.compat_ioctl = compat_ptr_ioctl,
2496+
#ifdef CONFIG_PROC_FS
2497+
.show_fdinfo = fuse_dev_show_fdinfo,
2498+
#endif
24842499
};
24852500
EXPORT_SYMBOL_GPL(fuse_dev_operations);
24862501

0 commit comments

Comments
 (0)