linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] smb3: log warning if CSC policy conflicts with linux kernel client cache mount option
@ 2019-09-03 22:54 Steve French
  2019-09-03 23:00 ` ronnie sahlberg
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2019-09-03 22:54 UTC (permalink / raw)
  To: CIFS, samba-technical

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

If the server config (e.g. Samba smb.conf "csc policy = disable)
for the share indicates that the share should not be cached, log
a warning message in the Linux kernel client if forced client side
caching ("cache=ro" or "cache=singleclient") was requested on mount.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/connect.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d9a995588c74..85f8d943a05a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3478,6 +3478,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct
smb_vol *volume_info)
         tcon->use_resilient = true;
     }

+    /* If the user really knows what they are doing they can override */
+    if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
+        if (volume_info->cache_ro)
+            cifs_dbg(VFS, "cache=ro requested on mount but NO_CACHING
flag set on share\n");
+        else if (volume_info->cache_rw)
+            cifs_dbg(VFS, "cache=singleclient requested on mount but
NO_CACHING flag set on share\n");
+    }
+
     /*
      * We can have only one retry value for a connection to a share so for
      * resources mounted more than once to the same server share the last

-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-log-warning-if-CSC-policy-conflicts-with-cache-.patch --]
[-- Type: text/x-patch, Size: 1402 bytes --]

From dae931c02aed14427ea4022c7e8038ab3103b4d9 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 3 Sep 2019 17:49:46 -0500
Subject: [PATCH] smb3: log warning if CSC policy conflicts with cache mount
 option

If the server config (e.g. Samba smb.conf "csc policy = disable)
for the share indicates that the share should not be cached, log
a warning message if forced client side caching ("cache=ro" or
"cache=singleclient") is requested on mount.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/connect.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d9a995588c74..85f8d943a05a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3478,6 +3478,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
 		tcon->use_resilient = true;
 	}
 
+	/* If the user really knows what they are doing they can override */
+	if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
+		if (volume_info->cache_ro)
+			cifs_dbg(VFS, "cache=ro requested on mount but NO_CACHING flag set on share\n");
+		else if (volume_info->cache_rw)
+			cifs_dbg(VFS, "cache=singleclient requested on mount but NO_CACHING flag set on share\n");
+	}
+
 	/*
 	 * We can have only one retry value for a connection to a share so for
 	 * resources mounted more than once to the same server share the last
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] smb3: log warning if CSC policy conflicts with linux kernel client cache mount option
  2019-09-03 22:54 [PATCH] smb3: log warning if CSC policy conflicts with linux kernel client cache mount option Steve French
@ 2019-09-03 23:00 ` ronnie sahlberg
  0 siblings, 0 replies; 2+ messages in thread
From: ronnie sahlberg @ 2019-09-03 23:00 UTC (permalink / raw)
  To: Steve French; +Cc: CIFS, samba-technical

Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>


On Wed, Sep 4, 2019 at 8:54 AM Steve French <smfrench@gmail.com> wrote:
>
> If the server config (e.g. Samba smb.conf "csc policy = disable)
> for the share indicates that the share should not be cached, log
> a warning message in the Linux kernel client if forced client side
> caching ("cache=ro" or "cache=singleclient") was requested on mount.
>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/connect.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index d9a995588c74..85f8d943a05a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3478,6 +3478,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct
> smb_vol *volume_info)
>          tcon->use_resilient = true;
>      }
>
> +    /* If the user really knows what they are doing they can override */
> +    if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
> +        if (volume_info->cache_ro)
> +            cifs_dbg(VFS, "cache=ro requested on mount but NO_CACHING
> flag set on share\n");
> +        else if (volume_info->cache_rw)
> +            cifs_dbg(VFS, "cache=singleclient requested on mount but
> NO_CACHING flag set on share\n");
> +    }
> +
>      /*
>       * We can have only one retry value for a connection to a share so for
>       * resources mounted more than once to the same server share the last
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-03 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 22:54 [PATCH] smb3: log warning if CSC policy conflicts with linux kernel client cache mount option Steve French
2019-09-03 23:00 ` ronnie sahlberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).