cifs: handle cifs_get_tcon() errors properly
Subsystems (2)
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
@@ -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
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.
Signed-off-by Suresh Jayaraman <[email protected]>--- fs/cifs/connect.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)fs/cifs/connect.c +0
-0@@ -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
-1rc =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
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.
Signed-off-by Suresh Jayaraman <[email protected]>--- fs/cifs/connect.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)fs/cifs/connect.c +4
-1@@ -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
@@ -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]
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.
Signed-off-by Suresh Jayaraman <[email protected]>--- fs/cifs/connect.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)fs/cifs/connect.c +4
-1@@ -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.
Signed-off-by Suresh Jayaraman <[email protected]>---
fs/cifs/connect.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)fs/cifs/connect.c +0
-0@@ -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
-1rc =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
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.
Signed-off-by Suresh Jayaraman <[email protected]>---
fs/cifs/connect.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)fs/cifs/connect.c +4
-1@@ -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_mountis 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