Skip to contentSkip to conversation

exportfs: use pr_debug for unreachable debug statements

PATCH In review David Disseldorp 3 participants 5 messages Oct 21, 2022 – Oct 27, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exportfs: use pr_debug for unreachable debug statements

expfs.c has a bunch of dprintk statements which are unusable due to:
#define dprintk(fmt, args...) do{}while(0)
Use pr_debug so that they can be enabled dynamically. Also make some minor changes to the debug statements to fix some incorrect types, and remove __func__ which can be handled by dynamic debug separately.

---
 fs/exportfs/expfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/exportfs/expfs.c +4 -4
index c648a493faf23..3204bd33e4e8a 100644
@@ -18,7 +18,7 @@
 #include <linux/sched.h>
 #include <linux/cred.h>
 
-#define dprintk(fmt, args...) do{}while(0)
+#define dprintk(fmt, args...) pr_debug(fmt, ##args)
 
 
 static int get_name(const struct path *path, char *name, struct dentry *child);
@@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	inode_unlock(dentry->d_inode);
 
 	if (IS_ERR(parent)) {
-		dprintk("%s: get_parent of %ld failed, err %d\n",
-			__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
+		dprintk("get_parent of %lu failed, err %ld\n",
+			dentry->d_inode->i_ino, PTR_ERR(parent));
 		return parent;
 	}
 
@@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	dprintk("%s: found name: %s\n", __func__, nbuf);
 	tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
-		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
 		goto out_err;
 	}
Signature · 1 line
2.35.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · David Disseldorp

expfs.c has a bunch of dprintk statements which are unusable due to:
#define dprintk(fmt, args...) do{}while(0)
Use pr_debug so that they can be enabled dynamically. Also make some minor changes to the debug statements to fix some incorrect types, and remove __func__ which can be handled by dynamic debug separately.

Thanks,
NeilBrown

Quoted 41 lines
---
 fs/exportfs/expfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/exportfs/expfs.c +4 -4
index c648a493faf23..3204bd33e4e8a 100644
@@ -18,7 +18,7 @@
 #include <linux/sched.h>
 #include <linux/cred.h>
 
-#define dprintk(fmt, args...) do{}while(0)
+#define dprintk(fmt, args...) pr_debug(fmt, ##args)
 
 
 static int get_name(const struct path *path, char *name, struct dentry *child);
@@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	inode_unlock(dentry->d_inode);
 
 	if (IS_ERR(parent)) {
-		dprintk("%s: get_parent of %ld failed, err %d\n",
-			__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
+		dprintk("get_parent of %lu failed, err %ld\n",
+			dentry->d_inode->i_ino, PTR_ERR(parent));
 		return parent;
 	}
 
@@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	dprintk("%s: found name: %s\n", __func__, nbuf);
 	tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
-		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
 		goto out_err;
 	}
Signature · 1 line
2.35.3
#2 lore raw
Quoted 12 lines · NeilBrown
Quoted 7 lines · David Disseldorp

expfs.c has a bunch of dprintk statements which are unusable due to:
#define dprintk(fmt, args...) do{}while(0)
Use pr_debug so that they can be enabled dynamically. Also make some minor changes to the debug statements to fix some incorrect types, and remove __func__ which can be handled by dynamic debug separately.

Quoted 6 lines
Quoted 1 line

Thanks,
NeilBrown

I don't think we're the maintainers of expfs.c ?

$ scripts/get_maintainer.pl fs/exportfs/expfs.c
Christian Brauner <[email protected]> (commit_signer:2/2=100%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:2/6=33%)
Al Viro <[email protected]> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:4/6=67%)
Miklos Szeredi <[email protected]> (commit_signer:1/2=50%)
Amir Goldstein <[email protected]> (commit_signer:1/2=50%)
[email protected] (open list)

But maybe MAINTAINERS needs to be fixed. There's no entry there for fs/exportfs.

Quoted 28 lines
Quoted 28 lines

---
fs/exportfs/expfs.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
fs/exportfs/expfs.c +3 -3
index c648a493faf23..3204bd33e4e8a 100644
@@ -18,7 +18,7 @@
 #include <linux/sched.h>
 #include <linux/cred.h>
 
-#define dprintk(fmt, args...) do{}while(0)
+#define dprintk(fmt, args...) pr_debug(fmt, ##args)
 
 
 static int get_name(const struct path *path, char *name, struct dentry *child);
@@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	inode_unlock(dentry->d_inode);
 
 	if (IS_ERR(parent)) {
-		dprintk("%s: get_parent of %ld failed, err %d\n",
-			__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
+		dprintk("get_parent of %lu failed, err %ld\n",
+			dentry->d_inode->i_ino, PTR_ERR(parent));
 		return parent;
 	}
 
Quoted 13 lines
Quoted 13 lines
fs/exportfs/expfs.c +1 -1
@@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	dprintk("%s: found name: %s\n", __func__, nbuf);
 	tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
-		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
 		goto out_err;
 	}
Signature · 1 line
2.35.3

--
Chuck Lever

#3 lore raw
Quoted 27 lines · Chuck Lever III
Quoted 11 lines · NeilBrown
Quoted 7 lines · David Disseldorp

expfs.c has a bunch of dprintk statements which are unusable due to:
#define dprintk(fmt, args...) do{}while(0)
Use pr_debug so that they can be enabled dynamically. Also make some minor changes to the debug statements to fix some incorrect types, and remove __func__ which can be handled by dynamic debug separately.

Quoted 6 lines
Quoted 1 line

Thanks,
NeilBrown

I don't think we're the maintainers of expfs.c ?

$ scripts/get_maintainer.pl fs/exportfs/expfs.c
Christian Brauner <[email protected]> (commit_signer:2/2=100%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:2/6=33%)
Al Viro <[email protected]> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:4/6=67%)
Miklos Szeredi <[email protected]> (commit_signer:1/2=50%)
Amir Goldstein <[email protected]> (commit_signer:1/2=50%)
[email protected] (open list)
Quoted 2 lines

But maybe MAINTAINERS needs to be fixed. There's no entry there for fs/exportfs.

Looking at recent commits, patches come in through multiple different trees.
nfsd certainly has an interest in expfs.c. The only other user is name_to_handle/open_by_handle API.
I see it as primarily nfsd functionality which is useful enough to be exported directly to user-space.
(It was created by me when I was nfsd maintainer - does that count?)

So I would support the suggestion of updating MAINTAINERS to include fs/exportfs/ in the NFSD section.

Having said that - given your apparent preference of tracepoints for tracing in nfsd - I suspect you might ask for a somewhat different patch :-)

Thanks,
NeilBrown

Quoted 50 lines
Quoted 30 lines
Quoted 30 lines

---
fs/exportfs/expfs.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
fs/exportfs/expfs.c +3 -3
index c648a493faf23..3204bd33e4e8a 100644
@@ -18,7 +18,7 @@
 #include <linux/sched.h>
 #include <linux/cred.h>
 
-#define dprintk(fmt, args...) do{}while(0)
+#define dprintk(fmt, args...) pr_debug(fmt, ##args)
 
 
 static int get_name(const struct path *path, char *name, struct dentry *child);
@@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	inode_unlock(dentry->d_inode);
 
 	if (IS_ERR(parent)) {
-		dprintk("%s: get_parent of %ld failed, err %d\n",
-			__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
+		dprintk("get_parent of %lu failed, err %ld\n",
+			dentry->d_inode->i_ino, PTR_ERR(parent));
 		return parent;
 	}
 
Quoted 13 lines
Quoted 13 lines
fs/exportfs/expfs.c +1 -1
@@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	dprintk("%s: found name: %s\n", __func__, nbuf);
 	tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
-		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
 		goto out_err;
 	}
Signature · 1 line
2.35.3

--
Chuck Lever

#4 lore raw
Quoted 35 lines · NeilBrown
Quoted 27 lines · Chuck Lever III
Quoted 11 lines · NeilBrown
Quoted 7 lines · David Disseldorp

expfs.c has a bunch of dprintk statements which are unusable due to:
#define dprintk(fmt, args...) do{}while(0)
Use pr_debug so that they can be enabled dynamically. Also make some minor changes to the debug statements to fix some incorrect types, and remove __func__ which can be handled by dynamic debug separately.

Quoted 6 lines
Quoted 1 line

Thanks,
NeilBrown

I don't think we're the maintainers of expfs.c ?

$ scripts/get_maintainer.pl fs/exportfs/expfs.c
Christian Brauner <[email protected]> (commit_signer:2/2=100%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:2/6=33%)
Al Viro <[email protected]> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3/6=50%,removed_lines:4/6=67%)
Miklos Szeredi <[email protected]> (commit_signer:1/2=50%)
Amir Goldstein <[email protected]> (commit_signer:1/2=50%)
[email protected] (open list)
Quoted 2 lines

But maybe MAINTAINERS needs to be fixed. There's no entry there for fs/exportfs.

Quoted 7 lines

Looking at recent commits, patches come in through multiple different trees.
nfsd certainly has an interest in expfs.c. The only other user is name_to_handle/open_by_handle API.
I see it as primarily nfsd functionality which is useful enough to be exported directly to user-space.
(It was created by me when I was nfsd maintainer - does that count?)

I can mechanically take the patch through nfsd if no-one objects. My concern now is that it gets proper review. It's not an area I'm especially familiar with.

Quoted 2 lines

So I would support the suggestion of updating MAINTAINERS to include fs/exportfs/ in the NFSD section.

No problem with that, if my co-maintainer agrees.

Quoted 3 lines

Having said that - given your apparent preference of tracepoints for tracing in nfsd - I suspect you might ask for a somewhat different patch :-)

I've certainly had that thought, but I don't think there currently is a trace subsystem defined for exportfs.

Quoted 50 lines

Thanks,
NeilBrown

Quoted 46 lines
Quoted 30 lines
Quoted 30 lines

---
fs/exportfs/expfs.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
fs/exportfs/expfs.c +3 -3
index c648a493faf23..3204bd33e4e8a 100644
@@ -18,7 +18,7 @@
 #include <linux/sched.h>
 #include <linux/cred.h>
 
-#define dprintk(fmt, args...) do{}while(0)
+#define dprintk(fmt, args...) pr_debug(fmt, ##args)
 
 
 static int get_name(const struct path *path, char *name, struct dentry *child);
@@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	inode_unlock(dentry->d_inode);
 
 	if (IS_ERR(parent)) {
-		dprintk("%s: get_parent of %ld failed, err %d\n",
-			__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
+		dprintk("get_parent of %lu failed, err %ld\n",
+			dentry->d_inode->i_ino, PTR_ERR(parent));
 		return parent;
 	}
 
Quoted 13 lines
Quoted 13 lines
fs/exportfs/expfs.c +1 -1
@@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	dprintk("%s: found name: %s\n", __func__, nbuf);
 	tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
-		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
 		goto out_err;
 	}
Signature · 1 line
2.35.3

--
Chuck Lever

--
Chuck Lever