Commit 4fc3a433 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French
Browse files

smb: client: use atomic_t for mnt_cifs_flags



Use atomic_t for cifs_sb_info::mnt_cifs_flags as it's currently
accessed locklessly and may be changed concurrently in mount/remount
and reconnect paths.

Signed-off-by: default avatarPaulo Alcantara (Red Hat) <pc@manguebit.org>
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 663c2846
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ static const char *path_no_prefix(struct cifs_sb_info *cifs_sb,
	if (!*path)
		return path;

	if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
	if ((cifs_sb_flags(cifs_sb) & CIFS_MOUNT_USE_PREFIX_PATH) &&
	    cifs_sb->prepath) {
		len = strlen(cifs_sb->prepath) + 1;
		if (unlikely(len > strlen(path)))
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ struct cifs_sb_info {
	struct nls_table *local_nls;
	struct smb3_fs_context *ctx;
	atomic_t active;
	unsigned int mnt_cifs_flags;
	atomic_t mnt_cifs_flags;
	struct delayed_work prune_tlinks;
	struct rcu_head rcu;

+0 −8
Original line number Diff line number Diff line
@@ -122,11 +122,3 @@ struct smb3_notify_info {
#define CIFS_GOING_FLAGS_DEFAULT                0x0     /* going down */
#define CIFS_GOING_FLAGS_LOGFLUSH               0x1     /* flush log but not data */
#define CIFS_GOING_FLAGS_NOLOGFLUSH             0x2     /* don't flush log nor data */

static inline bool cifs_forced_shutdown(struct cifs_sb_info *sbi)
{
	if (CIFS_MOUNT_SHUTDOWN & sbi->mnt_cifs_flags)
		return true;
	else
		return false;
}
+0 −14
Original line number Diff line number Diff line
@@ -11,20 +11,6 @@
#include "cifsglob.h"
#include "cifs_debug.h"

int cifs_remap(struct cifs_sb_info *cifs_sb)
{
	int map_type;

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
		map_type = SFM_MAP_UNI_RSVD;
	else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
		map_type = SFU_MAP_UNI_RSVD;
	else
		map_type = NO_MAP_UNI_RSVD;

	return map_type;
}

/* Convert character using the SFU - "Services for Unix" remapping range */
static bool
convert_sfu_char(const __u16 src_char, char *target)
+13 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/types.h>
#include <linux/nls.h>
#include "../../nls/nls_ucs2_utils.h"
#include "cifsglob.h"

/*
 * Macs use an older "SFM" mapping of the symbols above. Fortunately it does
@@ -65,10 +66,21 @@ char *cifs_strndup_from_utf16(const char *src, const int maxlen,
			      const struct nls_table *codepage);
int cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
		       const struct nls_table *cp, int map_chars);
int cifs_remap(struct cifs_sb_info *cifs_sb);
__le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
			      int *utf16_len, const struct nls_table *cp,
			      int remap);
wchar_t cifs_toupper(wchar_t in);

static inline int cifs_remap(const struct cifs_sb_info *cifs_sb)
{
	unsigned int sbflags = cifs_sb_flags(cifs_sb);

	if (sbflags & CIFS_MOUNT_MAP_SFM_CHR)
		return SFM_MAP_UNI_RSVD;
	if (sbflags & CIFS_MOUNT_MAP_SPECIAL_CHR)
		return SFU_MAP_UNI_RSVD;

	return NO_MAP_UNI_RSVD;
}

#endif /* _CIFS_UNICODE_H */
Loading