]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
BugLink: https://bugs.launchpad.net/bugs/1844558
[ Upstream commit 29fbeb7a908a60a5ae8c50fbe171cb8fdcef1980 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/cifs/cifs_fs_sb.h
fs/cifs/connect.c
fs/cifs/misc.c

index 350fa55a1bf79878f9f390a3883998ce7cf198a4..6741948ab01701b37ad61eac0201caf38f95cdf2 100644 (file)
@@ -71,5 +71,10 @@ struct cifs_sb_info {
        struct delayed_work prune_tlinks;
        struct rcu_head rcu;
        char *prepath;
+       /*
+        * 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 c7059b5d9bcee66b71a8e42c8592fd13e714fe7e..da6a139ff055fec135f1ab74cd81bf8d473fdfcc 100644 (file)
@@ -3086,12 +3086,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 76f1649ab444f249f05972778a66917bcb3d695b..7d80d6f68ce8989b8f9bf0c8f5450e3508b49a33 100644 (file)
@@ -519,6 +519,7 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
 {
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
                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. This server doesn't seem to support them properly. Hardlinks will not be recognized on this mount. Consider mounting with the \"noserverino\" option to silence this message.\n",
                         cifs_sb_master_tcon(cifs_sb)->treeName);
        }