Commit 987564c2 authored by Paulo Alcantara (SUSE)'s avatar Paulo Alcantara (SUSE) Committed by Greg Kroah-Hartman

cifs: Properly handle auto disabling of serverino option

[ Upstream commit 29fbeb7a ]

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: default avatarPaulo Alcantara (SUSE) <paulo@paulo.ac>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Reviewed-by: default avatarPavel Shilovsky <pshilove@microsoft.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d85e830d
...@@ -72,5 +72,10 @@ struct cifs_sb_info { ...@@ -72,5 +72,10 @@ struct cifs_sb_info {
struct delayed_work prune_tlinks; struct delayed_work prune_tlinks;
struct rcu_head rcu; struct rcu_head rcu;
char *prepath; 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 */ #endif /* _CIFS_FS_SB_H */
...@@ -3247,12 +3247,16 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) ...@@ -3247,12 +3247,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 *old = CIFS_SB(sb);
struct cifs_sb_info *new = mnt_data->cifs_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)) if ((sb->s_flags & CIFS_MS_MASK) != (mnt_data->flags & CIFS_MS_MASK))
return 0; return 0;
if ((old->mnt_cifs_flags & CIFS_MOUNT_MASK) != if (old->mnt_cifs_serverino_autodisabled)
(new->mnt_cifs_flags & CIFS_MOUNT_MASK)) newflags &= ~CIFS_MOUNT_SERVER_INUM;
if (oldflags != newflags)
return 0; return 0;
/* /*
......
...@@ -523,6 +523,7 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb) ...@@ -523,6 +523,7 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
{ {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
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_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); cifs_sb_master_tcon(cifs_sb)->treeName);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment