Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] exportfs: fix error handling in expfs.c
@ 2026-05-19  1:01 Yi Xie
  2026-05-19  6:30 ` Christoph Hellwig
  2026-07-10  7:51 ` Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: Yi Xie @ 2026-05-19  1:01 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Chuck Lever, Jeff Layton, Yi Xie

dentry_open() and fh_to_parent() were calling PTR_ERR() before
checking IS_ERR().  Drop the redundant sched.h include too, cred.h
already pulls it in.

Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
 fs/exportfs/expfs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index fbd45e7ae706..e2c5fe252606 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -15,7 +15,6 @@
 #include <linux/module.h>
 #include <linux/mount.h>
 #include <linux/namei.h>
-#include <linux/sched.h>
 #include <linux/cred.h>
 
 #define dprintk(fmt, args...) pr_debug(fmt, ##args)
@@ -310,9 +309,10 @@ static int get_name(const struct path *path, char *name, struct dentry *child)
 	 * Open the directory ...
 	 */
 	file = dentry_open(path, O_RDONLY, cred);
-	error = PTR_ERR(file);
-	if (IS_ERR(file))
+	if (IS_ERR(file)) {
+		error = PTR_ERR(file);
 		goto out;
+	}
 
 	error = -EINVAL;
 	if (!file->f_op->iterate_shared)
@@ -524,9 +524,10 @@ exportfs_decode_fh_raw(struct vfsmount *mnt, struct fid *fid, int fh_len,
 				fh_len, fileid_type);
 		if (!target_dir)
 			goto err_result;
-		err = PTR_ERR(target_dir);
-		if (IS_ERR(target_dir))
+		if (IS_ERR(target_dir)) {
+			err = PTR_ERR(target_dir);
 			goto err_result;
+		}
 
 		/*
 		 * And as usual we need to make sure the parent directory is
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] exportfs: fix error handling in expfs.c
  2026-05-19  1:01 [PATCH] exportfs: fix error handling in expfs.c Yi Xie
@ 2026-05-19  6:30 ` Christoph Hellwig
  2026-07-10  7:51 ` Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-05-19  6:30 UTC (permalink / raw)
  To: Yi Xie; +Cc: linux-fsdevel, Chuck Lever, Jeff Layton

On Tue, May 19, 2026 at 09:01:40AM +0800, Yi Xie wrote:
> dentry_open() and fh_to_parent() were calling PTR_ERR() before
> checking IS_ERR().

Calling PTR_ERR before IS_ERR is perfectly fine as long as the result
in only used when IS_ERR is true.

> Drop the redundant sched.h include too, cred.h
> already pulls it in.

And this has nothing to do with the rest.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exportfs: fix error handling in expfs.c
  2026-05-19  1:01 [PATCH] exportfs: fix error handling in expfs.c Yi Xie
  2026-05-19  6:30 ` Christoph Hellwig
@ 2026-07-10  7:51 ` Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-07-10  7:51 UTC (permalink / raw)
  To: Yi Xie, linux-fsdevel; +Cc: LKML, Chuck Lever, Jeff Layton

> dentry_open() and fh_to_parent() were calling PTR_ERR() before
> checking IS_ERR().  Drop the redundant sched.h include too, cred.h
> already pulls it in.

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2-rc2#n81

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-10  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  1:01 [PATCH] exportfs: fix error handling in expfs.c Yi Xie
2026-05-19  6:30 ` Christoph Hellwig
2026-07-10  7:51 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox