Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10f3cb41 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull cifs fixes from Steve French.

* git://git.samba.org/sfrench/cifs-2.6:
  [CIFS] Update CIFS version number to 1.77
  CIFS: Add missed forcemand mount option
  [CIFS] Fix trivial sparse warning with asyn i/o patch
  cifs: handle "sloppy" option appropriately
  cifs: use standard token parser for mount options
  cifs: remove /proc/fs/cifs/OplockEnabled
  cifs: convert cifs_iovec_write to use async writes
  cifs: call cifs_update_eof with i_lock held
  cifs: abstract out function to marshal up the iovec array for async writes
  cifs: fix up get_numpages
  cifs: make cifsFileInfo_get return the cifsFileInfo pointer
  cifs: fix allocation in cifs_write_allocate_pages
  cifs: allow caller to specify completion op when allocating writedata
  cifs: add pid field to cifs_writedata
  cifs: add new cifsiod_wq workqueue
  CIFS: Change mid_q_entry structure fields
  CIFS: Expand CurrentMid field
  CIFS: Separate protocol-specific code from cifs_readv_receive code
  CIFS: Separate protocol-specific code from demultiplex code
  CIFS: Separate protocol-specific code from transport routines
parents 919c8401 867646f2
Loading
Loading
Loading
Loading
+13 −55
Original line number Original line Diff line number Diff line
@@ -58,15 +58,16 @@ cifs_dump_mem(char *label, void *data, int length)
}
}


#ifdef CONFIG_CIFS_DEBUG2
#ifdef CONFIG_CIFS_DEBUG2
void cifs_dump_detail(struct smb_hdr *smb)
void cifs_dump_detail(void *buf)
{
{
	struct smb_hdr *smb = (struct smb_hdr *)buf;

	cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
	cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
		  smb->Command, smb->Status.CifsError,
		  smb->Command, smb->Status.CifsError,
		  smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
		  smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
	cERROR(1, "smb buf %p len %d", smb, smbCalcSize(smb));
	cERROR(1, "smb buf %p len %d", smb, smbCalcSize(smb));
}
}



void cifs_dump_mids(struct TCP_Server_Info *server)
void cifs_dump_mids(struct TCP_Server_Info *server)
{
{
	struct list_head *tmp;
	struct list_head *tmp;
@@ -79,15 +80,15 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
	spin_lock(&GlobalMid_Lock);
	spin_lock(&GlobalMid_Lock);
	list_for_each(tmp, &server->pending_mid_q) {
	list_for_each(tmp, &server->pending_mid_q) {
		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
		cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %d",
		cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu",
			mid_entry->midState,
			mid_entry->mid_state,
			(int)mid_entry->command,
			le16_to_cpu(mid_entry->command),
			mid_entry->pid,
			mid_entry->pid,
			mid_entry->callback_data,
			mid_entry->callback_data,
			mid_entry->mid);
			mid_entry->mid);
#ifdef CONFIG_CIFS_STATS2
#ifdef CONFIG_CIFS_STATS2
		cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
		cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
			mid_entry->largeBuf,
			mid_entry->large_buf,
			mid_entry->resp_buf,
			mid_entry->resp_buf,
			mid_entry->when_received,
			mid_entry->when_received,
			jiffies);
			jiffies);
@@ -217,9 +218,9 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
				mid_entry = list_entry(tmp3, struct mid_q_entry,
				mid_entry = list_entry(tmp3, struct mid_q_entry,
					qhead);
					qhead);
				seq_printf(m, "\tState: %d com: %d pid:"
				seq_printf(m, "\tState: %d com: %d pid:"
						" %d cbdata: %p mid %d\n",
					      " %d cbdata: %p mid %llu\n",
						mid_entry->midState,
					      mid_entry->mid_state,
						(int)mid_entry->command,
					      le16_to_cpu(mid_entry->command),
					      mid_entry->pid,
					      mid_entry->pid,
					      mid_entry->callback_data,
					      mid_entry->callback_data,
					      mid_entry->mid);
					      mid_entry->mid);
@@ -417,7 +418,6 @@ static const struct file_operations cifs_stats_proc_fops = {


static struct proc_dir_entry *proc_fs_cifs;
static struct proc_dir_entry *proc_fs_cifs;
static const struct file_operations cifsFYI_proc_fops;
static const struct file_operations cifsFYI_proc_fops;
static const struct file_operations cifs_oplock_proc_fops;
static const struct file_operations cifs_lookup_cache_proc_fops;
static const struct file_operations cifs_lookup_cache_proc_fops;
static const struct file_operations traceSMB_proc_fops;
static const struct file_operations traceSMB_proc_fops;
static const struct file_operations cifs_multiuser_mount_proc_fops;
static const struct file_operations cifs_multiuser_mount_proc_fops;
@@ -438,7 +438,6 @@ cifs_proc_init(void)
#endif /* STATS */
#endif /* STATS */
	proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
	proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
	proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
	proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
	proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops);
	proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
	proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
		    &cifs_linux_ext_proc_fops);
		    &cifs_linux_ext_proc_fops);
	proc_create("MultiuserMount", 0, proc_fs_cifs,
	proc_create("MultiuserMount", 0, proc_fs_cifs,
@@ -462,7 +461,6 @@ cifs_proc_clean(void)
	remove_proc_entry("Stats", proc_fs_cifs);
	remove_proc_entry("Stats", proc_fs_cifs);
#endif
#endif
	remove_proc_entry("MultiuserMount", proc_fs_cifs);
	remove_proc_entry("MultiuserMount", proc_fs_cifs);
	remove_proc_entry("OplockEnabled", proc_fs_cifs);
	remove_proc_entry("SecurityFlags", proc_fs_cifs);
	remove_proc_entry("SecurityFlags", proc_fs_cifs);
	remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
	remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
	remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
	remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
@@ -508,46 +506,6 @@ static const struct file_operations cifsFYI_proc_fops = {
	.write		= cifsFYI_proc_write,
	.write		= cifsFYI_proc_write,
};
};


static int cifs_oplock_proc_show(struct seq_file *m, void *v)
{
	seq_printf(m, "%d\n", enable_oplocks);
	return 0;
}

static int cifs_oplock_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, cifs_oplock_proc_show, NULL);
}

static ssize_t cifs_oplock_proc_write(struct file *file,
		const char __user *buffer, size_t count, loff_t *ppos)
{
	char c;
	int rc;

	printk(KERN_WARNING "CIFS: The /proc/fs/cifs/OplockEnabled interface "
	       "will be removed in kernel version 3.4. Please migrate to "
	       "using the 'enable_oplocks' module parameter in cifs.ko.\n");
	rc = get_user(c, buffer);
	if (rc)
		return rc;
	if (c == '0' || c == 'n' || c == 'N')
		enable_oplocks = false;
	else if (c == '1' || c == 'y' || c == 'Y')
		enable_oplocks = true;

	return count;
}

static const struct file_operations cifs_oplock_proc_fops = {
	.owner		= THIS_MODULE,
	.open		= cifs_oplock_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.write		= cifs_oplock_proc_write,
};

static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
{
{
	seq_printf(m, "%d\n", linuxExtEnabled);
	seq_printf(m, "%d\n", linuxExtEnabled);
+2 −2
Original line number Original line Diff line number Diff line
@@ -26,13 +26,13 @@
void cifs_dump_mem(char *label, void *data, int length);
void cifs_dump_mem(char *label, void *data, int length);
#ifdef CONFIG_CIFS_DEBUG2
#ifdef CONFIG_CIFS_DEBUG2
#define DBG2 2
#define DBG2 2
void cifs_dump_detail(struct smb_hdr *);
void cifs_dump_detail(void *);
void cifs_dump_mids(struct TCP_Server_Info *);
void cifs_dump_mids(struct TCP_Server_Info *);
#else
#else
#define DBG2 0
#define DBG2 0
#endif
#endif
extern int traceSMB;		/* flag which enables the function below */
extern int traceSMB;		/* flag which enables the function below */
void dump_smb(struct smb_hdr *, int);
void dump_smb(void *, int);
#define CIFS_INFO	0x01
#define CIFS_INFO	0x01
#define CIFS_RC		0x02
#define CIFS_RC		0x02
#define CIFS_TIMER	0x04
#define CIFS_TIMER	0x04
+12 −1
Original line number Original line Diff line number Diff line
@@ -85,6 +85,8 @@ extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp;
extern mempool_t *cifs_mid_poolp;


struct workqueue_struct	*cifsiod_wq;

static int
static int
cifs_read_super(struct super_block *sb)
cifs_read_super(struct super_block *sb)
{
{
@@ -1111,9 +1113,15 @@ init_cifs(void)
		cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ);
		cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ);
	}
	}


	cifsiod_wq = alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
	if (!cifsiod_wq) {
		rc = -ENOMEM;
		goto out_clean_proc;
	}

	rc = cifs_fscache_register();
	rc = cifs_fscache_register();
	if (rc)
	if (rc)
		goto out_clean_proc;
		goto out_destroy_wq;


	rc = cifs_init_inodecache();
	rc = cifs_init_inodecache();
	if (rc)
	if (rc)
@@ -1161,6 +1169,8 @@ init_cifs(void)
	cifs_destroy_inodecache();
	cifs_destroy_inodecache();
out_unreg_fscache:
out_unreg_fscache:
	cifs_fscache_unregister();
	cifs_fscache_unregister();
out_destroy_wq:
	destroy_workqueue(cifsiod_wq);
out_clean_proc:
out_clean_proc:
	cifs_proc_clean();
	cifs_proc_clean();
	return rc;
	return rc;
@@ -1183,6 +1193,7 @@ exit_cifs(void)
	cifs_destroy_mids();
	cifs_destroy_mids();
	cifs_destroy_inodecache();
	cifs_destroy_inodecache();
	cifs_fscache_unregister();
	cifs_fscache_unregister();
	destroy_workqueue(cifsiod_wq);
	cifs_proc_clean();
	cifs_proc_clean();
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -125,5 +125,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
extern const struct export_operations cifs_export_ops;
extern const struct export_operations cifs_export_ops;
#endif /* CONFIG_CIFS_NFSD_EXPORT */
#endif /* CONFIG_CIFS_NFSD_EXPORT */


#define CIFS_VERSION   "1.76"
#define CIFS_VERSION   "1.77"
#endif				/* _CIFSFS_H */
#endif				/* _CIFSFS_H */
+30 −9
Original line number Original line Diff line number Diff line
@@ -230,6 +230,12 @@ struct cifs_mnt_data {
	int flags;
	int flags;
};
};


static inline unsigned int
get_rfc1002_length(void *buf)
{
	return be32_to_cpu(*((__be32 *)buf));
}

struct TCP_Server_Info {
struct TCP_Server_Info {
	struct list_head tcp_ses_list;
	struct list_head tcp_ses_list;
	struct list_head smb_ses_list;
	struct list_head smb_ses_list;
@@ -276,7 +282,7 @@ struct TCP_Server_Info {
				   vcnumbers */
				   vcnumbers */
	int capabilities; /* allow selective disabling of caps by smb sess */
	int capabilities; /* allow selective disabling of caps by smb sess */
	int timeAdj;  /* Adjust for difference in server time zone in sec */
	int timeAdj;  /* Adjust for difference in server time zone in sec */
	__u16 CurrentMid;         /* multiplex id - rotating counter */
	__u64 CurrentMid;         /* multiplex id - rotating counter */
	char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
	char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
	/* 16th byte of RFC1001 workstation name is always null */
	/* 16th byte of RFC1001 workstation name is always null */
	char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
	char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
@@ -335,6 +341,18 @@ has_credits(struct TCP_Server_Info *server, int *credits)
	return num > 0;
	return num > 0;
}
}


static inline size_t
header_size(void)
{
	return sizeof(struct smb_hdr);
}

static inline size_t
max_header_size(void)
{
	return MAX_CIFS_HDR_SIZE;
}

/*
/*
 * Macros to allow the TCP_Server_Info->net field and related code to drop out
 * Macros to allow the TCP_Server_Info->net field and related code to drop out
 * when CONFIG_NET_NS isn't set.
 * when CONFIG_NET_NS isn't set.
@@ -583,9 +601,11 @@ struct cifs_io_parms {
 * Take a reference on the file private data. Must be called with
 * Take a reference on the file private data. Must be called with
 * cifs_file_list_lock held.
 * cifs_file_list_lock held.
 */
 */
static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
static inline
struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file)
{
{
	++cifs_file->count;
	++cifs_file->count;
	return cifs_file;
}
}


void cifsFileInfo_put(struct cifsFileInfo *cifs_file);
void cifsFileInfo_put(struct cifsFileInfo *cifs_file);
@@ -606,7 +626,7 @@ struct cifsInodeInfo {
	bool delete_pending;		/* DELETE_ON_CLOSE is set */
	bool delete_pending;		/* DELETE_ON_CLOSE is set */
	bool invalid_mapping;		/* pagecache is invalid */
	bool invalid_mapping;		/* pagecache is invalid */
	unsigned long time;		/* jiffies of last update of inode */
	unsigned long time;		/* jiffies of last update of inode */
	u64  server_eof;		/* current file size on server */
	u64  server_eof;		/* current file size on server -- protected by i_lock */
	u64  uniqueid;			/* server inode number */
	u64  uniqueid;			/* server inode number */
	u64  createtime;		/* creation time on server */
	u64  createtime;		/* creation time on server */
#ifdef CONFIG_CIFS_FSCACHE
#ifdef CONFIG_CIFS_FSCACHE
@@ -713,8 +733,8 @@ typedef void (mid_callback_t)(struct mid_q_entry *mid);
/* one of these for every pending CIFS request to the server */
/* one of these for every pending CIFS request to the server */
struct mid_q_entry {
struct mid_q_entry {
	struct list_head qhead;	/* mids waiting on reply from this server */
	struct list_head qhead;	/* mids waiting on reply from this server */
	__u16 mid;		/* multiplex id */
	__u64 mid;		/* multiplex id */
	__u16 pid;		/* process id */
	__u32 pid;		/* process id */
	__u32 sequence_number;  /* for CIFS signing */
	__u32 sequence_number;  /* for CIFS signing */
	unsigned long when_alloc;  /* when mid was created */
	unsigned long when_alloc;  /* when mid was created */
#ifdef CONFIG_CIFS_STATS2
#ifdef CONFIG_CIFS_STATS2
@@ -724,10 +744,10 @@ struct mid_q_entry {
	mid_receive_t *receive; /* call receive callback */
	mid_receive_t *receive; /* call receive callback */
	mid_callback_t *callback; /* call completion callback */
	mid_callback_t *callback; /* call completion callback */
	void *callback_data;	  /* general purpose pointer for callback */
	void *callback_data;	  /* general purpose pointer for callback */
	struct smb_hdr *resp_buf;	/* pointer to received SMB header */
	void *resp_buf;		/* pointer to received SMB header */
	int midState;	/* wish this were enum but can not pass to wait_event */
	int mid_state;	/* wish this were enum but can not pass to wait_event */
	__u8 command;	/* smb command code */
	__le16 command;		/* smb command code */
	bool largeBuf:1;	/* if valid response, is pointer to large buf */
	bool large_buf:1;	/* if valid response, is pointer to large buf */
	bool multiRsp:1;	/* multiple trans2 responses for one request  */
	bool multiRsp:1;	/* multiple trans2 responses for one request  */
	bool multiEnd:1;	/* both received */
	bool multiEnd:1;	/* both received */
};
};
@@ -1052,5 +1072,6 @@ GLOBAL_EXTERN spinlock_t gidsidlock;
void cifs_oplock_break(struct work_struct *work);
void cifs_oplock_break(struct work_struct *work);


extern const struct slow_work_ops cifs_oplock_break_ops;
extern const struct slow_work_ops cifs_oplock_break_ops;
extern struct workqueue_struct *cifsiod_wq;


#endif	/* _CIFS_GLOB_H */
#endif	/* _CIFS_GLOB_H */
Loading