diff mbox series

[1/2] cifs: ignore ipc reconnect failures during dfs failover

Message ID 20221229153356.8221-1-pc@cjr.nz (mailing list archive)
State New, archived
Headers show
Series [1/2] cifs: ignore ipc reconnect failures during dfs failover | expand

Commit Message

Paulo Alcantara Dec. 29, 2022, 3:33 p.m. UTC
If it failed to reconnect ipc used for getting referrals, we can just
ignore it as it is not required for reconnecting the share.  The worst
case would be not being able to detect or chase nested links as long
as dfs root server is unreachable.

Before patch:

  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
    -> target share: /fs0/share

  disconnect root & fs0

  $ ls /mnt
  ls: cannot access '/mnt': Host is down

  connect fs0

  $ ls /mnt
  ls: cannot access '/mnt': Resource temporarily unavailable

After patch:

  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
    -> target share: /fs0/share

  disconnect root & fs0

  $ ls /mnt
  ls: cannot access '/mnt': Host is down

  connect fs0

  $ ls /mnt
  bar.rtf  dir1  foo

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/dfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Enzo Matsumiya Dec. 29, 2022, 8:10 p.m. UTC | #1
On 12/29, Paulo Alcantara wrote:
>If it failed to reconnect ipc used for getting referrals, we can just
>ignore it as it is not required for reconnecting the share.  The worst
>case would be not being able to detect or chase nested links as long
>as dfs root server is unreachable.
>
>Before patch:
>
>  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
>    -> target share: /fs0/share
>
>  disconnect root & fs0
>
>  $ ls /mnt
>  ls: cannot access '/mnt': Host is down
>
>  connect fs0
>
>  $ ls /mnt
>  ls: cannot access '/mnt': Resource temporarily unavailable
>
>After patch:
>
>  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
>    -> target share: /fs0/share
>
>  disconnect root & fs0
>
>  $ ls /mnt
>  ls: cannot access '/mnt': Host is down
>
>  connect fs0
>
>  $ ls /mnt
>  bar.rtf  dir1  foo
>
>Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>

Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>

>---
> fs/cifs/dfs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
>index b541e68378f6..30086f2060a1 100644
>--- a/fs/cifs/dfs.c
>+++ b/fs/cifs/dfs.c
>@@ -401,8 +401,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
> 		if (ipc->need_reconnect) {
> 			scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
> 			rc = ops->tree_connect(xid, ipc->ses, tree, ipc, cifs_sb->local_nls);
>-			if (rc)
>-				break;
>+			cifs_dbg(FYI, "%s: reconnect ipc: %d\n", __func__, rc);
> 		}
>
> 		scnprintf(tree, MAX_TREE_SIZE, "\\%s", share);
>-- 
>2.39.0
>
Steve French Jan. 4, 2023, 6:13 a.m. UTC | #2
On Wed, Jan 4, 2023 at 12:13 AM Steve French <smfrench@gmail.com> wrote:
>
> merged into cifs-2.6.git for-next
>
> On Thu, Dec 29, 2022 at 2:10 PM Enzo Matsumiya <ematsumiya@suse.de> wrote:
>>
>> On 12/29, Paulo Alcantara wrote:
>> >If it failed to reconnect ipc used for getting referrals, we can just
>> >ignore it as it is not required for reconnecting the share.  The worst
>> >case would be not being able to detect or chase nested links as long
>> >as dfs root server is unreachable.
>> >
>> >Before patch:
>> >
>> >  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
>> >    -> target share: /fs0/share
>> >
>> >  disconnect root & fs0
>> >
>> >  $ ls /mnt
>> >  ls: cannot access '/mnt': Host is down
>> >
>> >  connect fs0
>> >
>> >  $ ls /mnt
>> >  ls: cannot access '/mnt': Resource temporarily unavailable
>> >
>> >After patch:
>> >
>> >  $ mount.cifs //root/dfs/link /mnt -o echo_interval=10,...
>> >    -> target share: /fs0/share
>> >
>> >  disconnect root & fs0
>> >
>> >  $ ls /mnt
>> >  ls: cannot access '/mnt': Host is down
>> >
>> >  connect fs0
>> >
>> >  $ ls /mnt
>> >  bar.rtf  dir1  foo
>> >
>> >Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
>>
>> Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
>>
>> >---
>> > fs/cifs/dfs.c | 3 +--
>> > 1 file changed, 1 insertion(+), 2 deletions(-)
>> >
>> >diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
>> >index b541e68378f6..30086f2060a1 100644
>> >--- a/fs/cifs/dfs.c
>> >+++ b/fs/cifs/dfs.c
>> >@@ -401,8 +401,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
>> >               if (ipc->need_reconnect) {
>> >                       scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
>> >                       rc = ops->tree_connect(xid, ipc->ses, tree, ipc, cifs_sb->local_nls);
>> >-                      if (rc)
>> >-                              break;
>> >+                      cifs_dbg(FYI, "%s: reconnect ipc: %d\n", __func__, rc);
>> >               }
>> >
>> >               scnprintf(tree, MAX_TREE_SIZE, "\\%s", share);
>> >--
>> >2.39.0
>> >
>
>
>
> --
> Thanks,
>
> Steve
diff mbox series

Patch

diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
index b541e68378f6..30086f2060a1 100644
--- a/fs/cifs/dfs.c
+++ b/fs/cifs/dfs.c
@@ -401,8 +401,7 @@  static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
 		if (ipc->need_reconnect) {
 			scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
 			rc = ops->tree_connect(xid, ipc->ses, tree, ipc, cifs_sb->local_nls);
-			if (rc)
-				break;
+			cifs_dbg(FYI, "%s: reconnect ipc: %d\n", __func__, rc);
 		}
 
 		scnprintf(tree, MAX_TREE_SIZE, "\\%s", share);