Skip to content

Commit 5455b9e

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: serialize all mount attempts
RHBZ: 2008434 Some servers, such as Windows2016 have a very low number of concurrent mounts that they allow from each client. This can be a problem if you have a more than a handful (==3 in this case) of cifs entries in your fstab and cause a number of the mounts there to randomly fail. Add a global mutex and use it to serialize all mount attempts. Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent a2809d0 commit 5455b9e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/cifs/fs_context.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include "rfc1002pdu.h"
3838
#include "fs_context.h"
3939

40+
static DEFINE_MUTEX(cifs_mount_mutex);
41+
4042
static const match_table_t cifs_smb_version_tokens = {
4143
{ Smb_1, SMB1_VERSION_STRING },
4244
{ Smb_20, SMB20_VERSION_STRING},
@@ -707,10 +709,14 @@ static int smb3_get_tree_common(struct fs_context *fc)
707709
static int smb3_get_tree(struct fs_context *fc)
708710
{
709711
int err = smb3_fs_context_validate(fc);
712+
int ret;
710713

711714
if (err)
712715
return err;
713-
return smb3_get_tree_common(fc);
716+
mutex_lock(&cifs_mount_mutex);
717+
ret = smb3_get_tree_common(fc);
718+
mutex_unlock(&cifs_mount_mutex);
719+
return ret;
714720
}
715721

716722
static void smb3_fs_context_free(struct fs_context *fc)

0 commit comments

Comments
 (0)