cifs: Properly handle auto disabling of serverino option
authorPaulo Alcantara (SUSE) <paulo@paulo.ac>
Tue, 18 Jun 2019 19:16:02 +0000 (16:16 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 8 Jul 2019 03:37:43 +0000 (22:37 -0500)
Fix mount options comparison when serverino option is turned off later
in cifs_autodisable_serverino() and thus avoiding mismatch of new cifs
mounts.

Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (SUSE) <paulo@paulo.ac>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilove@microsoft.com>
fs/cifs/cifs_fs_sb.h
fs/cifs/connect.c
fs/cifs/misc.c

index ed49222..afa5623 100644 (file)
@@ -83,5 +83,10 @@ struct cifs_sb_info {
         * failover properly.
         */
        char *origin_fullpath; /* \\HOST\SHARE\[OPTIONAL PATH] */
+       /*
+        * Indicate whether serverino option was turned off later
+        * (cifs_autodisable_serverino) in order to match new mounts.
+        */
+       bool mnt_cifs_serverino_autodisabled;
 };
 #endif                         /* _CIFS_FS_SB_H */
index 51f2723..b8a6006 100644 (file)
@@ -3467,12 +3467,16 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
 {
        struct cifs_sb_info *old = CIFS_SB(sb);
        struct cifs_sb_info *new = mnt_data->cifs_sb;
+       unsigned int oldflags = old->mnt_cifs_flags & CIFS_MOUNT_MASK;
+       unsigned int newflags = new->mnt_cifs_flags & CIFS_MOUNT_MASK;
 
        if ((sb->s_flags & CIFS_MS_MASK) != (mnt_data->flags & CIFS_MS_MASK))
                return 0;
 
-       if ((old->mnt_cifs_flags & CIFS_MOUNT_MASK) !=
-           (new->mnt_cifs_flags & CIFS_MOUNT_MASK))
+       if (old->mnt_cifs_serverino_autodisabled)
+               newflags &= ~CIFS_MOUNT_SERVER_INUM;
+
+       if (oldflags != newflags)
                return 0;
 
        /*
index b1a696a..f383877 100644 (file)
@@ -539,6 +539,7 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
                        tcon = cifs_sb_master_tcon(cifs_sb);
 
                cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
+               cifs_sb->mnt_cifs_serverino_autodisabled = true;
                cifs_dbg(VFS, "Autodisabling the use of server inode numbers on %s.\n",
                         tcon ? tcon->treeName : "new server");
                cifs_dbg(VFS, "The server doesn't seem to support them properly or the files might be on different servers (DFS).\n");