Re: [PATCH] wait until we have the FS info from the server befor initializing fscache cookie

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

 



Updated patch to check whether would be initializing the super cookie twice

cifs

On Wed, Nov 10, 2021 at 3:20 AM Steve French <smfrench@xxxxxxxxx> wrote:
>
> With this patch now that the fscache cookie is initialized properly -
> I do see an oops on the 2nd unmount if we mount the same share twice
> ... any ideas on fixing that?
>
>
>     smb3: do not call setup the fscache_super_cookie until fsinfo initialized
>
>     We were calling cifs_fscache_get_super_cookie after tcon but before
>     we queried the info (QFS_Info) we need to initialize the cookie
>     properly.
>
>     Suggested-by: David Howells <dhowells@xxxxxxxxxx>
>     Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
>
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve
From 562713fe9b4970fbc83ffdbc1a295e5f0c7f9f10 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Wed, 10 Nov 2021 03:15:29 -0600
Subject: [PATCH] smb3: do not setup the fscache_super_cookie until fsinfo
 initialized

We were calling cifs_fscache_get_super_cookie after tcon but before
we queried the info (QFS_Info) we need to initialize the cookie
properly.  Also includes an additional check suggested by Paulo
to make sure we don't initialize super cookie twice.

Suggested-by: David Howells <dhowells@xxxxxxxxxx>
Reviewed-by: Paulo Alcantara (SUSE) <pc@xxxxxx>
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/connect.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index df3365958603..42e4d7b48e97 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2349,8 +2349,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 	list_add(&tcon->tcon_list, &ses->tcon_list);
 	spin_unlock(&cifs_tcp_ses_lock);
 
-	cifs_fscache_get_super_cookie(tcon);
-
 	return tcon;
 
 out_fail:
@@ -3002,6 +3000,13 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
 				cifs_dbg(VFS, "read only mount of RW share\n");
 			/* no need to log a RW mount of a typical RW share */
 		}
+		/*
+		 * The cookie is initialized from volume info returned above.
+		 * And we might be reusing a tcon, so need to ensure
+		 * that we do not get super cookie twice.
+		 */
+		if (!tcon->fscache)
+			cifs_fscache_get_super_cookie(tcon);
 	}
 
 	/*
-- 
2.32.0


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux