Skip to contentSkip to conversation

cifs: remove redundant test in cifs_lookup() and cifs_do_rename()

PATCH In review Roel Kluin 1 participant 2 messages Jan 9, 2010 – Jan 11, 2010 1 message not in the archive

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 cifs: remove redundant test in cifs_lookup() and cifs_do_rename()

rc != -EOPNOTSUPP is true as well if rc is -EINVAL.

---
 fs/cifs/dir.c   |    2 +-
 fs/cifs/inode.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Or maybe there is ==/!= or &&/|| confusion?

fs/cifs/dir.c +1 -1
index 6ccf726..f5cfdd6 100644
@@ -690,7 +690,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 			 */
 			if ((rc == 0) || (rc == -ENOENT))
 				posix_open = true;
-			else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP))
+			else if (rc != -EOPNOTSUPP)
 				pTcon->broken_posix_open = true;
 		}
 		if (!posix_open)
fs/cifs/inode.c +1 -1
index cf18ee7..aec2928 100644
@@ -1264,7 +1264,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
 	 * source Note that cross directory moves do not work with
 	 * rename by filehandle to various Windows servers.
 	 */
-	if (rc == 0 || rc != -ETXTBSY)
+	if (rc != -ETXTBSY)
 		return rc;
 
 	/* open the file to be renamed -- we need DELETE perms */

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

rc != -EOPNOTSUPP is true as well if rc is -EINVAL.

---

Quoted 13 lines

At first glance this looks like a typo (probably not a serious one, but worth fixing)

- else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP))

looks like it should be:

+ else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP))

Signature · 3 lines
Thanks,

Steve

Yes, according to the comment it appears you're right.

Thanks

fs/cifs/dir.c +1 -1
index 6ccf726..33a7427 100644
@@ -690,7 +690,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 			 */
 			if ((rc == 0) || (rc == -ENOENT))
 				posix_open = true;
-			else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP))
+			else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP))
 				pTcon->broken_posix_open = true;
 		}
 		if (!posix_open)
fs/cifs/inode.c +1 -1
index cf18ee7..aec2928 100644
@@ -1264,7 +1264,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
 	 * source Note that cross directory moves do not work with
 	 * rename by filehandle to various Windows servers.
 	 */
-	if (rc == 0 || rc != -ETXTBSY)
+	if (rc != -ETXTBSY)
 		return rc;
 
 	/* open the file to be renamed -- we need DELETE perms */