diff mbox series

[SMB3] improve error message when mount options conflict with posix

Message ID CAH2r5msPYuG-jUxBkqCz5tYg80JGpnjYTVXZFzzwRKwLJxdmFw@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [SMB3] improve error message when mount options conflict with posix | expand

Commit Message

Steve French Feb. 7, 2022, 4:50 a.m. UTC
POSIX extensions require SMB3.1.1 (so improve the error
    message when vers=3.0, 2.1 or 2.0 is specified on mount)
diff mbox series

Patch

From d0cbe56a7d5ac170f6cf3757ef5a14dd854e7da9 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 6 Feb 2022 18:59:57 -0600
Subject: [PATCH] [smb3] improve error message when mount options conflict with
 posix

POSIX extensions require SMB3.1.1 (so improve the error
message when vers=3.0, 2.1 or 2.0 is specified on mount)

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

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0b742bd50642..cff6c01feae2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2340,10 +2340,19 @@  cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 		if (ses->server->posix_ext_supported) {
 			tcon->posix_extensions = true;
 			pr_warn_once("SMB3.11 POSIX Extensions are experimental\n");
-		} else {
+		} else if ((ses->server->vals->protocol_id == SMB311_PROT_ID) ||
+		    (strcmp(ses->server->vals->version_string,
+		     SMB3ANY_VERSION_STRING) == 0) ||
+		    (strcmp(ses->server->vals->version_string,
+		     SMBDEFAULT_VERSION_STRING) == 0)) {
 			cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 extensions\n");
 			rc = -EOPNOTSUPP;
 			goto out_fail;
+		} else {
+			cifs_dbg(VFS, "Check vers= mount option. SMB3.11 "
+				"disabled but required for POSIX extensions\n");
+			rc = -EOPNOTSUPP;
+			goto out_fail;
 		}
 	}
 
-- 
2.32.0