cifs: print warning when conflicting soft vs. hard mount options specified
authorSteve French <stfrench@microsoft.com>
Sun, 11 Dec 2022 20:44:31 +0000 (14:44 -0600)
committerSteve French <stfrench@microsoft.com>
Mon, 12 Dec 2022 19:08:22 +0000 (13:08 -0600)
If the user specifies conflicting hard vs. soft mount options
(or nosoft vs. nohard) print a warning to dmesg

We were missing a warning when a user e.g. mounted with both
"hard,soft" mount options.

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/fs_context.c

index 45119597c7655b60150011145b13e00f12e4f270..2c92a821e02849937caa93ebe855d07cd1622a76 100644 (file)
@@ -884,16 +884,21 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                ctx->nodfs = 1;
                break;
        case Opt_hard:
-               if (result.negated)
+               if (result.negated) {
+                       if (ctx->retry == 1)
+                               cifs_dbg(VFS, "conflicting hard vs. soft mount options\n");
                        ctx->retry = 0;
-               else
+               else
                        ctx->retry = 1;
                break;
        case Opt_soft:
                if (result.negated)
                        ctx->retry = 1;
-               else
+               else {
+                       if (ctx->retry == 1)
+                               cifs_dbg(VFS, "conflicting hard vs soft mount options\n");
                        ctx->retry = 0;
+               }
                break;
        case Opt_mapposix:
                if (result.negated)