Skip to contentSkip to conversation

cifs: handle cifs_get_tcon() errors properly

PATCH In review Suresh Jayaraman 2 participants 5 messages Nov 15, 2010 4 messages not in the archive

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

PATCH 1/1 cifs: handle cifs_get_tcon() errors properly

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---
 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +4 -1
index 251a17c..c3a2323 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTEIO)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
 	/* do not care if following two calls succeed - informational */

A message that is not in the archive (sent off-list or not yet received): 1289825123-13716-1-git-send-email-sjayaraman-l3A5Bk7waGM@public.gmane.org

#2 lore raw
Quoted 18 lines · On Mon, 15 Nov 2010 18:15:23 +0530 Suresh Jayaraman…

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---
 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +0 -0
index 251a17c..c3a2323 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {

fs/cifs/connect.c try_mount_again: · line 2789

Quoted 10 lines
fs/cifs/connect.c +4 -1
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTEIO)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
 	/* do not care if following two calls succeed - informational */

Don't you mean "EREMOTE" here? I've always interpreted "EREMOTEIO" to mean that the server had the equivalent of an I/O error, whereas "EREMOTE" means "Object is remote".

I don't see how this patch materially changes anything. Pseudocode, assuming that rc == -EREMOTE:

remote_path_check:

        /* check if a whole path (including prepath) is not remote */
        if (!rc && cifs_sb->prepathlen && tcon) {
		/* stuff we won't hit because rc is non-zero */
	}

	if (rc == -EREMOTE) {
		/* handle a DFS referral */
	}

        if (rc)
                goto mount_fail_check;

I'll grant that cifs_mount is still a mess, but I'm not sure this really improves anything.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20101115082535.0d7200a5-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#4 lore raw
Quoted 30 lines · Jeff Layton
Quoted 27 lines · On Mon, 15 Nov 2010 18:15:23 +0530 Suresh Jayaraman…

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---
 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +4 -1
index 251a17c..c3a2323 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTEIO)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
Quoted 3 lines

fs/cifs/connect.c try_mount_again: · line 2789

Quoted 1 line
fs/cifs/connect.c +0 -0
 	/* do not care if following two calls succeed - informational */

Don't you mean "EREMOTE" here? I've always interpreted "EREMOTEIO" to

Doh, yes.

Quoted 5 lines

mean that the server had the equivalent of an I/O error, whereas "EREMOTE" means "Object is remote".

I don't see how this patch materially changes anything. Pseudocode, assuming that rc == -EREMOTE:

I agree that this is not an improvement (more of a cleanup), but I think it improves readability (given that the single function runs for more than hundred lines), and skips a couple of unneeded checks.

Here's a fixed version (but this patch can be ignored if we feel so):

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---

 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +4 -1
index 251a17c..6dbc145 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTE)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
 	/* do not care if following two calls succeed - informational */

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

#6 lore raw
Quoted 68 lines · On Mon, 15 Nov 2010 20:24:41 +0530 Suresh Jayaraman…
Quoted 30 lines · Jeff Layton
Quoted 27 lines · On Mon, 15 Nov 2010 18:15:23 +0530 Suresh Jayaraman…

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---
 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +4 -1
index 251a17c..c3a2323 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTEIO)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
Quoted 3 lines

fs/cifs/connect.c try_mount_again: · line 2789

Quoted 1 line
fs/cifs/connect.c +0 -0
 	/* do not care if following two calls succeed - informational */

Don't you mean "EREMOTE" here? I've always interpreted "EREMOTEIO" to

Doh, yes.

Quoted 5 lines

mean that the server had the equivalent of an I/O error, whereas "EREMOTE" means "Object is remote".

I don't see how this patch materially changes anything. Pseudocode, assuming that rc == -EREMOTE:

I agree that this is not an improvement (more of a cleanup), but I think it improves readability (given that the single function runs for more than hundred lines), and skips a couple of unneeded checks.

Here's a fixed version (but this patch can be ignored if we feel so):

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---

 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +0 -0
index 251a17c..6dbc145 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {

fs/cifs/connect.c try_mount_again: · line 2789

Quoted 10 lines
fs/cifs/connect.c +4 -1
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTE)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
 	/* do not care if following two calls succeed - informational */

I just don't the point here. cifs_mount is quite messy, but I don't think this really does much to improve its readability.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20101115102843.6f425b27-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#8 lore raw
Quoted 37 lines · Jeff Layton
Quoted 34 lines · On Mon, 15 Nov 2010 20:24:41 +0530 Suresh Jayaraman…

I agree that this is not an improvement (more of a cleanup), but I think it improves readability (given that the single function runs for more than hundred lines), and skips a couple of unneeded checks.

Here's a fixed version (but this patch can be ignored if we feel so):

cifs_get_tcon() could return any of the following errors:
-ENOMEM/-ENODEV/EREMOTEIO. We should follow the DFS referral code path only when we get -EREMOTEIO (STATUS_PATH_NOT_COVERED) from the server and not otherwise.

Compile-tested only.

---

 fs/cifs/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/cifs/connect.c +4 -1
index 251a17c..6dbc145 100644
@@ -2780,7 +2780,10 @@ try_mount_again:
 	if (IS_ERR(tcon)) {
 		rc = PTR_ERR(tcon);
 		tcon = NULL;
-		goto remote_path_check;
+		if (rc == -EREMOTE)
+			goto remote_path_check;
+		else
+			goto mount_fail_check;
 	}
 
Quoted 5 lines

fs/cifs/connect.c try_mount_again: · line 2789

Quoted 1 line
fs/cifs/connect.c +0 -0
 	/* do not care if following two calls succeed - informational */

I just don't the point here. cifs_mount is quite messy, but I don't think this really does much to improve its readability.

Ok, let's drop this patch..

Signature · 1 line
Suresh Jayaraman