* [PATCH 02/11] hfi1: get rid of redundant debugfs_file_{get,put}()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
@ 2025-07-02 21:15 ` Al Viro
2025-07-02 21:16 ` [PATCH 03/11] regmap: " Al Viro
` (10 subsequent siblings)
11 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:15 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, linux-rdma
All files in question are created via debugfs_create_file(), so
exclusion with removals is provided by debugfs wrappers; as the matter
of fact, hfi1-private wrappers had been redundant at least since 2017...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/infiniband/hw/hfi1/debugfs.c | 28 ----------------------------
drivers/infiniband/hw/hfi1/debugfs.h | 9 ++-------
drivers/infiniband/hw/hfi1/fault.c | 9 ---------
3 files changed, 2 insertions(+), 44 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c
index a1e01b447265..ac37ab7f8995 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -22,34 +22,6 @@
static struct dentry *hfi1_dbg_root;
-/* wrappers to enforce srcu in seq file */
-ssize_t hfi1_seq_read(struct file *file, char __user *buf, size_t size,
- loff_t *ppos)
-{
- struct dentry *d = file->f_path.dentry;
- ssize_t r;
-
- r = debugfs_file_get(d);
- if (unlikely(r))
- return r;
- r = seq_read(file, buf, size, ppos);
- debugfs_file_put(d);
- return r;
-}
-
-loff_t hfi1_seq_lseek(struct file *file, loff_t offset, int whence)
-{
- struct dentry *d = file->f_path.dentry;
- loff_t r;
-
- r = debugfs_file_get(d);
- if (unlikely(r))
- return r;
- r = seq_lseek(file, offset, whence);
- debugfs_file_put(d);
- return r;
-}
-
#define private2dd(file) (file_inode(file)->i_private)
#define private2ppd(file) (file_inode(file)->i_private)
diff --git a/drivers/infiniband/hw/hfi1/debugfs.h b/drivers/infiniband/hw/hfi1/debugfs.h
index 54d952a4016c..65b48839abc6 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.h
+++ b/drivers/infiniband/hw/hfi1/debugfs.h
@@ -33,16 +33,11 @@ static int _##name##_open(struct inode *inode, struct file *s) \
static const struct file_operations _##name##_file_ops = { \
.owner = THIS_MODULE, \
.open = _##name##_open, \
- .read = hfi1_seq_read, \
- .llseek = hfi1_seq_lseek, \
+ .read = seq_read, \
+ .llseek = seq_lseek, \
.release = seq_release \
}
-
-ssize_t hfi1_seq_read(struct file *file, char __user *buf, size_t size,
- loff_t *ppos);
-loff_t hfi1_seq_lseek(struct file *file, loff_t offset, int whence);
-
#ifdef CONFIG_DEBUG_FS
void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd);
void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd);
diff --git a/drivers/infiniband/hw/hfi1/fault.c b/drivers/infiniband/hw/hfi1/fault.c
index ec9ee59fcf0c..a45cbffd52c7 100644
--- a/drivers/infiniband/hw/hfi1/fault.c
+++ b/drivers/infiniband/hw/hfi1/fault.c
@@ -104,9 +104,6 @@ static ssize_t fault_opcodes_write(struct file *file, const char __user *buf,
goto free_data;
}
- ret = debugfs_file_get(file->f_path.dentry);
- if (unlikely(ret))
- goto free_data;
ptr = data;
token = ptr;
for (ptr = data; *ptr; ptr = end + 1, token = ptr) {
@@ -154,7 +151,6 @@ static ssize_t fault_opcodes_write(struct file *file, const char __user *buf,
}
ret = len;
- debugfs_file_put(file->f_path.dentry);
free_data:
kfree(data);
return ret;
@@ -173,9 +169,6 @@ static ssize_t fault_opcodes_read(struct file *file, char __user *buf,
data = kcalloc(datalen, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
- ret = debugfs_file_get(file->f_path.dentry);
- if (unlikely(ret))
- goto free_data;
bit = find_first_bit(fault->opcodes, bitsize);
while (bit < bitsize) {
zero = find_next_zero_bit(fault->opcodes, bitsize, bit);
@@ -189,11 +182,9 @@ static ssize_t fault_opcodes_read(struct file *file, char __user *buf,
bit);
bit = find_next_bit(fault->opcodes, bitsize, zero);
}
- debugfs_file_put(file->f_path.dentry);
data[size - 1] = '\n';
data[size] = '\0';
ret = simple_read_from_buffer(buf, len, pos, data, size);
-free_data:
kfree(data);
return ret;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 03/11] regmap: get rid of redundant debugfs_file_{get,put}()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
2025-07-02 21:15 ` [PATCH 02/11] hfi1: get rid of redundant debugfs_file_{get,put}() Al Viro
@ 2025-07-02 21:16 ` Al Viro
2025-07-03 11:10 ` Mark Brown
2025-07-02 21:16 ` [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}() Al Viro
` (9 subsequent siblings)
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:16 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, Mark Brown
pointless in ->read()/->write() of file_operations used only via
debugfs_create_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/base/regmap/regmap-debugfs.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index fb84cda92a75..c9b4c04b1cf6 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -470,10 +470,6 @@ static ssize_t regmap_cache_only_write_file(struct file *file,
if (err)
return count;
- err = debugfs_file_get(file->f_path.dentry);
- if (err)
- return err;
-
map->lock(map->lock_arg);
if (new_val && !map->cache_only) {
@@ -486,7 +482,6 @@ static ssize_t regmap_cache_only_write_file(struct file *file,
map->cache_only = new_val;
map->unlock(map->lock_arg);
- debugfs_file_put(file->f_path.dentry);
if (require_sync) {
err = regcache_sync(map);
@@ -517,10 +512,6 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,
if (err)
return count;
- err = debugfs_file_get(file->f_path.dentry);
- if (err)
- return err;
-
map->lock(map->lock_arg);
if (new_val && !map->cache_bypass) {
@@ -532,7 +523,6 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,
map->cache_bypass = new_val;
map->unlock(map->lock_arg);
- debugfs_file_put(file->f_path.dentry);
return count;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
2025-07-02 21:15 ` [PATCH 02/11] hfi1: get rid of redundant debugfs_file_{get,put}() Al Viro
2025-07-02 21:16 ` [PATCH 03/11] regmap: " Al Viro
@ 2025-07-02 21:16 ` Al Viro
2025-07-02 21:24 ` Luck, Tony
2025-07-02 21:17 ` [PATCH 05/11] vmscan: don't bother with debugfs_real_fops() Al Viro
` (8 subsequent siblings)
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:16 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, Tony Luck
->write() of file_operations that gets used only via debugfs_create_file()
is called only under debugfs_file_get()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/resctrl/pseudo_lock.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fs/resctrl/pseudo_lock.c b/fs/resctrl/pseudo_lock.c
index ccc2f9213b4b..87bbc2605de1 100644
--- a/fs/resctrl/pseudo_lock.c
+++ b/fs/resctrl/pseudo_lock.c
@@ -764,13 +764,9 @@ static ssize_t pseudo_lock_measure_trigger(struct file *file,
if (ret == 0) {
if (sel != 1 && sel != 2 && sel != 3)
return -EINVAL;
- ret = debugfs_file_get(file->f_path.dentry);
- if (ret)
- return ret;
ret = pseudo_lock_measure_cycles(rdtgrp, sel);
if (ret == 0)
ret = count;
- debugfs_file_put(file->f_path.dentry);
}
return ret;
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-02 21:16 ` [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}() Al Viro
@ 2025-07-02 21:24 ` Luck, Tony
2025-07-02 23:45 ` Reinette Chatre
0 siblings, 1 reply; 36+ messages in thread
From: Luck, Tony @ 2025-07-02 21:24 UTC (permalink / raw)
To: Al Viro, Reinette Chatre; +Cc: Greg Kroah-Hartman, linux-fsdevel
On Wed, Jul 02, 2025 at 10:16:50PM +0100, Al Viro wrote:
+Reinette
> ->write() of file_operations that gets used only via debugfs_create_file()
> is called only under debugfs_file_get()
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> fs/resctrl/pseudo_lock.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/fs/resctrl/pseudo_lock.c b/fs/resctrl/pseudo_lock.c
> index ccc2f9213b4b..87bbc2605de1 100644
> --- a/fs/resctrl/pseudo_lock.c
> +++ b/fs/resctrl/pseudo_lock.c
> @@ -764,13 +764,9 @@ static ssize_t pseudo_lock_measure_trigger(struct file *file,
> if (ret == 0) {
> if (sel != 1 && sel != 2 && sel != 3)
> return -EINVAL;
> - ret = debugfs_file_get(file->f_path.dentry);
> - if (ret)
> - return ret;
> ret = pseudo_lock_measure_cycles(rdtgrp, sel);
> if (ret == 0)
> ret = count;
> - debugfs_file_put(file->f_path.dentry);
> }
>
> return ret;
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-02 21:24 ` Luck, Tony
@ 2025-07-02 23:45 ` Reinette Chatre
2025-07-03 0:24 ` Al Viro
0 siblings, 1 reply; 36+ messages in thread
From: Reinette Chatre @ 2025-07-02 23:45 UTC (permalink / raw)
To: Luck, Tony, Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel
On 7/2/25 2:24 PM, Luck, Tony wrote:
> On Wed, Jul 02, 2025 at 10:16:50PM +0100, Al Viro wrote:
>
> +Reinette
Thank you Tony.
>
>> ->write() of file_operations that gets used only via debugfs_create_file()
>> is called only under debugfs_file_get()
>>
>> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>> ---
>> fs/resctrl/pseudo_lock.c | 4 ----
>> 1 file changed, 4 deletions(-)
>>
>> diff --git a/fs/resctrl/pseudo_lock.c b/fs/resctrl/pseudo_lock.c
>> index ccc2f9213b4b..87bbc2605de1 100644
>> --- a/fs/resctrl/pseudo_lock.c
>> +++ b/fs/resctrl/pseudo_lock.c
>> @@ -764,13 +764,9 @@ static ssize_t pseudo_lock_measure_trigger(struct file *file,
>> if (ret == 0) {
>> if (sel != 1 && sel != 2 && sel != 3)
>> return -EINVAL;
>> - ret = debugfs_file_get(file->f_path.dentry);
>> - if (ret)
>> - return ret;
>> ret = pseudo_lock_measure_cycles(rdtgrp, sel);
>> if (ret == 0)
>> ret = count;
>> - debugfs_file_put(file->f_path.dentry);
>> }
>>
>> return ret;
>> --
>> 2.39.5
>>
Thank you very much for catching and fixing this Al.
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
How are the patches from this series expected to flow upstream?
resctrl changes usually flow upstream via tip. Would you be ok if
I pick just this patch and route it via tip or would you prefer to
keep it with this series? At this time I do not anticipate
any conflicts if this patch goes upstream via other FS changes during
this cycle.
Reinette
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-02 23:45 ` Reinette Chatre
@ 2025-07-03 0:24 ` Al Viro
2025-07-03 5:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-03 0:24 UTC (permalink / raw)
To: Reinette Chatre; +Cc: Luck, Tony, Greg Kroah-Hartman, linux-fsdevel
On Wed, Jul 02, 2025 at 04:45:36PM -0700, Reinette Chatre wrote:
> Thank you very much for catching and fixing this Al.
>
> Acked-by: Reinette Chatre <reinette.chatre@intel.com>
>
> How are the patches from this series expected to flow upstream?
> resctrl changes usually flow upstream via tip. Would you be ok if
> I pick just this patch and route it via tip or would you prefer to
> keep it with this series? At this time I do not anticipate
> any conflicts if this patch goes upstream via other FS changes during
> this cycle.
Up to Greg, really...
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-03 0:24 ` Al Viro
@ 2025-07-03 5:40 ` Greg Kroah-Hartman
2025-07-03 15:10 ` Reinette Chatre
0 siblings, 1 reply; 36+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-03 5:40 UTC (permalink / raw)
To: Al Viro; +Cc: Reinette Chatre, Luck, Tony, linux-fsdevel
On Thu, Jul 03, 2025 at 01:24:19AM +0100, Al Viro wrote:
> On Wed, Jul 02, 2025 at 04:45:36PM -0700, Reinette Chatre wrote:
>
> > Thank you very much for catching and fixing this Al.
> >
> > Acked-by: Reinette Chatre <reinette.chatre@intel.com>
> >
> > How are the patches from this series expected to flow upstream?
> > resctrl changes usually flow upstream via tip. Would you be ok if
> > I pick just this patch and route it via tip or would you prefer to
> > keep it with this series? At this time I do not anticipate
> > any conflicts if this patch goes upstream via other FS changes during
> > this cycle.
>
> Up to Greg, really...
I'll take them all, give me a day or so to catch up with pending
reviews, thanks.
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}()
2025-07-03 5:40 ` Greg Kroah-Hartman
@ 2025-07-03 15:10 ` Reinette Chatre
0 siblings, 0 replies; 36+ messages in thread
From: Reinette Chatre @ 2025-07-03 15:10 UTC (permalink / raw)
To: Greg Kroah-Hartman, Al Viro; +Cc: Luck, Tony, linux-fsdevel
On 7/2/25 10:40 PM, Greg Kroah-Hartman wrote:
> On Thu, Jul 03, 2025 at 01:24:19AM +0100, Al Viro wrote:
>> On Wed, Jul 02, 2025 at 04:45:36PM -0700, Reinette Chatre wrote:
>>
>>> Thank you very much for catching and fixing this Al.
>>>
>>> Acked-by: Reinette Chatre <reinette.chatre@intel.com>
>>>
>>> How are the patches from this series expected to flow upstream?
>>> resctrl changes usually flow upstream via tip. Would you be ok if
>>> I pick just this patch and route it via tip or would you prefer to
>>> keep it with this series? At this time I do not anticipate
>>> any conflicts if this patch goes upstream via other FS changes during
>>> this cycle.
>>
>> Up to Greg, really...
>
> I'll take them all, give me a day or so to catch up with pending
> reviews, thanks.
>
Thank you very much Greg.
Reinette
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (2 preceding siblings ...)
2025-07-02 21:16 ` [PATCH 04/11] resctrl: get rid of pointless debugfs_file_{get,put}() Al Viro
@ 2025-07-02 21:17 ` Al Viro
2025-07-03 11:51 ` Matthew Wilcox
2025-07-02 21:22 ` [PATCH 06/11] netronome: " Al Viro
` (7 subsequent siblings)
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:17 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, linux-mm
... not when it's used only to check which file is used;
debugfs_create_file_aux_num() allows to stash a number into
debugfs entry and debugfs_get_aux_num() extracts it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
mm/vmscan.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..0e661672cbb9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5420,7 +5420,7 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
static int lru_gen_seq_show(struct seq_file *m, void *v)
{
unsigned long seq;
- bool full = !debugfs_real_fops(m->file)->write;
+ bool full = debugfs_get_aux_num(m->file);
struct lruvec *lruvec = v;
struct lru_gen_folio *lrugen = &lruvec->lrugen;
int nid = lruvec_pgdat(lruvec)->node_id;
@@ -5756,8 +5756,10 @@ static int __init init_lru_gen(void)
if (sysfs_create_group(mm_kobj, &lru_gen_attr_group))
pr_err("lru_gen: failed to create sysfs group\n");
- debugfs_create_file("lru_gen", 0644, NULL, NULL, &lru_gen_rw_fops);
- debugfs_create_file("lru_gen_full", 0444, NULL, NULL, &lru_gen_ro_fops);
+ debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1,
+ &lru_gen_rw_fops);
+ debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0,
+ &lru_gen_ro_fops);
return 0;
};
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
2025-07-02 21:17 ` [PATCH 05/11] vmscan: don't bother with debugfs_real_fops() Al Viro
@ 2025-07-03 11:51 ` Matthew Wilcox
2025-07-04 4:07 ` Al Viro
0 siblings, 1 reply; 36+ messages in thread
From: Matthew Wilcox @ 2025-07-03 11:51 UTC (permalink / raw)
To: Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel, linux-mm
On Wed, Jul 02, 2025 at 10:17:39PM +0100, Al Viro wrote:
> - bool full = !debugfs_real_fops(m->file)->write;
> + bool full = debugfs_get_aux_num(m->file);
> + debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1,
> + &lru_gen_rw_fops);
> + debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0,
> + &lru_gen_ro_fops);
Looks like you have the polarity inverted there?
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
2025-07-03 11:51 ` Matthew Wilcox
@ 2025-07-04 4:07 ` Al Viro
0 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-04 4:07 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Greg Kroah-Hartman, linux-fsdevel, linux-mm
On Thu, Jul 03, 2025 at 12:51:57PM +0100, Matthew Wilcox wrote:
> On Wed, Jul 02, 2025 at 10:17:39PM +0100, Al Viro wrote:
> > - bool full = !debugfs_real_fops(m->file)->write;
> > + bool full = debugfs_get_aux_num(m->file);
>
> > + debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1,
> > + &lru_gen_rw_fops);
> > + debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0,
> > + &lru_gen_ro_fops);
>
> Looks like you have the polarity inverted there?
Right you are. My apologies... Fixed, force-pushed into the same branch,
replacement commit below:
From 51d26db0fd00fbd501f9271550667bab6c5fb107 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Wed, 29 Jan 2025 14:43:44 -0500
Subject: [PATCH 05/11] vmscan: don't bother with debugfs_real_fops()
... not when it's used only to check which file is used;
debugfs_create_file_aux_num() allows to stash a number into
debugfs entry and debugfs_get_aux_num() extracts it.
Braino-spotted-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
mm/vmscan.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..27c70848c0a0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5420,7 +5420,7 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
static int lru_gen_seq_show(struct seq_file *m, void *v)
{
unsigned long seq;
- bool full = !debugfs_real_fops(m->file)->write;
+ bool full = debugfs_get_aux_num(m->file);
struct lruvec *lruvec = v;
struct lru_gen_folio *lrugen = &lruvec->lrugen;
int nid = lruvec_pgdat(lruvec)->node_id;
@@ -5756,8 +5756,10 @@ static int __init init_lru_gen(void)
if (sysfs_create_group(mm_kobj, &lru_gen_attr_group))
pr_err("lru_gen: failed to create sysfs group\n");
- debugfs_create_file("lru_gen", 0644, NULL, NULL, &lru_gen_rw_fops);
- debugfs_create_file("lru_gen_full", 0444, NULL, NULL, &lru_gen_ro_fops);
+ debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, false,
+ &lru_gen_rw_fops);
+ debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, true,
+ &lru_gen_ro_fops);
return 0;
};
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 06/11] netronome: don't bother with debugfs_real_fops()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (3 preceding siblings ...)
2025-07-02 21:17 ` [PATCH 05/11] vmscan: don't bother with debugfs_real_fops() Al Viro
@ 2025-07-02 21:22 ` Al Viro
2025-07-03 7:11 ` Louis Peens
2025-07-02 21:24 ` [PATCH 07/11] debugfs: split short and full proxy wrappers, kill debugfs_real_fops() Al Viro
` (6 subsequent siblings)
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:22 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, Louis Peens
Just turn nfp_tx_q_show() into a wrapper for helper that gets
told whether it's tx or xdp via an explicit argument and have
nfp_xdp_q_show() call the underlying helper instead.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
.../net/ethernet/netronome/nfp/nfp_net_debugfs.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
index d8b735ccf899..d843d1e19715 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
@@ -77,7 +77,7 @@ DEFINE_SHOW_ATTRIBUTE(nfp_rx_q);
static int nfp_tx_q_show(struct seq_file *file, void *data);
DEFINE_SHOW_ATTRIBUTE(nfp_tx_q);
-static int nfp_tx_q_show(struct seq_file *file, void *data)
+static int __nfp_tx_q_show(struct seq_file *file, void *data, bool is_xdp)
{
struct nfp_net_r_vector *r_vec = file->private;
struct nfp_net_tx_ring *tx_ring;
@@ -86,10 +86,10 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
rtnl_lock();
- if (debugfs_real_fops(file->file) == &nfp_tx_q_fops)
- tx_ring = r_vec->tx_ring;
- else
+ if (is_xdp)
tx_ring = r_vec->xdp_ring;
+ else
+ tx_ring = r_vec->tx_ring;
if (!r_vec->nfp_net || !tx_ring)
goto out;
nn = r_vec->nfp_net;
@@ -115,9 +115,14 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
return 0;
}
+static int nfp_tx_q_show(struct seq_file *file, void *data)
+{
+ return __nfp_tx_q_show(file, data, false);
+}
+
static int nfp_xdp_q_show(struct seq_file *file, void *data)
{
- return nfp_tx_q_show(file, data);
+ return __nfp_tx_q_show(file, data, true);
}
DEFINE_SHOW_ATTRIBUTE(nfp_xdp_q);
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH 06/11] netronome: don't bother with debugfs_real_fops()
2025-07-02 21:22 ` [PATCH 06/11] netronome: " Al Viro
@ 2025-07-03 7:11 ` Louis Peens
0 siblings, 0 replies; 36+ messages in thread
From: Louis Peens @ 2025-07-03 7:11 UTC (permalink / raw)
To: Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel
On Wed, Jul 02, 2025 at 10:22:05PM +0100, Al Viro wrote:
> Just turn nfp_tx_q_show() into a wrapper for helper that gets
> told whether it's tx or xdp via an explicit argument and have
> nfp_xdp_q_show() call the underlying helper instead.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> .../net/ethernet/netronome/nfp/nfp_net_debugfs.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> index d8b735ccf899..d843d1e19715 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
> @@ -77,7 +77,7 @@ DEFINE_SHOW_ATTRIBUTE(nfp_rx_q);
> static int nfp_tx_q_show(struct seq_file *file, void *data);
> DEFINE_SHOW_ATTRIBUTE(nfp_tx_q);
I could be missing something, but I think this update now allows this
DEFINE_SHOW_ATTRIBUTE(nfp_tx_q) to move down to below the function
wrapper, and the 'nfp_tx_q_show' declaration here is not needed
anymore?
This is just a tiny nit though, I'm also fine if you want to leave it as is.
This looks like a nice cleanup to me, thanks!
Reviewed-by: Louis Peens <louis.peens@corigine.com>
>
> -static int nfp_tx_q_show(struct seq_file *file, void *data)
> +static int __nfp_tx_q_show(struct seq_file *file, void *data, bool is_xdp)
> {
> struct nfp_net_r_vector *r_vec = file->private;
> struct nfp_net_tx_ring *tx_ring;
> @@ -86,10 +86,10 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
>
> rtnl_lock();
>
> - if (debugfs_real_fops(file->file) == &nfp_tx_q_fops)
> - tx_ring = r_vec->tx_ring;
> - else
> + if (is_xdp)
> tx_ring = r_vec->xdp_ring;
> + else
> + tx_ring = r_vec->tx_ring;
> if (!r_vec->nfp_net || !tx_ring)
> goto out;
> nn = r_vec->nfp_net;
> @@ -115,9 +115,14 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
> return 0;
> }
>
> +static int nfp_tx_q_show(struct seq_file *file, void *data)
> +{
> + return __nfp_tx_q_show(file, data, false);
> +}
> +
> static int nfp_xdp_q_show(struct seq_file *file, void *data)
> {
> - return nfp_tx_q_show(file, data);
> + return __nfp_tx_q_show(file, data, true);
> }
> DEFINE_SHOW_ATTRIBUTE(nfp_xdp_q);
>
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 07/11] debugfs: split short and full proxy wrappers, kill debugfs_real_fops()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (4 preceding siblings ...)
2025-07-02 21:22 ` [PATCH 06/11] netronome: " Al Viro
@ 2025-07-02 21:24 ` Al Viro
2025-07-02 21:25 ` [PATCH 08/11] fix tt_command_write() Al Viro
` (5 subsequent siblings)
11 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:24 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, dri-devel
All users outside of fs/debugfs/file.c are gone, in there we can just
fully split the wrappers for full and short cases and be done with that.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/debugfs/file.c | 87 ++++++++++++++++++-----------------------
include/linux/debugfs.h | 2 -
2 files changed, 38 insertions(+), 51 deletions(-)
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 69e9ddcb113d..77784091a10f 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -53,23 +53,6 @@ const void *debugfs_get_aux(const struct file *file)
}
EXPORT_SYMBOL_GPL(debugfs_get_aux);
-const struct file_operations *debugfs_real_fops(const struct file *filp)
-{
- struct debugfs_fsdata *fsd = F_DENTRY(filp)->d_fsdata;
-
- if (!fsd) {
- /*
- * Urgh, we've been called w/o a protecting
- * debugfs_file_get().
- */
- WARN_ON(1);
- return NULL;
- }
-
- return fsd->real_fops;
-}
-EXPORT_SYMBOL_GPL(debugfs_real_fops);
-
enum dbgfs_get_mode {
DBGFS_GET_ALREADY,
DBGFS_GET_REGULAR,
@@ -302,15 +285,13 @@ static int debugfs_locked_down(struct inode *inode,
static int open_proxy_open(struct inode *inode, struct file *filp)
{
struct dentry *dentry = F_DENTRY(filp);
- const struct file_operations *real_fops = NULL;
+ const struct file_operations *real_fops = DEBUGFS_I(inode)->real_fops;
int r;
r = __debugfs_file_get(dentry, DBGFS_GET_REGULAR);
if (r)
return r == -EIO ? -ENOENT : r;
- real_fops = debugfs_real_fops(filp);
-
r = debugfs_locked_down(inode, filp, real_fops);
if (r)
goto out;
@@ -352,7 +333,6 @@ static ret_type full_proxy_ ## name(proto) \
{ \
struct dentry *dentry = F_DENTRY(filp); \
struct debugfs_fsdata *fsd = dentry->d_fsdata; \
- const struct file_operations *real_fops; \
ret_type r; \
\
if (!(fsd->methods & bit)) \
@@ -360,14 +340,13 @@ static ret_type full_proxy_ ## name(proto) \
r = debugfs_file_get(dentry); \
if (unlikely(r)) \
return r; \
- real_fops = debugfs_real_fops(filp); \
- r = real_fops->name(args); \
+ r = fsd->real_fops->name(args); \
debugfs_file_put(dentry); \
return r; \
}
-#define FULL_PROXY_FUNC_BOTH(name, ret_type, filp, proto, args, bit, ret) \
-static ret_type full_proxy_ ## name(proto) \
+#define SHORT_PROXY_FUNC(name, ret_type, filp, proto, args, bit, ret) \
+static ret_type short_proxy_ ## name(proto) \
{ \
struct dentry *dentry = F_DENTRY(filp); \
struct debugfs_fsdata *fsd = dentry->d_fsdata; \
@@ -378,27 +357,38 @@ static ret_type full_proxy_ ## name(proto) \
r = debugfs_file_get(dentry); \
if (unlikely(r)) \
return r; \
- if (fsd->real_fops) \
- r = fsd->real_fops->name(args); \
- else \
- r = fsd->short_fops->name(args); \
+ r = fsd->short_fops->name(args); \
debugfs_file_put(dentry); \
return r; \
}
-FULL_PROXY_FUNC_BOTH(llseek, loff_t, filp,
- PROTO(struct file *filp, loff_t offset, int whence),
- ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
+SHORT_PROXY_FUNC(llseek, loff_t, filp,
+ PROTO(struct file *filp, loff_t offset, int whence),
+ ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
-FULL_PROXY_FUNC_BOTH(read, ssize_t, filp,
- PROTO(struct file *filp, char __user *buf, size_t size,
- loff_t *ppos),
- ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
+FULL_PROXY_FUNC(llseek, loff_t, filp,
+ PROTO(struct file *filp, loff_t offset, int whence),
+ ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
-FULL_PROXY_FUNC_BOTH(write, ssize_t, filp,
- PROTO(struct file *filp, const char __user *buf,
- size_t size, loff_t *ppos),
- ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
+SHORT_PROXY_FUNC(read, ssize_t, filp,
+ PROTO(struct file *filp, char __user *buf, size_t size,
+ loff_t *ppos),
+ ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
+
+FULL_PROXY_FUNC(read, ssize_t, filp,
+ PROTO(struct file *filp, char __user *buf, size_t size,
+ loff_t *ppos),
+ ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
+
+SHORT_PROXY_FUNC(write, ssize_t, filp,
+ PROTO(struct file *filp, const char __user *buf,
+ size_t size, loff_t *ppos),
+ ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
+
+FULL_PROXY_FUNC(write, ssize_t, filp,
+ PROTO(struct file *filp, const char __user *buf,
+ size_t size, loff_t *ppos),
+ ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
FULL_PROXY_FUNC(unlocked_ioctl, long, filp,
PROTO(struct file *filp, unsigned int cmd, unsigned long arg),
@@ -410,22 +400,21 @@ static __poll_t full_proxy_poll(struct file *filp,
struct dentry *dentry = F_DENTRY(filp);
struct debugfs_fsdata *fsd = dentry->d_fsdata;
__poll_t r = 0;
- const struct file_operations *real_fops;
if (!(fsd->methods & HAS_POLL))
return DEFAULT_POLLMASK;
if (debugfs_file_get(dentry))
return EPOLLHUP;
- real_fops = debugfs_real_fops(filp);
- r = real_fops->poll(filp, wait);
+ r = fsd->real_fops->poll(filp, wait);
debugfs_file_put(dentry);
return r;
}
-static int full_proxy_release(struct inode *inode, struct file *filp)
+static int full_proxy_release(struct inode *inode, struct file *file)
{
- const struct file_operations *real_fops = debugfs_real_fops(filp);
+ struct debugfs_fsdata *fsd = F_DENTRY(file)->d_fsdata;
+ const struct file_operations *real_fops = fsd->real_fops;
int r = 0;
/*
@@ -435,7 +424,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
* ->i_private is still being meaningful here.
*/
if (real_fops->release)
- r = real_fops->release(inode, filp);
+ r = real_fops->release(inode, file);
fops_put(real_fops);
return r;
@@ -517,9 +506,9 @@ static int full_proxy_open_short(struct inode *inode, struct file *filp)
const struct file_operations debugfs_full_short_proxy_file_operations = {
.open = full_proxy_open_short,
- .llseek = full_proxy_llseek,
- .read = full_proxy_read,
- .write = full_proxy_write,
+ .llseek = short_proxy_llseek,
+ .read = short_proxy_read,
+ .write = short_proxy_write,
};
ssize_t debugfs_attr_read(struct file *file, char __user *buf,
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index fa2568b4380d..a420152105d0 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -162,7 +162,6 @@ void debugfs_remove(struct dentry *dentry);
void debugfs_lookup_and_remove(const char *name, struct dentry *parent);
-const struct file_operations *debugfs_real_fops(const struct file *filp);
const void *debugfs_get_aux(const struct file *file);
int debugfs_file_get(struct dentry *dentry);
@@ -329,7 +328,6 @@ static inline void debugfs_lookup_and_remove(const char *name,
struct dentry *parent)
{ }
-const struct file_operations *debugfs_real_fops(const struct file *filp);
void *debugfs_get_aux(const struct file *file);
static inline int debugfs_file_get(struct dentry *dentry)
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 08/11] fix tt_command_write()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (5 preceding siblings ...)
2025-07-02 21:24 ` [PATCH 07/11] debugfs: split short and full proxy wrappers, kill debugfs_real_fops() Al Viro
@ 2025-07-02 21:25 ` Al Viro
2025-07-03 11:14 ` Rafael J. Wysocki
2025-07-02 21:26 ` [PATCH 09/11] debugfs_get_aux(): allow storing non-const void * Al Viro
` (4 subsequent siblings)
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:25 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, linux-pm
1) unbalanced debugfs_file_get(). Not needed in the first place -
file_operations are accessed only via debugfs_create_file(), so
debugfs wrappers will take care of that itself.
2) kmalloc() for a buffer used only for duration of a function is not
a problem, but for a buffer no longer than 16 bytes?
3) strstr() is for finding substrings; for finding a character there's
strchr().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/thermal/testing/command.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/thermal/testing/command.c b/drivers/thermal/testing/command.c
index ba11d70e8021..1159ecea57e7 100644
--- a/drivers/thermal/testing/command.c
+++ b/drivers/thermal/testing/command.c
@@ -139,31 +139,21 @@ static int tt_command_exec(int index, const char *arg)
return ret;
}
-static ssize_t tt_command_process(struct dentry *dentry, const char __user *user_buf,
- size_t count)
+static ssize_t tt_command_process(char *s)
{
- char *buf __free(kfree);
char *arg;
int i;
- buf = kmalloc(count + 1, GFP_KERNEL);
- if (!buf)
- return -ENOMEM;
+ strim(s);
- if (copy_from_user(buf, user_buf, count))
- return -EFAULT;
-
- buf[count] = '\0';
- strim(buf);
-
- arg = strstr(buf, ":");
+ arg = strchr(s, ':');
if (arg) {
*arg = '\0';
arg++;
}
for (i = 0; i < ARRAY_SIZE(tt_command_strings); i++) {
- if (!strcmp(buf, tt_command_strings[i]))
+ if (!strcmp(s, tt_command_strings[i]))
return tt_command_exec(i, arg);
}
@@ -173,20 +163,20 @@ static ssize_t tt_command_process(struct dentry *dentry, const char __user *user
static ssize_t tt_command_write(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
- struct dentry *dentry = file->f_path.dentry;
+ char buf[TT_COMMAND_SIZE];
ssize_t ret;
if (*ppos)
return -EINVAL;
- if (count + 1 > TT_COMMAND_SIZE)
+ if (count > TT_COMMAND_SIZE - 1)
return -E2BIG;
- ret = debugfs_file_get(dentry);
- if (unlikely(ret))
- return ret;
+ if (copy_from_user(buf, user_buf, count))
+ return -EFAULT;
+ buf[count] = '\0';
- ret = tt_command_process(dentry, user_buf, count);
+ ret = tt_command_process(buf);
if (ret)
return ret;
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH 08/11] fix tt_command_write()
2025-07-02 21:25 ` [PATCH 08/11] fix tt_command_write() Al Viro
@ 2025-07-03 11:14 ` Rafael J. Wysocki
0 siblings, 0 replies; 36+ messages in thread
From: Rafael J. Wysocki @ 2025-07-03 11:14 UTC (permalink / raw)
To: Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel, linux-pm
On Wed, Jul 2, 2025 at 11:25 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> 1) unbalanced debugfs_file_get(). Not needed in the first place -
> file_operations are accessed only via debugfs_create_file(), so
> debugfs wrappers will take care of that itself.
>
> 2) kmalloc() for a buffer used only for duration of a function is not
> a problem, but for a buffer no longer than 16 bytes?
>
> 3) strstr() is for finding substrings; for finding a character there's
> strchr().
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Or do you want me to apply this?
> ---
> drivers/thermal/testing/command.c | 30 ++++++++++--------------------
> 1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/thermal/testing/command.c b/drivers/thermal/testing/command.c
> index ba11d70e8021..1159ecea57e7 100644
> --- a/drivers/thermal/testing/command.c
> +++ b/drivers/thermal/testing/command.c
> @@ -139,31 +139,21 @@ static int tt_command_exec(int index, const char *arg)
> return ret;
> }
>
> -static ssize_t tt_command_process(struct dentry *dentry, const char __user *user_buf,
> - size_t count)
> +static ssize_t tt_command_process(char *s)
> {
> - char *buf __free(kfree);
> char *arg;
> int i;
>
> - buf = kmalloc(count + 1, GFP_KERNEL);
> - if (!buf)
> - return -ENOMEM;
> + strim(s);
>
> - if (copy_from_user(buf, user_buf, count))
> - return -EFAULT;
> -
> - buf[count] = '\0';
> - strim(buf);
> -
> - arg = strstr(buf, ":");
> + arg = strchr(s, ':');
> if (arg) {
> *arg = '\0';
> arg++;
> }
>
> for (i = 0; i < ARRAY_SIZE(tt_command_strings); i++) {
> - if (!strcmp(buf, tt_command_strings[i]))
> + if (!strcmp(s, tt_command_strings[i]))
> return tt_command_exec(i, arg);
> }
>
> @@ -173,20 +163,20 @@ static ssize_t tt_command_process(struct dentry *dentry, const char __user *user
> static ssize_t tt_command_write(struct file *file, const char __user *user_buf,
> size_t count, loff_t *ppos)
> {
> - struct dentry *dentry = file->f_path.dentry;
> + char buf[TT_COMMAND_SIZE];
> ssize_t ret;
>
> if (*ppos)
> return -EINVAL;
>
> - if (count + 1 > TT_COMMAND_SIZE)
> + if (count > TT_COMMAND_SIZE - 1)
> return -E2BIG;
>
> - ret = debugfs_file_get(dentry);
> - if (unlikely(ret))
> - return ret;
> + if (copy_from_user(buf, user_buf, count))
> + return -EFAULT;
> + buf[count] = '\0';
>
> - ret = tt_command_process(dentry, user_buf, count);
> + ret = tt_command_process(buf);
> if (ret)
> return ret;
>
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 09/11] debugfs_get_aux(): allow storing non-const void *
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (6 preceding siblings ...)
2025-07-02 21:25 ` [PATCH 08/11] fix tt_command_write() Al Viro
@ 2025-07-02 21:26 ` Al Viro
2025-07-02 21:28 ` [PATCH 10/11] blk-mq-debugfs: use debugfs_get_aux() Al Viro
` (3 subsequent siblings)
11 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:26 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel
typechecking is up to users, anyway...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/staging/greybus/camera.c | 2 +-
fs/debugfs/file.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/debugfs/internal.h | 2 +-
include/linux/debugfs.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index ec9fddfc0b14..5ac19c0055d9 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -1128,7 +1128,7 @@ static ssize_t gb_camera_debugfs_write(struct file *file,
static int gb_camera_debugfs_open(struct inode *inode, struct file *file)
{
- file->private_data = (void *)debugfs_get_aux(file);
+ file->private_data = debugfs_get_aux(file);
return 0;
}
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 77784091a10f..3ec3324c2060 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -47,7 +47,7 @@ const struct file_operations debugfs_noop_file_operations = {
#define F_DENTRY(filp) ((filp)->f_path.dentry)
-const void *debugfs_get_aux(const struct file *file)
+void *debugfs_get_aux(const struct file *file)
{
return DEBUGFS_I(file_inode(file))->aux;
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 30c4944e1862..43e5d1bf1f32 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -459,7 +459,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
proxy_fops = &debugfs_noop_file_operations;
inode->i_fop = proxy_fops;
DEBUGFS_I(inode)->raw = real_fops;
- DEBUGFS_I(inode)->aux = aux;
+ DEBUGFS_I(inode)->aux = (void *)aux;
d_instantiate(dentry, inode);
fsnotify_create(d_inode(dentry->d_parent), dentry);
diff --git a/fs/debugfs/internal.h b/fs/debugfs/internal.h
index 93483fe84425..427987f81571 100644
--- a/fs/debugfs/internal.h
+++ b/fs/debugfs/internal.h
@@ -19,7 +19,7 @@ struct debugfs_inode_info {
const struct debugfs_short_fops *short_fops;
debugfs_automount_t automount;
};
- const void *aux;
+ void *aux;
};
static inline struct debugfs_inode_info *DEBUGFS_I(struct inode *inode)
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index a420152105d0..7cecda29447e 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -162,7 +162,7 @@ void debugfs_remove(struct dentry *dentry);
void debugfs_lookup_and_remove(const char *name, struct dentry *parent);
-const void *debugfs_get_aux(const struct file *file);
+void *debugfs_get_aux(const struct file *file);
int debugfs_file_get(struct dentry *dentry);
void debugfs_file_put(struct dentry *dentry);
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 10/11] blk-mq-debugfs: use debugfs_get_aux()
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (7 preceding siblings ...)
2025-07-02 21:26 ` [PATCH 09/11] debugfs_get_aux(): allow storing non-const void * Al Viro
@ 2025-07-02 21:28 ` Al Viro
2025-07-02 21:29 ` [PATCH 11/11] lpfc: don't use file->f_path.dentry for comparisons Al Viro
` (2 subsequent siblings)
11 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:28 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, linux-block
instead of manually stashing the data pointer into parent directory inode's
->i_private, just pass it to debugfs_create_file_aux() so that it can
be extracted without that insane chasing through ->d_parent.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
block/blk-mq-debugfs.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 29b3540dd180..7ed3e71f2fc0 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -521,7 +521,7 @@ CTX_RQ_SEQ_OPS(poll, HCTX_TYPE_POLL);
static int blk_mq_debugfs_show(struct seq_file *m, void *v)
{
const struct blk_mq_debugfs_attr *attr = m->private;
- void *data = d_inode(m->file->f_path.dentry->d_parent)->i_private;
+ void *data = debugfs_get_aux(m->file);
return attr->show(data, m);
}
@@ -531,7 +531,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
{
struct seq_file *m = file->private_data;
const struct blk_mq_debugfs_attr *attr = m->private;
- void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
+ void *data = debugfs_get_aux(file);
/*
* Attributes that only implement .seq_ops are read-only and 'attr' is
@@ -546,7 +546,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
static int blk_mq_debugfs_open(struct inode *inode, struct file *file)
{
const struct blk_mq_debugfs_attr *attr = inode->i_private;
- void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
+ void *data = debugfs_get_aux(file);
struct seq_file *m;
int ret;
@@ -612,11 +612,9 @@ static void debugfs_create_files(struct dentry *parent, void *data,
if (IS_ERR_OR_NULL(parent))
return;
- d_inode(parent)->i_private = data;
-
for (; attr->name; attr++)
- debugfs_create_file(attr->name, attr->mode, parent,
- (void *)attr, &blk_mq_debugfs_fops);
+ debugfs_create_file_aux(attr->name, attr->mode, parent,
+ (void *)attr, data, &blk_mq_debugfs_fops);
}
void blk_mq_debugfs_register(struct request_queue *q)
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 11/11] lpfc: don't use file->f_path.dentry for comparisons
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (8 preceding siblings ...)
2025-07-02 21:28 ` [PATCH 10/11] blk-mq-debugfs: use debugfs_get_aux() Al Viro
@ 2025-07-02 21:29 ` Al Viro
[not found] ` <b3ff59d4-c6c3-4b48-97e3-d32e98c12de7@broadcom.com>
2025-07-02 23:19 ` (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Jens Axboe
2025-07-04 15:34 ` Mark Brown
11 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2025-07-02 21:29 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-fsdevel, James Smart
If you want a home-grown switch, at least use enum for selector...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/scsi/lpfc/lpfc_debugfs.c | 99 ++++++++++++++++----------------
1 file changed, 51 insertions(+), 48 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 3fd1aa5cc78c..55ff030ca6cd 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -2371,36 +2371,48 @@ lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file)
return rc;
}
+enum {
+ writeGuard = 1,
+ writeApp,
+ writeRef,
+ readGuard,
+ readApp,
+ readRef,
+ InjErrLBA,
+ InjErrNPortID,
+ InjErrWWPN,
+};
+
static ssize_t
lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
size_t nbytes, loff_t *ppos)
{
- struct dentry *dent = file->f_path.dentry;
struct lpfc_hba *phba = file->private_data;
+ int kind = debugfs_get_aux_num(file);
char cbuf[32];
uint64_t tmp = 0;
int cnt = 0;
- if (dent == phba->debug_writeGuard)
+ if (kind == writeGuard)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt);
- else if (dent == phba->debug_writeApp)
+ else if (kind == writeApp)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt);
- else if (dent == phba->debug_writeRef)
+ else if (kind == writeRef)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt);
- else if (dent == phba->debug_readGuard)
+ else if (kind == readGuard)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt);
- else if (dent == phba->debug_readApp)
+ else if (kind == readApp)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt);
- else if (dent == phba->debug_readRef)
+ else if (kind == readRef)
cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt);
- else if (dent == phba->debug_InjErrNPortID)
+ else if (kind == InjErrNPortID)
cnt = scnprintf(cbuf, 32, "0x%06x\n",
phba->lpfc_injerr_nportid);
- else if (dent == phba->debug_InjErrWWPN) {
+ else if (kind == InjErrWWPN) {
memcpy(&tmp, &phba->lpfc_injerr_wwpn, sizeof(struct lpfc_name));
tmp = cpu_to_be64(tmp);
cnt = scnprintf(cbuf, 32, "0x%016llx\n", tmp);
- } else if (dent == phba->debug_InjErrLBA) {
+ } else if (kind == InjErrLBA) {
if (phba->lpfc_injerr_lba == (sector_t)(-1))
cnt = scnprintf(cbuf, 32, "off\n");
else
@@ -2417,8 +2429,8 @@ static ssize_t
lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
size_t nbytes, loff_t *ppos)
{
- struct dentry *dent = file->f_path.dentry;
struct lpfc_hba *phba = file->private_data;
+ int kind = debugfs_get_aux_num(file);
char dstbuf[33];
uint64_t tmp = 0;
int size;
@@ -2428,7 +2440,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
if (copy_from_user(dstbuf, buf, size))
return -EFAULT;
- if (dent == phba->debug_InjErrLBA) {
+ if (kind == InjErrLBA) {
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
(dstbuf[2] == 'f'))
tmp = (uint64_t)(-1);
@@ -2437,23 +2449,23 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
return -EINVAL;
- if (dent == phba->debug_writeGuard)
+ if (kind == writeGuard)
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_writeApp)
+ else if (kind == writeApp)
phba->lpfc_injerr_wapp_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_writeRef)
+ else if (kind == writeRef)
phba->lpfc_injerr_wref_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_readGuard)
+ else if (kind == readGuard)
phba->lpfc_injerr_rgrd_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_readApp)
+ else if (kind == readApp)
phba->lpfc_injerr_rapp_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_readRef)
+ else if (kind == readRef)
phba->lpfc_injerr_rref_cnt = (uint32_t)tmp;
- else if (dent == phba->debug_InjErrLBA)
+ else if (kind == InjErrLBA)
phba->lpfc_injerr_lba = (sector_t)tmp;
- else if (dent == phba->debug_InjErrNPortID)
+ else if (kind == InjErrNPortID)
phba->lpfc_injerr_nportid = (uint32_t)(tmp & Mask_DID);
- else if (dent == phba->debug_InjErrWWPN) {
+ else if (kind == InjErrWWPN) {
tmp = cpu_to_be64(tmp);
memcpy(&phba->lpfc_injerr_wwpn, &tmp, sizeof(struct lpfc_name));
} else
@@ -6160,60 +6172,51 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
phba->debug_dumpHostSlim = NULL;
/* Setup DIF Error Injections */
- snprintf(name, sizeof(name), "InjErrLBA");
phba->debug_InjErrLBA =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("InjErrLBA", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, InjErrLBA, &lpfc_debugfs_op_dif_err);
phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF;
- snprintf(name, sizeof(name), "InjErrNPortID");
phba->debug_InjErrNPortID =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("InjErrNPortID", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, InjErrNPortID, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "InjErrWWPN");
phba->debug_InjErrWWPN =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("InjErrWWPN", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, InjErrWWPN, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "writeGuardInjErr");
phba->debug_writeGuard =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("writeGuardInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, writeGuard, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "writeAppInjErr");
phba->debug_writeApp =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("writeAppInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, writeApp, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "writeRefInjErr");
phba->debug_writeRef =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("writeRefInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, writeRef, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "readGuardInjErr");
phba->debug_readGuard =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("readGuardInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, readGuard, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "readAppInjErr");
phba->debug_readApp =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("readAppInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, readApp, &lpfc_debugfs_op_dif_err);
- snprintf(name, sizeof(name), "readRefInjErr");
phba->debug_readRef =
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+ debugfs_create_file_aux_num("readRefInjErr", 0644,
phba->hba_debugfs_root,
- phba, &lpfc_debugfs_op_dif_err);
+ phba, readRef, &lpfc_debugfs_op_dif_err);
/* Setup slow ring trace */
if (lpfc_debugfs_max_slow_ring_trc) {
--
2.39.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (9 preceding siblings ...)
2025-07-02 21:29 ` [PATCH 11/11] lpfc: don't use file->f_path.dentry for comparisons Al Viro
@ 2025-07-02 23:19 ` Jens Axboe
2025-07-03 0:23 ` Al Viro
2025-07-04 15:34 ` Mark Brown
11 siblings, 1 reply; 36+ messages in thread
From: Jens Axboe @ 2025-07-02 23:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Al Viro; +Cc: linux-fsdevel, dri-devel
On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
> When debugfs file has been created by debugfs_create_file_unsafe(),
> we do need the file_operations methods to use debugfs_file_{get,put}()
> to prevent concurrent removal; for files created by debugfs_create_file()
> that is done in the wrappers that call underlying methods, so there's
> no point whatsoever duplicating that in the underlying methods themselves.
>
>
> [...]
Applied, thanks!
[10/11] blk-mq-debugfs: use debugfs_get_aux()
commit: c25885fc939f29200cccb58ffdb920a91ec62647
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-02 23:19 ` (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Jens Axboe
@ 2025-07-03 0:23 ` Al Viro
2025-07-03 0:56 ` Jens Axboe
2025-07-03 11:37 ` Greg Kroah-Hartman
0 siblings, 2 replies; 36+ messages in thread
From: Al Viro @ 2025-07-03 0:23 UTC (permalink / raw)
To: Jens Axboe; +Cc: Greg Kroah-Hartman, linux-fsdevel, dri-devel
On Wed, Jul 02, 2025 at 05:19:12PM -0600, Jens Axboe wrote:
>
> On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
> > When debugfs file has been created by debugfs_create_file_unsafe(),
> > we do need the file_operations methods to use debugfs_file_{get,put}()
> > to prevent concurrent removal; for files created by debugfs_create_file()
> > that is done in the wrappers that call underlying methods, so there's
> > no point whatsoever duplicating that in the underlying methods themselves.
> >
> >
> > [...]
>
> Applied, thanks!
>
> [10/11] blk-mq-debugfs: use debugfs_get_aux()
> commit: c25885fc939f29200cccb58ffdb920a91ec62647
Umm... That sucker depends upon the previous commit - you'll
need to cast debugfs_get_aux() result to void * without that...
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-03 0:23 ` Al Viro
@ 2025-07-03 0:56 ` Jens Axboe
2025-07-03 11:37 ` Greg Kroah-Hartman
1 sibling, 0 replies; 36+ messages in thread
From: Jens Axboe @ 2025-07-03 0:56 UTC (permalink / raw)
To: Al Viro; +Cc: Greg Kroah-Hartman, linux-fsdevel, dri-devel
On 7/2/25 6:23 PM, Al Viro wrote:
> On Wed, Jul 02, 2025 at 05:19:12PM -0600, Jens Axboe wrote:
>>
>> On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
>>> When debugfs file has been created by debugfs_create_file_unsafe(),
>>> we do need the file_operations methods to use debugfs_file_{get,put}()
>>> to prevent concurrent removal; for files created by debugfs_create_file()
>>> that is done in the wrappers that call underlying methods, so there's
>>> no point whatsoever duplicating that in the underlying methods themselves.
>>>
>>>
>>> [...]
>>
>> Applied, thanks!
>>
>> [10/11] blk-mq-debugfs: use debugfs_get_aux()
>> commit: c25885fc939f29200cccb58ffdb920a91ec62647
>
> Umm... That sucker depends upon the previous commit - you'll
> need to cast debugfs_get_aux() result to void * without that...
Gah ok - wasn't cleear since I wasn't CC'ed on the series, just the
single patch. If it's a single patch, I'm assuming it's good to go
if it looks good.
I'll just drop it.
--
Jens Axboe
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-03 0:23 ` Al Viro
2025-07-03 0:56 ` Jens Axboe
@ 2025-07-03 11:37 ` Greg Kroah-Hartman
2025-07-03 15:10 ` Al Viro
1 sibling, 1 reply; 36+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-03 11:37 UTC (permalink / raw)
To: Al Viro; +Cc: Jens Axboe, linux-fsdevel, dri-devel
On Thu, Jul 03, 2025 at 01:23:29AM +0100, Al Viro wrote:
> On Wed, Jul 02, 2025 at 05:19:12PM -0600, Jens Axboe wrote:
> >
> > On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
> > > When debugfs file has been created by debugfs_create_file_unsafe(),
> > > we do need the file_operations methods to use debugfs_file_{get,put}()
> > > to prevent concurrent removal; for files created by debugfs_create_file()
> > > that is done in the wrappers that call underlying methods, so there's
> > > no point whatsoever duplicating that in the underlying methods themselves.
> > >
> > >
> > > [...]
> >
> > Applied, thanks!
> >
> > [10/11] blk-mq-debugfs: use debugfs_get_aux()
> > commit: c25885fc939f29200cccb58ffdb920a91ec62647
>
> Umm... That sucker depends upon the previous commit - you'll
> need to cast debugfs_get_aux() result to void * without that...
Wait, what "previous commit" this is patch 01/11 of the series?
I'm all for you just taking this through your trees if it depends on
something else that is there, but that wasn't obvious, sorry.
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-03 11:37 ` Greg Kroah-Hartman
@ 2025-07-03 15:10 ` Al Viro
0 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2025-07-03 15:10 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jens Axboe, linux-fsdevel, dri-devel
On Thu, Jul 03, 2025 at 01:37:58PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Jul 03, 2025 at 01:23:29AM +0100, Al Viro wrote:
> > On Wed, Jul 02, 2025 at 05:19:12PM -0600, Jens Axboe wrote:
> > >
> > > On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
> > > > When debugfs file has been created by debugfs_create_file_unsafe(),
> > > > we do need the file_operations methods to use debugfs_file_{get,put}()
> > > > to prevent concurrent removal; for files created by debugfs_create_file()
> > > > that is done in the wrappers that call underlying methods, so there's
> > > > no point whatsoever duplicating that in the underlying methods themselves.
> > > >
> > > >
> > > > [...]
> > >
> > > Applied, thanks!
> > >
> > > [10/11] blk-mq-debugfs: use debugfs_get_aux()
^^^^^
> > > commit: c25885fc939f29200cccb58ffdb920a91ec62647
> >
> > Umm... That sucker depends upon the previous commit - you'll
> > need to cast debugfs_get_aux() result to void * without that...
>
> Wait, what "previous commit" this is patch 01/11 of the series?
Jens replied to 01/11 saying that he'd grabbed 10/11, unfortunately
without 09/11...
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops
2025-07-02 21:14 ` [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Al Viro
` (10 preceding siblings ...)
2025-07-02 23:19 ` (subset) [PATCH 01/11] zynqmp: don't bother with debugfs_file_{get,put}() in proxied fops Jens Axboe
@ 2025-07-04 15:34 ` Mark Brown
11 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2025-07-04 15:34 UTC (permalink / raw)
To: Greg Kroah-Hartman, Al Viro; +Cc: linux-fsdevel, dri-devel
On Wed, 02 Jul 2025 22:14:08 +0100, Al Viro wrote:
> When debugfs file has been created by debugfs_create_file_unsafe(),
> we do need the file_operations methods to use debugfs_file_{get,put}()
> to prevent concurrent removal; for files created by debugfs_create_file()
> that is done in the wrappers that call underlying methods, so there's
> no point whatsoever duplicating that in the underlying methods themselves.
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[03/11] regmap: get rid of redundant debugfs_file_{get,put}()
commit: 9f711c9321cffe3e03709176873c277fa911c366
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 36+ messages in thread