[patch v3] fuse: clean up fuse_lookup_name()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We check for !outarg->nodeid twice.  The first time we return success
and the next time (which is dead code) we return -EIO.  The correct
return is the current success return and we should delete the dead code.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
I sent this patch last year, but the first time I changed the function
to return -EIO, then in the second patch I messed up so that if
fuse_valid_type() was false then we still returned success.  But
hopefully version 3 is correct.

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index b3ebe512d64c..6277af3e9c45 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -321,13 +321,14 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name
 
 	fuse_lookup_init(fc, &args, nodeid, name, outarg);
 	err = fuse_simple_request(fc, &args);
-	/* Zero nodeid is same as -ENOENT, but with valid timeout */
-	if (err || !outarg->nodeid)
+	if (err)
 		goto out_put_forget;
 
-	err = -EIO;
+	/* Zero nodeid is same as -ENOENT, but with valid timeout */
 	if (!outarg->nodeid)
 		goto out_put_forget;
+
+	err = -EIO;
 	if (!fuse_valid_type(outarg->attr.mode))
 		goto out_put_forget;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux