smb3: log warning if CSC policy conflicts with cache mount option
authorSteve French <stfrench@microsoft.com>
Tue, 3 Sep 2019 22:49:46 +0000 (17:49 -0500)
committerSteve French <stfrench@microsoft.com>
Mon, 16 Sep 2019 16:43:38 +0000 (11:43 -0500)
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>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
fs/cifs/connect.c

index d9a995588c7472ab07b2896531135133532809dd..85f8d943a05af7f40f8dd3646600727bf1c8ee42 100644 (file)
@@ -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