* [RFC PATCH 00/14] cifs: rename of several structs and variables
@ 2022-07-24 15:11 Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars Enzo Matsumiya
` (10 more replies)
0 siblings, 11 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Hi all,
This patch set renames several cifs.ko data structures, variables, and
functions with the goal to improve readability of the code.
In summary, what's been done:
- change from CamelCase to snake_case
- try to give more meaning to globals and struct members
- typedef of status information for each cifs struct
- rename of list_head variables to better represent whether they'are
used as a list element ("head") or a list per se. Also tried to give
more meaning to these, as "rlist", "tlist", "llist" looked confusing
and, sometimes, ambiguous.
- remove redundant prefixes from struct members name, e.g.
tcon_tlink's tl_*, smb_rqst's rq_*, cifs_fattr's cf_*, etc
No functional changes has been made.
I know these touch some very old code that older devs are highly used
to, but I see this as an improvement to reading the code for everyone.
I'll be waiting for your reviews and feedback.
Cheers,
Enzo
Enzo Matsumiya (14):
cifs: rename servers list, lock, functions, and vars
cifs: rename xid/mid globals
cifs: rename global counters
cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
cifs: rename cifs{File,Lock,Inode}Info structs and more
cifs: convert server info vars to snake_case
cifs: typedef server status enum
cifs: typedef ses status enum
cifs: typedef tcon status enum
cifs: typedef securityEnum
cifs: rename cifsFYI to debug_level
cifs: rename list_head fields
cifs: rename more CamelCase to snake_case
cifs: rename more list_heads, remove redundant prefixes
fs/cifs/Kconfig | 2 +-
fs/cifs/asn1.c | 4 +-
fs/cifs/cifs_debug.c | 176 +++----
fs/cifs/cifs_debug.h | 31 +-
fs/cifs/cifs_spnego.c | 4 +-
fs/cifs/cifs_spnego.h | 2 +-
fs/cifs/cifs_swn.c | 24 +-
fs/cifs/cifs_swn.h | 8 +-
fs/cifs/cifs_unicode.c | 4 +-
fs/cifs/cifs_unicode.h | 2 +-
fs/cifs/cifsacl.c | 22 +-
fs/cifs/cifsencrypt.c | 84 ++--
fs/cifs/cifsfs.c | 138 +++---
fs/cifs/cifsglob.h | 712 +++++++++++++++--------------
fs/cifs/cifsproto.h | 180 ++++----
fs/cifs/cifssmb.c | 391 ++++++++--------
fs/cifs/connect.c | 985 ++++++++++++++++++++--------------------
fs/cifs/dfs_cache.c | 182 ++++----
fs/cifs/dfs_cache.h | 40 +-
fs/cifs/dir.c | 16 +-
fs/cifs/file.c | 636 +++++++++++++-------------
fs/cifs/fs_context.c | 8 +-
fs/cifs/fs_context.h | 2 +-
fs/cifs/fscache.c | 18 +-
fs/cifs/fscache.h | 10 +-
fs/cifs/inode.c | 530 ++++++++++-----------
fs/cifs/ioctl.c | 22 +-
fs/cifs/link.c | 26 +-
fs/cifs/misc.c | 199 ++++----
fs/cifs/netmisc.c | 4 +-
fs/cifs/ntlmssp.h | 6 +-
fs/cifs/readdir.c | 344 +++++++-------
fs/cifs/sess.c | 148 +++---
fs/cifs/smb1ops.c | 182 ++++----
fs/cifs/smb2file.c | 36 +-
fs/cifs/smb2inode.c | 136 +++---
fs/cifs/smb2maperror.c | 2 +-
fs/cifs/smb2misc.c | 98 ++--
fs/cifs/smb2ops.c | 593 ++++++++++++------------
fs/cifs/smb2pdu.c | 626 ++++++++++++-------------
fs/cifs/smb2proto.h | 68 +--
fs/cifs/smb2transport.c | 154 +++----
fs/cifs/smbdirect.c | 28 +-
fs/cifs/smbdirect.h | 16 +-
fs/cifs/transport.c | 292 ++++++------
fs/cifs/xattr.c | 12 +-
46 files changed, 3609 insertions(+), 3594 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 02/14] cifs: rename xid/mid globals Enzo Matsumiya
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Renames:
- global tcp_ses_server_{list,lock} to g_servers_{list,lock}
(prepend "g_" to indicate global, and "servers" is more direct than
"tcp_ses")
- list_head in the server struct from "tcp_ses_list" to "server_head",
as that is used as an element and not as a list per se
- all TCP_Server_Info variables from "tcp_*" to "servers" or something
similar to their previous name
- functions that used "tcp_ses" or "tcp_session" in their names to use
"server"
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 24 +--
fs/cifs/cifs_debug.h | 4 +-
fs/cifs/cifsencrypt.c | 6 +-
fs/cifs/cifsfs.c | 14 +-
fs/cifs/cifsglob.h | 20 +-
fs/cifs/cifsproto.h | 12 +-
fs/cifs/cifssmb.c | 34 +--
fs/cifs/connect.c | 457 ++++++++++++++++++++--------------------
fs/cifs/dfs_cache.c | 6 +-
fs/cifs/ioctl.c | 6 +-
fs/cifs/misc.c | 16 +-
fs/cifs/sess.c | 6 +-
fs/cifs/smb2misc.c | 28 +--
fs/cifs/smb2ops.c | 40 ++--
fs/cifs/smb2pdu.c | 30 +--
fs/cifs/smb2transport.c | 44 ++--
fs/cifs/transport.c | 56 ++---
17 files changed, 404 insertions(+), 399 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index aac4240893af..a8e05ab5c9bf 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -181,8 +181,8 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
#else
seq_printf(m, " <filename>\n");
#endif /* CIFS_DEBUG2 */
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
spin_lock(&tcon->open_file_lock);
@@ -206,7 +206,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
seq_putc(m, '\n');
return 0;
}
@@ -267,8 +267,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\nServers: ");
c = 0;
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
/* channel info will be printed as a part of sessions below */
if (CIFS_SERVER_IS_CHAN(server))
continue;
@@ -479,7 +479,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
if (c == 0)
seq_printf(m, "\n\t[NONE]");
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
seq_putc(m, '\n');
cifs_swn_dump(m);
@@ -511,8 +511,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
GlobalMaxActiveXid = 0;
GlobalCurrentXid = 0;
spin_unlock(&GlobalMid_Lock);
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
server->max_in_flight = 0;
#ifdef CONFIG_CIFS_STATS2
for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
@@ -535,7 +535,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else {
return rc;
}
@@ -578,8 +578,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
GlobalCurrentXid, GlobalMaxActiveXid);
i = 0;
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
#ifdef CONFIG_CIFS_STATS2
seq_puts(m, "\nTotal time spent processing by command. Time ");
@@ -611,7 +611,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
seq_putc(m, '\n');
return 0;
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
index ee4ea2b60c0f..9e19f6c5f75b 100644
--- a/fs/cifs/cifs_debug.h
+++ b/fs/cifs/cifs_debug.h
@@ -14,8 +14,8 @@
#define pr_fmt(fmt) "CIFS: " fmt
-void cifs_dump_mem(char *label, void *data, int length);
-void cifs_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
+void cifs_dump_mem(char *, void *, int );
+void cifs_dump_detail(void *, struct TCP_Server_Info *);
void cifs_dump_mids(struct TCP_Server_Info *);
extern bool traceSMB; /* flag which enables the function below */
void dump_smb(void *, int);
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 663cb9db4908..a416b87fbe1a 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -141,13 +141,13 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
if ((cifs_pdu == NULL) || (server == NULL))
return -EINVAL;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
server->tcpStatus == CifsNeedNegotiate) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return rc;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (!server->session_estab) {
memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f909d9e9faaa..f40dffbc363d 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -75,8 +75,8 @@ atomic_t small_buf_alloc_count;
atomic_t total_buf_alloc_count;
atomic_t total_small_buf_alloc_count;
#endif/* STATS2 */
-struct list_head cifs_tcp_ses_list;
-spinlock_t cifs_tcp_ses_lock;
+struct list_head g_servers_list;
+spinlock_t g_servers_lock;
static const struct super_operations cifs_super_ops;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, uint, 0444);
@@ -711,16 +711,16 @@ static void cifs_umount_begin(struct super_block *sb)
tcon = cifs_sb_master_tcon(cifs_sb);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((tcon->tc_count > 1) || (tcon->status == TID_EXITING)) {
/* we have other mounts to same share or we have
already tried to force umount this and woken up
all waiting network requests, nothing to do */
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
} else if (tcon->tc_count == 1)
tcon->status = TID_EXITING;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
/* cancel_notify_requests(tcon); */
@@ -1577,7 +1577,7 @@ init_cifs(void)
{
int rc = 0;
cifs_proc_init();
- INIT_LIST_HEAD(&cifs_tcp_ses_list);
+ INIT_LIST_HEAD(&g_servers_list);
/*
* Initialize Global counters
*/
@@ -1604,7 +1604,7 @@ init_cifs(void)
GlobalCurrentXid = 0;
GlobalTotalActiveXid = 0;
GlobalMaxActiveXid = 0;
- spin_lock_init(&cifs_tcp_ses_lock);
+ spin_lock_init(&g_servers_lock);
spin_lock_init(&GlobalMid_Lock);
cifs_lock_secret = get_random_u32();
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 9b7f409bfc8c..79b14f5f6afe 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -603,7 +603,7 @@ inc_rfc1001_len(void *buf, int count)
}
struct TCP_Server_Info {
- struct list_head tcp_ses_list;
+ struct list_head server_head;
struct list_head smb_ses_list;
__u64 conn_id; /* connection identifier (useful for debugging) */
int srv_count; /* reference counter */
@@ -611,7 +611,7 @@ struct TCP_Server_Info {
char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
struct smb_version_operations *ops;
struct smb_version_values *vals;
- /* updates to tcpStatus protected by cifs_tcp_ses_lock */
+ /* updates to tcpStatus protected by g_servers_lock */
enum statusEnum tcpStatus; /* what we think the status is */
char *hostname; /* hostname portion of UNC string */
struct socket *ssocket;
@@ -1011,7 +1011,7 @@ struct cifs_ses {
struct mutex session_mutex;
struct TCP_Server_Info *server; /* pointer to server info */
int ses_count; /* reference counter */
- enum ses_status_enum ses_status; /* updates protected by cifs_tcp_ses_lock */
+ enum ses_status_enum ses_status; /* updates protected by g_servers_lock */
unsigned overrideSecFlg; /* if non-zero override global sec flags */
char *serverOS; /* name of operating system underlying server */
char *serverNOS; /* name of network operating system of server */
@@ -1910,7 +1910,7 @@ require use of the stronger protocol */
* list operations on global DnotifyReqList
* updates to ses->status and TCP_Server_Info->tcpStatus
* updates to server->CurrentMid
- * tcp_ses_lock protects:
+ * g_servers_lock protects:
* list operations on tcp and SMB session lists
* tcon->open_file_lock protects the list of open files hanging off the tcon
* inode->open_file_lock protects the openFileList hanging off the inode
@@ -1937,23 +1937,23 @@ require use of the stronger protocol */
/*
* the list of TCP_Server_Info structures, ie each of the sockets
* connecting our client to a distinct server (ip address), is
- * chained together by cifs_tcp_ses_list. The list of all our SMB
+ * chained together by g_servers_list. The list of all our SMB
* sessions (and from that the tree connections) can be found
- * by iterating over cifs_tcp_ses_list
+ * by iterating over g_servers_list
*/
-extern struct list_head cifs_tcp_ses_list;
+extern struct list_head g_servers_list;
/*
- * This lock protects the cifs_tcp_ses_list, the list of smb sessions per
+ * This lock protects the g_servers_list, the list of smb sessions per
* tcp session, and the list of tcon's per smb session. It also protects
* the reference counters for the server, smb session, and tcon. It also
* protects some fields in the TCP_Server_Info struct such as dstaddr. Finally,
* changes to the tcon->tidStatus should be done while holding this lock.
- * generally the locks should be taken in order tcp_ses_lock before
+ * generally the locks should be taken in order g_servers_lock before
* tcon->open_file_lock and that before file->file_info_lock since the
* structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file
*/
-extern spinlock_t cifs_tcp_ses_lock;
+extern spinlock_t g_servers_lock;
/*
* Global transaction id (XID) information
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index d59aebefa71c..3e161861b362 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -135,7 +135,7 @@ void
cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
bool all_channels);
void
-cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
+cifs_mark_server_conns_for_reconnect(struct TCP_Server_Info *server,
bool mark_smb_session);
extern int cifs_reconnect(struct TCP_Server_Info *server,
bool mark_smb_session);
@@ -278,9 +278,9 @@ extern void cifs_close_all_deferred_files(struct cifs_tcon *cifs_tcon);
extern void cifs_close_deferred_file_under_dentry(struct cifs_tcon *cifs_tcon,
const char *path);
extern struct TCP_Server_Info *
-cifs_get_tcp_session(struct smb3_fs_context *ctx,
+cifs_get_server(struct smb3_fs_context *ctx,
struct TCP_Server_Info *primary_server);
-extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
+extern void cifs_put_server(struct TCP_Server_Info *server,
int from_reconnect);
extern void cifs_put_tcon(struct cifs_tcon *tcon);
@@ -564,7 +564,7 @@ extern int
cifs_setup_volume_info(struct smb3_fs_context *ctx, const char *mntopts, const char *devname);
extern struct TCP_Server_Info *
-cifs_find_tcp_session(struct smb3_fs_context *ctx);
+cifs_find_server(struct smb3_fs_context *ctx);
extern void cifs_put_smb_ses(struct cifs_ses *ses);
@@ -650,8 +650,8 @@ int smb2_parse_query_directory(struct cifs_tcon *tcon, struct kvec *rsp_iov,
int resp_buftype,
struct cifs_search_info *srch_inf);
-struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server);
-void cifs_put_tcp_super(struct super_block *sb);
+struct super_block *cifs_get_server_super(struct TCP_Server_Info *server);
+void cifs_put_server_super(struct super_block *sb);
int cifs_update_super_prepath(struct cifs_sb_info *cifs_sb, char *prefix);
char *extract_hostname(const char *unc);
char *extract_sharename(const char *unc);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 9ed21752f2df..80ae1b280b11 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -74,13 +74,13 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
struct list_head *tmp1;
/* only send once per connect */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((tcon->ses->ses_status != SES_GOOD) || (tcon->status != TID_NEED_RECON)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
tcon->status = TID_IN_FILES_INVALIDATE;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* list all files open on tree connection and mark them invalid */
spin_lock(&tcon->open_file_lock);
@@ -98,10 +98,10 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
memset(tcon->crfid.fid, 0, sizeof(struct cifs_fid));
mutex_unlock(&tcon->crfid.fid_mutex);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_IN_FILES_INVALIDATE)
tcon->status = TID_NEED_TCON;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/*
* BB Add call to invalidate_inodes(sb) for all superblocks mounted
@@ -134,18 +134,18 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* only tree disconnect, open, and write, (and ulogoff which does not
* have tcon) are allowed as we start force umount
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_EXITING) {
if (smb_command != SMB_COM_WRITE_ANDX &&
smb_command != SMB_COM_OPEN_ANDX &&
smb_command != SMB_COM_TREE_DISCONNECT) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "can not send cmd %d while umounting\n",
smb_command);
return -ENODEV;
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
retries = server->nr_targets;
@@ -165,12 +165,12 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
}
/* are we still trying to reconnect? */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
break;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (retries && --retries)
continue;
@@ -201,13 +201,13 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* and the server never sends an answer the socket will be closed
* and tcpStatus set to reconnect.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/*
* need to prevent multiple threads trying to simultaneously
@@ -432,15 +432,15 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)
if (count < SMB1_CLIENT_GUID_SIZE)
return -EIO;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->srv_count > 1) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (memcmp(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE) != 0) {
cifs_dbg(FYI, "server UID changed\n");
memcpy(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE);
}
} else {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
memcpy(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE);
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6e670e7c2182..c0e712917fd6 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -119,10 +119,10 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
goto requeue_resolve;
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
strlen(ipaddr));
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
kfree(ipaddr);
/* rc == 1 means success here */
@@ -205,10 +205,10 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
/* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (!all_channels) {
pserver->tcpStatus = CifsNeedReconnect;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
@@ -218,7 +218,7 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
ses->chans[i].server->tcpStatus = CifsNeedReconnect;
spin_unlock(&ses->chan_lock);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
/*
@@ -232,7 +232,7 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
* @mark_smb_session: whether even sessions need to be marked
*/
void
-cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
+cifs_mark_server_conns_for_reconnect(struct TCP_Server_Info *server,
bool mark_smb_session)
{
struct TCP_Server_Info *pserver;
@@ -249,7 +249,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) {
/* check if iface is still active */
if (!cifs_chan_is_iface_active(ses, server)) {
@@ -258,9 +258,9 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
* cifs_chan_update_iface to avoid deadlock
*/
ses->ses_count++;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_chan_update_iface(ses, server);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
ses->ses_count--;
}
@@ -289,7 +289,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
next_session:
spin_unlock(&ses->chan_lock);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
static void
@@ -348,13 +348,13 @@ cifs_abort_connection(struct TCP_Server_Info *server)
}
}
-static bool cifs_tcp_ses_needs_reconnect(struct TCP_Server_Info *server, int num_targets)
+static bool cifs_server_needs_reconnect(struct TCP_Server_Info *server, int num_targets)
{
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
server->nr_targets = num_targets;
if (server->tcpStatus == CifsExiting) {
/* the demux thread will exit normally next time through the loop */
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
return false;
}
@@ -364,7 +364,7 @@ static bool cifs_tcp_ses_needs_reconnect(struct TCP_Server_Info *server, int num
server->hostname);
server->tcpStatus = CifsNeedReconnect;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return true;
}
@@ -386,10 +386,10 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,
{
int rc = 0;
- if (!cifs_tcp_ses_needs_reconnect(server, 1))
+ if (!cifs_server_needs_reconnect(server, 1))
return 0;
- cifs_mark_tcp_ses_conns_for_reconnect(server, mark_smb_session);
+ cifs_mark_server_conns_for_reconnect(server, mark_smb_session);
cifs_abort_connection(server);
@@ -414,20 +414,20 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,
} else {
atomic_inc(&tcpSesReconnectCount);
set_credits(server, 1);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsExiting)
server->tcpStatus = CifsNeedNegotiate;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
}
} while (server->tcpStatus == CifsNeedReconnect);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
return rc;
@@ -510,7 +510,7 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
if (!num_targets)
num_targets = 1;
- if (!cifs_tcp_ses_needs_reconnect(server, num_targets))
+ if (!cifs_server_needs_reconnect(server, num_targets))
return 0;
/*
@@ -518,7 +518,7 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
* different server or share during failover. It could be improved by adding some logic to
* only do that in case it connects to a different server or share, though.
*/
- cifs_mark_tcp_ses_conns_for_reconnect(server, true);
+ cifs_mark_server_conns_for_reconnect(server, true);
cifs_abort_connection(server);
@@ -541,10 +541,10 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
*/
atomic_inc(&tcpSesReconnectCount);
set_credits(server, 1);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsExiting)
server->tcpStatus = CifsNeedNegotiate;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
@@ -556,11 +556,11 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
dfs_cache_free_tgts(&tl);
/* Need to set up echo worker again once connection has been established */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
return rc;
@@ -569,12 +569,12 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
int cifs_reconnect(struct TCP_Server_Info *server, bool mark_smb_session)
{
/* If tcp session is not an dfs connection, then reconnect to last target server */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (!server->is_dfs_conn) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return __cifs_reconnect(server, mark_smb_session);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
mutex_lock(&server->refpath_lock);
if (!server->origin_fullpath || !server->leaf_fullpath) {
@@ -670,18 +670,18 @@ server_unresponsive(struct TCP_Server_Info *server)
* 65s kernel_recvmsg times out, and we see that we haven't gotten
* a response in >60s.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((server->tcpStatus == CifsGood ||
server->tcpStatus == CifsNeedNegotiate) &&
(!server->ops->can_echo || server->ops->can_echo(server)) &&
time_after(jiffies, server->lstrp + 3 * server->echo_interval)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_server_dbg(VFS, "has not responded in %lu seconds. Reconnecting...\n",
(3 * server->echo_interval) / HZ);
cifs_reconnect(server, false);
return true;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return false;
}
@@ -726,18 +726,18 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg)
else
length = sock_recvmsg(server->ssocket, smb_msg, 0);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ESHUTDOWN;
}
if (server->tcpStatus == CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_reconnect(server, false);
return -ECONNABORTED;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (length == -ERESTARTSYS ||
length == -EAGAIN ||
@@ -908,16 +908,16 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
int length;
/* take it off the list, if it's not already */
- spin_lock(&cifs_tcp_ses_lock);
- list_del_init(&server->tcp_ses_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
+ list_del_init(&server->server_head);
+ spin_unlock(&g_servers_lock);
cancel_delayed_work_sync(&server->echo);
cancel_delayed_work_sync(&server->resolve);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
server->tcpStatus = CifsExiting;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
wake_up_all(&server->response_q);
/* check if we have blocked requests that need to free */
@@ -1464,12 +1464,12 @@ static int match_server(struct TCP_Server_Info *server, struct smb3_fs_context *
}
struct TCP_Server_Info *
-cifs_find_tcp_session(struct smb3_fs_context *ctx)
+cifs_find_server(struct smb3_fs_context *ctx)
{
struct TCP_Server_Info *server;
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
#ifdef CONFIG_CIFS_DFS_UPCALL
/*
* DFS failover implementation in cifs_reconnect() requires unique tcp sessions for
@@ -1488,22 +1488,22 @@ cifs_find_tcp_session(struct smb3_fs_context *ctx)
continue;
++server->srv_count;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "Existing tcp session with server found\n");
return server;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return NULL;
}
void
-cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
+cifs_put_server(struct TCP_Server_Info *server, int from_reconnect)
{
struct task_struct *task;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (--server->srv_count > 0) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
@@ -1512,12 +1512,12 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
put_net(cifs_net_ns(server));
- list_del_init(&server->tcp_ses_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ list_del_init(&server->server_head);
+ spin_unlock(&g_servers_lock);
/* For secondary channels, we pick up ref-count on the primary server */
if (CIFS_SERVER_IS_CHAN(server))
- cifs_put_tcp_session(server->primary_server, from_reconnect);
+ cifs_put_server(server->primary_server, from_reconnect);
cancel_delayed_work_sync(&server->echo);
cancel_delayed_work_sync(&server->resolve);
@@ -1525,7 +1525,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
if (from_reconnect)
/*
* Avoid deadlock here: reconnect work calls
- * cifs_put_tcp_session() at its end. Need to be sure
+ * cifs_put_server() at its end. Need to be sure
* that reconnect work does nothing with server pointer after
* that step.
*/
@@ -1533,9 +1533,9 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
else
cancel_delayed_work_sync(&server->reconnect);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
server->tcpStatus = CifsExiting;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_crypto_secmech_release(server);
@@ -1550,107 +1550,107 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
}
struct TCP_Server_Info *
-cifs_get_tcp_session(struct smb3_fs_context *ctx,
+cifs_get_server(struct smb3_fs_context *ctx,
struct TCP_Server_Info *primary_server)
{
- struct TCP_Server_Info *tcp_ses = NULL;
+ struct TCP_Server_Info *server = NULL;
int rc;
cifs_dbg(FYI, "UNC: %s\n", ctx->UNC);
- /* see if we already have a matching tcp_ses */
- tcp_ses = cifs_find_tcp_session(ctx);
- if (tcp_ses)
- return tcp_ses;
+ /* see if we already have a matching server */
+ server = cifs_find_server(ctx);
+ if (server)
+ return server;
- tcp_ses = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
- if (!tcp_ses) {
+ server = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
+ if (!server) {
rc = -ENOMEM;
goto out_err;
}
- tcp_ses->hostname = kstrdup(ctx->server_hostname, GFP_KERNEL);
- if (!tcp_ses->hostname) {
+ server->hostname = kstrdup(ctx->server_hostname, GFP_KERNEL);
+ if (!server->hostname) {
rc = -ENOMEM;
goto out_err;
}
if (ctx->nosharesock)
- tcp_ses->nosharesock = true;
-
- tcp_ses->ops = ctx->ops;
- tcp_ses->vals = ctx->vals;
- cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
-
- tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
- tcp_ses->noblockcnt = ctx->rootfs;
- tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
- tcp_ses->noautotune = ctx->noautotune;
- tcp_ses->tcp_nodelay = ctx->sockopt_tcp_nodelay;
- tcp_ses->rdma = ctx->rdma;
- tcp_ses->in_flight = 0;
- tcp_ses->max_in_flight = 0;
- tcp_ses->credits = 1;
+ server->nosharesock = true;
+
+ server->ops = ctx->ops;
+ server->vals = ctx->vals;
+ cifs_set_net_ns(server, get_net(current->nsproxy->net_ns));
+
+ server->conn_id = atomic_inc_return(&tcpSesNextId);
+ server->noblockcnt = ctx->rootfs;
+ server->noblocksnd = ctx->noblocksnd || ctx->rootfs;
+ server->noautotune = ctx->noautotune;
+ server->tcp_nodelay = ctx->sockopt_tcp_nodelay;
+ server->rdma = ctx->rdma;
+ server->in_flight = 0;
+ server->max_in_flight = 0;
+ server->credits = 1;
if (primary_server) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
++primary_server->srv_count;
- tcp_ses->primary_server = primary_server;
- spin_unlock(&cifs_tcp_ses_lock);
- }
- init_waitqueue_head(&tcp_ses->response_q);
- init_waitqueue_head(&tcp_ses->request_q);
- INIT_LIST_HEAD(&tcp_ses->pending_mid_q);
- mutex_init(&tcp_ses->_srv_mutex);
- memcpy(tcp_ses->workstation_RFC1001_name,
+ server->primary_server = primary_server;
+ spin_unlock(&g_servers_lock);
+ }
+ init_waitqueue_head(&server->response_q);
+ init_waitqueue_head(&server->request_q);
+ INIT_LIST_HEAD(&server->pending_mid_q);
+ mutex_init(&server->_srv_mutex);
+ memcpy(server->workstation_RFC1001_name,
ctx->source_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
- memcpy(tcp_ses->server_RFC1001_name,
+ memcpy(server->server_RFC1001_name,
ctx->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
- tcp_ses->session_estab = false;
- tcp_ses->sequence_number = 0;
- tcp_ses->reconnect_instance = 1;
- tcp_ses->lstrp = jiffies;
- tcp_ses->compress_algorithm = cpu_to_le16(ctx->compression);
- spin_lock_init(&tcp_ses->req_lock);
- INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
- INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
- INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
- INIT_DELAYED_WORK(&tcp_ses->resolve, cifs_resolve_server);
- INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server);
- mutex_init(&tcp_ses->reconnect_mutex);
+ server->session_estab = false;
+ server->sequence_number = 0;
+ server->reconnect_instance = 1;
+ server->lstrp = jiffies;
+ server->compress_algorithm = cpu_to_le16(ctx->compression);
+ spin_lock_init(&server->req_lock);
+ INIT_LIST_HEAD(&server->server_head);
+ INIT_LIST_HEAD(&server->smb_ses_list);
+ INIT_DELAYED_WORK(&server->echo, cifs_echo_request);
+ INIT_DELAYED_WORK(&server->resolve, cifs_resolve_server);
+ INIT_DELAYED_WORK(&server->reconnect, smb2_reconnect_server);
+ mutex_init(&server->reconnect_mutex);
#ifdef CONFIG_CIFS_DFS_UPCALL
- mutex_init(&tcp_ses->refpath_lock);
+ mutex_init(&server->refpath_lock);
#endif
- memcpy(&tcp_ses->srcaddr, &ctx->srcaddr,
- sizeof(tcp_ses->srcaddr));
- memcpy(&tcp_ses->dstaddr, &ctx->dstaddr,
- sizeof(tcp_ses->dstaddr));
+ memcpy(&server->srcaddr, &ctx->srcaddr,
+ sizeof(server->srcaddr));
+ memcpy(&server->dstaddr, &ctx->dstaddr,
+ sizeof(server->dstaddr));
if (ctx->use_client_guid)
- memcpy(tcp_ses->client_guid, ctx->client_guid,
+ memcpy(server->client_guid, ctx->client_guid,
SMB2_CLIENT_GUID_SIZE);
else
- generate_random_uuid(tcp_ses->client_guid);
+ generate_random_uuid(server->client_guid);
/*
* at this point we are the only ones with the pointer
* to the struct since the kernel thread not created yet
* no need to spinlock this init of tcpStatus or srv_count
*/
- tcp_ses->tcpStatus = CifsNew;
- ++tcp_ses->srv_count;
+ server->tcpStatus = CifsNew;
+ ++server->srv_count;
if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&
ctx->echo_interval <= SMB_ECHO_INTERVAL_MAX)
- tcp_ses->echo_interval = ctx->echo_interval * HZ;
+ server->echo_interval = ctx->echo_interval * HZ;
else
- tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT * HZ;
- if (tcp_ses->rdma) {
+ server->echo_interval = SMB_ECHO_INTERVAL_DEFAULT * HZ;
+ if (server->rdma) {
#ifndef CONFIG_CIFS_SMB_DIRECT
cifs_dbg(VFS, "CONFIG_CIFS_SMB_DIRECT is not enabled\n");
rc = -ENOENT;
goto out_err_crypto_release;
#endif
- tcp_ses->smbd_conn = smbd_get_connection(
- tcp_ses, (struct sockaddr *)&ctx->dstaddr);
- if (tcp_ses->smbd_conn) {
+ server->smbd_conn = smbd_get_connection(
+ server, (struct sockaddr *)&ctx->dstaddr);
+ if (server->smbd_conn) {
cifs_dbg(VFS, "RDMA transport established\n");
rc = 0;
goto smbd_connected;
@@ -1659,7 +1659,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
goto out_err_crypto_release;
}
}
- rc = ip_connect(tcp_ses);
+ rc = ip_connect(server);
if (rc < 0) {
cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n");
goto out_err_crypto_release;
@@ -1670,60 +1670,60 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
* this will succeed. No need for try_module_get().
*/
__module_get(THIS_MODULE);
- tcp_ses->tsk = kthread_run(cifs_demultiplex_thread,
- tcp_ses, "cifsd");
- if (IS_ERR(tcp_ses->tsk)) {
- rc = PTR_ERR(tcp_ses->tsk);
+ server->tsk = kthread_run(cifs_demultiplex_thread,
+ server, "cifsd");
+ if (IS_ERR(server->tsk)) {
+ rc = PTR_ERR(server->tsk);
cifs_dbg(VFS, "error %d create cifsd thread\n", rc);
module_put(THIS_MODULE);
goto out_err_crypto_release;
}
- tcp_ses->min_offload = ctx->min_offload;
+ server->min_offload = ctx->min_offload;
/*
* at this point we are the only ones with the pointer
* to the struct since the kernel thread not created yet
* no need to spinlock this update of tcpStatus
*/
- spin_lock(&cifs_tcp_ses_lock);
- tcp_ses->tcpStatus = CifsNeedNegotiate;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
+ server->tcpStatus = CifsNeedNegotiate;
+ spin_unlock(&g_servers_lock);
if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
- tcp_ses->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
+ server->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
else
- tcp_ses->max_credits = ctx->max_credits;
+ server->max_credits = ctx->max_credits;
- tcp_ses->nr_targets = 1;
- tcp_ses->ignore_signature = ctx->ignore_signature;
+ server->nr_targets = 1;
+ server->ignore_signature = ctx->ignore_signature;
/* thread spawned, put it on the list */
- spin_lock(&cifs_tcp_ses_lock);
- list_add(&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
+ list_add(&server->server_head, &g_servers_list);
+ spin_unlock(&g_servers_lock);
/* queue echo request delayed work */
- queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval);
+ queue_delayed_work(cifsiod_wq, &server->echo, server->echo_interval);
/* queue dns resolution delayed work */
cifs_dbg(FYI, "%s: next dns resolution scheduled for %d seconds in the future\n",
__func__, SMB_DNS_RESOLVE_INTERVAL_DEFAULT);
- queue_delayed_work(cifsiod_wq, &tcp_ses->resolve, (SMB_DNS_RESOLVE_INTERVAL_DEFAULT * HZ));
+ queue_delayed_work(cifsiod_wq, &server->resolve, (SMB_DNS_RESOLVE_INTERVAL_DEFAULT * HZ));
- return tcp_ses;
+ return server;
out_err_crypto_release:
- cifs_crypto_secmech_release(tcp_ses);
+ cifs_crypto_secmech_release(server);
- put_net(cifs_net_ns(tcp_ses));
+ put_net(cifs_net_ns(server));
out_err:
- if (tcp_ses) {
- if (CIFS_SERVER_IS_CHAN(tcp_ses))
- cifs_put_tcp_session(tcp_ses->primary_server, false);
- kfree(tcp_ses->hostname);
- if (tcp_ses->ssocket)
- sock_release(tcp_ses->ssocket);
- kfree(tcp_ses);
+ if (server) {
+ if (CIFS_SERVER_IS_CHAN(server))
+ cifs_put_server(server->primary_server, false);
+ kfree(server->hostname);
+ if (server->ssocket)
+ sock_release(server->ssocket);
+ kfree(server);
}
return ERR_PTR(rc);
}
@@ -1861,17 +1861,17 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
{
struct cifs_ses *ses;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
if (ses->ses_status == SES_EXITING)
continue;
if (!match_session(ses, ctx))
continue;
++ses->ses_count;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return ses;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return NULL;
}
@@ -1881,9 +1881,9 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
unsigned int chan_count;
struct TCP_Server_Info *server = ses->server;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (ses->ses_status == SES_EXITING) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
@@ -1891,7 +1891,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
cifs_dbg(FYI, "%s: ses ipc: %s\n", __func__, ses->tcon_ipc ? ses->tcon_ipc->treeName : "NONE");
if (--ses->ses_count > 0) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
@@ -1900,7 +1900,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
if (ses->ses_status == SES_GOOD)
ses->ses_status = SES_EXITING;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_free_ipc(ses);
@@ -1913,9 +1913,9 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
_free_xid(xid);
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_del_init(&ses->smb_ses_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
chan_count = ses->chan_count;
@@ -1928,13 +1928,13 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
kref_put(&ses->chans[i].iface->refcount, release_iface);
ses->chans[i].iface = NULL;
}
- cifs_put_tcp_session(ses->chans[i].server, 0);
+ cifs_put_server(ses->chans[i].server, 0);
ses->chans[i].server = NULL;
}
}
sesInfoFree(ses);
- cifs_put_tcp_session(server, 0);
+ cifs_put_server(server, 0);
}
#ifdef CONFIG_KEYS
@@ -2146,7 +2146,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
spin_unlock(&ses->chan_lock);
/* existing SMB ses has a server reference already */
- cifs_put_tcp_session(server, 0);
+ cifs_put_server(server, 0);
free_xid(xid);
return ses;
}
@@ -2219,9 +2219,9 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
* note: the session becomes active soon after this. So you'll
* need to lock before changing something in the session.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_add(&ses->smb_ses_list, &server->smb_ses_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
free_xid(xid);
@@ -2259,15 +2259,15 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
{
struct cifs_tcon *tcon;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
if (!match_tcon(tcon, ctx))
continue;
++tcon->tc_count;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return tcon;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return NULL;
}
@@ -2286,9 +2286,9 @@ cifs_put_tcon(struct cifs_tcon *tcon)
ses = tcon->ses;
cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (--tcon->tc_count > 0) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
@@ -2296,7 +2296,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
WARN_ON(tcon->tc_count < 0);
list_del_init(&tcon->tcon_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* cancel polling of interfaces */
cancel_delayed_work_sync(&tcon->query_interfaces);
@@ -2544,9 +2544,9 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
(SMB_INTERFACE_POLL_INTERVAL * HZ));
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_add(&tcon->tcon_list, &ses->tcon_list);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return tcon;
@@ -2643,27 +2643,27 @@ cifs_match_super(struct super_block *sb, void *data)
struct cifs_mnt_data *mnt_data = data;
struct smb3_fs_context *ctx;
struct cifs_sb_info *cifs_sb;
- struct TCP_Server_Info *tcp_srv;
+ struct TCP_Server_Info *server;
struct cifs_ses *ses;
struct cifs_tcon *tcon;
struct tcon_link *tlink;
int rc = 0;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
cifs_sb = CIFS_SB(sb);
tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
if (tlink == NULL) {
/* can not match superblock if tlink were ever null */
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
tcon = tlink_tcon(tlink);
ses = tcon->ses;
- tcp_srv = ses->server;
+ server = ses->server;
ctx = mnt_data->ctx;
- if (!match_server(tcp_srv, ctx) ||
+ if (!match_server(server, ctx) ||
!match_session(ses, ctx) ||
!match_tcon(tcon, ctx) ||
!match_prepath(sb, mnt_data)) {
@@ -2673,7 +2673,7 @@ cifs_match_super(struct super_block *sb, void *data)
rc = compare_mount_options(sb, mnt_data);
out:
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_put_tlink(tlink);
return rc;
}
@@ -3118,7 +3118,7 @@ static inline void mount_put_conns(struct mount_ctx *mnt_ctx)
else if (mnt_ctx->ses)
cifs_put_smb_ses(mnt_ctx->ses);
else if (mnt_ctx->server)
- cifs_put_tcp_session(mnt_ctx->server, 0);
+ cifs_put_server(mnt_ctx->server, 0);
mnt_ctx->cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_POSIX_PATHS;
free_xid(mnt_ctx->xid);
}
@@ -3137,7 +3137,7 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
xid = get_xid();
/* get a reference to a tcp session */
- server = cifs_get_tcp_session(ctx, NULL);
+ server = cifs_get_server(ctx, NULL);
if (IS_ERR(server)) {
rc = PTR_ERR(server);
server = NULL;
@@ -3178,15 +3178,15 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
* for just this mount.
*/
reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
(le64_to_cpu(tcon->fsUnixInfo.Capability) &
CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = -EACCES;
goto out;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else
tcon->unix_ext = 0; /* server does not support them */
@@ -3269,9 +3269,9 @@ static int mount_get_dfs_conns(struct mount_ctx *mnt_ctx)
rc = mount_get_conns(mnt_ctx);
if (mnt_ctx->server) {
cifs_dbg(FYI, "%s: marking tcp session as a dfs connection\n", __func__);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
mnt_ctx->server->is_dfs_conn = true;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
return rc;
}
@@ -3514,9 +3514,9 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
static void set_root_ses(struct mount_ctx *mnt_ctx)
{
if (mnt_ctx->ses) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
mnt_ctx->ses->ses_count++;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
dfs_cache_add_refsrv_session(&mnt_ctx->mount_id, mnt_ctx->ses);
}
mnt_ctx->root_ses = mnt_ctx->ses;
@@ -3986,28 +3986,28 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,
return -ENOSYS;
/* only send once per connect */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (!server->ops->need_neg(server) ||
server->tcpStatus != CifsNeedNegotiate) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
server->tcpStatus = CifsInNegotiate;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = server->ops->negotiate(xid, ses, server);
if (rc == 0) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsInNegotiate)
server->tcpStatus = CifsGood;
else
rc = -EHOSTDOWN;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsInNegotiate)
server->tcpStatus = CifsNeedNegotiate;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
return rc;
@@ -4023,7 +4023,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr;
bool is_binding = false;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->dstaddr.ss_family == AF_INET6)
scnprintf(ses->ip_addr, sizeof(ses->ip_addr), "%pI6", &addr6->sin6_addr);
else
@@ -4032,7 +4032,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
if (ses->ses_status != SES_GOOD &&
ses->ses_status != SES_NEW &&
ses->ses_status != SES_NEED_RECON) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
@@ -4041,7 +4041,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
if (CIFS_ALL_CHANS_GOOD(ses) ||
cifs_chan_in_reconnect(ses, server)) {
spin_unlock(&ses->chan_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
is_binding = !CIFS_ALL_CHANS_NEED_RECONNECT(ses);
@@ -4050,7 +4050,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
if (!is_binding)
ses->ses_status = SES_IN_SETUP;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (!is_binding) {
ses->capabilities = server->capabilities;
@@ -4074,22 +4074,22 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
if (rc) {
cifs_server_dbg(VFS, "Send error in SessSetup = %d\n", rc);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (ses->ses_status == SES_IN_SETUP)
ses->ses_status = SES_NEED_RECON;
spin_lock(&ses->chan_lock);
cifs_chan_clear_in_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (ses->ses_status == SES_IN_SETUP)
ses->ses_status = SES_GOOD;
spin_lock(&ses->chan_lock);
cifs_chan_clear_in_reconnect(ses, server);
cifs_chan_clear_need_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
return rc;
@@ -4146,14 +4146,14 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
}
/* get a reference for the same TCP session */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
++master_tcon->ses->server->srv_count;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
ses = cifs_get_smb_ses(master_tcon->ses->server, ctx);
if (IS_ERR(ses)) {
tcon = (struct cifs_tcon *)ses;
- cifs_put_tcp_session(master_tcon->ses->server, 0);
+ cifs_put_server(master_tcon->ses->server, 0);
goto out;
}
@@ -4400,8 +4400,10 @@ static int update_server_fullpath(struct TCP_Server_Info *server, struct cifs_sb
return rc;
}
-static int target_share_matches_server(struct TCP_Server_Info *server, const char *tcp_host,
- size_t tcp_host_len, char *share, bool *target_match)
+static int target_share_matches_server(struct TCP_Server_Info *server,
+ const char *server_name,
+ size_t server_name_len, char *share,
+ bool *target_match)
{
int rc = 0;
const char *dfs_host;
@@ -4411,12 +4413,15 @@ static int target_share_matches_server(struct TCP_Server_Info *server, const cha
extract_unc_hostname(share, &dfs_host, &dfs_host_len);
/* Check if hostnames or addresses match */
- if (dfs_host_len != tcp_host_len || strncasecmp(dfs_host, tcp_host, dfs_host_len) != 0) {
- cifs_dbg(FYI, "%s: %.*s doesn't match %.*s\n", __func__, (int)dfs_host_len,
- dfs_host, (int)tcp_host_len, tcp_host);
+ if (dfs_host_len != server_name_len ||
+ strncasecmp(dfs_host, server_name, dfs_host_len) != 0) {
+ cifs_dbg(FYI, "%s: %.*s doesn't match %.*s\n", __func__,
+ (int)dfs_host_len, dfs_host, (int)server_name_len,
+ server_name);
rc = match_target_ip(server, dfs_host, dfs_host_len, target_match);
if (rc)
- cifs_dbg(VFS, "%s: failed to match target ip: %d\n", __func__, rc);
+ cifs_dbg(VFS, "%s: failed to match target ip: %d\n",
+ __func__, rc);
}
return rc;
}
@@ -4430,12 +4435,12 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
const struct smb_version_operations *ops = server->ops;
struct cifs_tcon *ipc = tcon->ses->tcon_ipc;
char *share = NULL, *prefix = NULL;
- const char *tcp_host;
- size_t tcp_host_len;
+ const char *server_name;
+ size_t server_name_len;
struct dfs_cache_tgt_iterator *tit;
bool target_match;
- extract_unc_hostname(server->hostname, &tcp_host, &tcp_host_len);
+ extract_unc_hostname(server->hostname, &server_name, &server_name_len);
tit = dfs_cache_get_tgt_iterator(tl);
if (!tit) {
@@ -4459,7 +4464,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
break;
}
- rc = target_share_matches_server(server, tcp_host, tcp_host_len, share,
+ rc = target_share_matches_server(server, server_name, server_name_len, share,
&target_match);
if (rc)
break;
@@ -4553,15 +4558,15 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
struct dfs_info3_param ref = {0};
/* only send once per connect */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->ses->ses_status != SES_GOOD ||
(tcon->status != TID_NEW &&
tcon->status != TID_NEED_TCON)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
tcon->status = TID_IN_TCON;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
if (!tree) {
@@ -4575,7 +4580,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
goto out;
}
- sb = cifs_get_tcp_super(server);
+ sb = cifs_get_server_super(server);
if (IS_ERR(sb)) {
rc = PTR_ERR(sb);
cifs_dbg(VFS, "%s: could not find superblock: %d\n", __func__, rc);
@@ -4597,18 +4602,18 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
out:
kfree(tree);
- cifs_put_tcp_super(sb);
+ cifs_put_server_super(sb);
if (rc) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_IN_TCON)
tcon->status = TID_NEED_TCON;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_IN_TCON)
tcon->status = TID_GOOD;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
@@ -4621,27 +4626,27 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
const struct smb_version_operations *ops = tcon->ses->server->ops;
/* only send once per connect */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->ses->ses_status != SES_GOOD ||
(tcon->status != TID_NEW &&
tcon->status != TID_NEED_TCON)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
tcon->status = TID_IN_TCON;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_IN_TCON)
tcon->status = TID_NEED_TCON;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
} else {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_IN_TCON)
tcon->status = TID_GOOD;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 34a8f3baed5e..2e63ba80c893 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -1524,8 +1524,8 @@ static void refresh_mounts(struct cifs_ses **sessions)
INIT_LIST_HEAD(&tcons);
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
if (!server->is_dfs_conn)
continue;
@@ -1538,7 +1538,7 @@ static void refresh_mounts(struct cifs_ses **sessions)
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
list_for_each_entry_safe(tcon, ntcon, &tcons, ulist) {
struct TCP_Server_Info *server = tcon->ses->server;
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 0359b604bdbc..35f931a7f6d1 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -229,8 +229,8 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
struct cifs_ses *ses_it = NULL;
struct TCP_Server_Info *server_it = NULL;
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server_it, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server_it, &g_servers_list, server_head) {
list_for_each_entry(ses_it, &server_it->smb_ses_list, smb_ses_list) {
if (ses_it->Suid == out.session_id) {
ses = ses_it;
@@ -246,7 +246,7 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
}
}
search_end:
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (!found) {
rc = -ENOENT;
goto out;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index a825cc09a53e..e88f33b8159f 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -465,7 +465,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
return false;
/* look up tcon based on tid & uid */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(ses, &srv->smb_ses_list, smb_ses_list) {
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
if (tcon->tid != buf->Tid)
@@ -489,16 +489,16 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
cifs_queue_oplock_break(netfile);
spin_unlock(&tcon->open_file_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return true;
}
spin_unlock(&tcon->open_file_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "No matching file for oplock break\n");
return true;
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n");
return true;
}
@@ -1186,7 +1186,7 @@ struct super_cb_data {
struct super_block *sb;
};
-static void tcp_super_cb(struct super_block *sb, void *arg)
+static void server_super_cb(struct super_block *sb, void *arg)
{
struct super_cb_data *sd = arg;
struct TCP_Server_Info *server = sd->data;
@@ -1234,12 +1234,12 @@ static void __cifs_put_super(struct super_block *sb)
cifs_sb_deactive(sb);
}
-struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server)
+struct super_block *cifs_get_server_super(struct TCP_Server_Info *server)
{
- return __cifs_get_super(tcp_super_cb, server);
+ return __cifs_get_super(server_super_cb, server);
}
-void cifs_put_tcp_super(struct super_block *sb)
+void cifs_put_server_super(struct super_block *sb)
{
__cifs_put_super(sb);
}
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 02c8b2906196..959a86c5e74c 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -327,7 +327,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
spin_unlock(&ses->chan_lock);
if (!iface && CIFS_SERVER_IS_CHAN(server))
- cifs_put_tcp_session(server, false);
+ cifs_put_server(server, false);
return rc;
}
@@ -433,7 +433,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
SMB2_CLIENT_GUID_SIZE);
ctx.use_client_guid = true;
- chan_server = cifs_get_tcp_session(&ctx, ses->server);
+ chan_server = cifs_get_server(&ctx, ses->server);
spin_lock(&ses->chan_lock);
chan = &ses->chans[ses->chan_count];
@@ -493,7 +493,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
WARN_ON(ses->chan_count < 1);
spin_unlock(&ses->chan_lock);
- cifs_put_tcp_session(chan->server, 0);
+ cifs_put_server(chan->server, 0);
}
return rc;
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 818cc4dee0e2..9370cca778a8 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -153,14 +153,14 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server)
struct cifs_ses *iter;
/* decrypt frame now that it is completely read in */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(iter, &server->smb_ses_list, smb_ses_list) {
if (iter->Suid == le64_to_cpu(thdr->SessionId)) {
ses = iter;
break;
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (!ses) {
cifs_dbg(VFS, "no decryption - session id not found\n");
return 1;
@@ -618,8 +618,8 @@ smb2_is_valid_lease_break(char *buffer)
cifs_dbg(FYI, "Checking for lease break\n");
/* look up tcon based on tid & uid */
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
spin_lock(&tcon->open_file_lock);
@@ -627,7 +627,7 @@ smb2_is_valid_lease_break(char *buffer)
&tcon->stats.cifs_stats.num_oplock_brks);
if (smb2_tcon_has_lease(tcon, rsp)) {
spin_unlock(&tcon->open_file_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return true;
}
open = smb2_tcon_find_pending_open_lease(tcon,
@@ -640,7 +640,7 @@ smb2_is_valid_lease_break(char *buffer)
memcpy(lease_key, open->lease_key,
SMB2_LEASE_KEY_SIZE);
spin_unlock(&tcon->open_file_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
smb2_queue_pending_open_break(tlink,
lease_key,
rsp->NewLeaseState);
@@ -657,13 +657,13 @@ smb2_is_valid_lease_break(char *buffer)
smb2_cached_lease_break);
queue_work(cifsiod_wq,
&tcon->crfid.lease_break);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return true;
}
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "Can not process lease break - no lease matched\n");
trace_smb3_lease_not_found(le32_to_cpu(rsp->CurrentLeaseState),
le32_to_cpu(rsp->hdr.Id.SyncId.TreeId),
@@ -699,7 +699,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
cifs_dbg(FYI, "oplock level 0x%x\n", rsp->OplockLevel);
/* look up tcon based on tid & uid */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
@@ -733,13 +733,13 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
cifs_queue_oplock_break(cfile);
spin_unlock(&tcon->open_file_lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return true;
}
spin_unlock(&tcon->open_file_lock);
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "No file id matched, oplock break ignored\n");
trace_smb3_oplock_not_found(0 /* no xid */, rsp->PersistentFid,
le32_to_cpu(rsp->hdr.Id.SyncId.TreeId),
@@ -807,12 +807,12 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
int rc;
cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->tc_count <= 0) {
struct TCP_Server_Info *server = NULL;
WARN_ONCE(tcon->tc_count < 0, "tcon refcount is negative");
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (tcon->ses)
server = tcon->ses->server;
@@ -823,7 +823,7 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
return 0;
}
tcon->tc_count++;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = __smb2_handle_cancelled_cmd(tcon, SMB2_CLOSE_HE, 0,
persistent_fid, volatile_fid);
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 5bed8b584086..a268454868ba 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -126,13 +126,13 @@ smb2_add_credits(struct TCP_Server_Info *server,
optype, scredits, add);
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedReconnect
|| server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
switch (rc) {
case -1:
@@ -218,12 +218,12 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
spin_lock(&server->req_lock);
} else {
spin_unlock(&server->req_lock);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
spin_lock(&server->req_lock);
scredits = server->credits;
@@ -2581,19 +2581,19 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
if (shdr->Status != STATUS_NETWORK_NAME_DELETED)
return;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
if (tcon->tid == le32_to_cpu(shdr->Id.SyncId.TreeId)) {
tcon->need_reconnect = true;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
pr_warn_once("Server share %s deleted.\n",
tcon->treeName);
return;
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
static int
@@ -2939,13 +2939,13 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
*/
tcon = ses->tcon_ipc;
if (tcon == NULL) {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
tcon = list_first_entry_or_null(&ses->tcon_list,
struct cifs_tcon,
tcon_list);
if (tcon)
tcon->tc_count++;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
if (tcon == NULL) {
@@ -3005,11 +3005,11 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
out:
if (tcon && !tcon->ipc) {
/* ipc tcons are not refcounted */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
tcon->tc_count--;
/* tc_count can never go negative */
WARN_ON(tcon->tc_count < 0);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
kfree(utf16_path);
kfree(dfs_req);
@@ -4557,19 +4557,19 @@ smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key)
struct cifs_ses *ses;
u8 *ses_enc_key;
- spin_lock(&cifs_tcp_ses_lock);
- list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+ spin_lock(&g_servers_lock);
+ list_for_each_entry(server, &g_servers_list, server_head) {
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
if (ses->Suid == ses_id) {
ses_enc_key = enc ? ses->smb3encryptionkey :
ses->smb3decryptionkey;
memcpy(key, ses_enc_key, SMB3_ENC_DEC_KEY_SIZE);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
@@ -5078,12 +5078,12 @@ static void smb2_decrypt_offload(struct work_struct *work)
mid->callback(mid);
} else {
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
spin_lock(&GlobalMid_Lock);
if (dw->server->tcpStatus == CifsNeedReconnect) {
mid->mid_state = MID_RETRY_NEEDED;
spin_unlock(&GlobalMid_Lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
mid->callback(mid);
} else {
mid->mid_state = MID_REQUEST_SUBMITTED;
@@ -5091,7 +5091,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
list_add_tail(&mid->qhead,
&dw->server->pending_mid_q);
spin_unlock(&GlobalMid_Lock);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
}
}
cifs_mid_q_entry_release(mid);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 295ee8b88055..f103ece8a3c9 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -162,7 +162,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL)
return 0;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (tcon->status == TID_EXITING) {
/*
* only tree disconnect, open, and write,
@@ -172,13 +172,13 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
if ((smb2_command != SMB2_WRITE) &&
(smb2_command != SMB2_CREATE) &&
(smb2_command != SMB2_TREE_DISCONNECT)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "can not send cmd %d while umounting\n",
smb2_command);
return -ENODEV;
}
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if ((!tcon->ses) || (tcon->ses->ses_status == SES_EXITING) ||
(!tcon->ses->server) || !server)
return -EIO;
@@ -217,12 +217,12 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
/* are we still trying to reconnect? */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
break;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (retries && --retries)
continue;
@@ -256,13 +256,13 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* and the server never sends an answer the socket will be closed
* and tcpStatus set to reconnect.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/*
* need to prevent multiple threads trying to simultaneously
@@ -3803,7 +3803,7 @@ void smb2_reconnect_server(struct work_struct *work)
INIT_LIST_HEAD(&tmp_ses_list);
cifs_dbg(FYI, "Reconnecting tcons and channels\n");
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
tcon_selected = false;
@@ -3844,7 +3844,7 @@ void smb2_reconnect_server(struct work_struct *work)
if (tcon_exist || ses_exist)
server->srv_count++;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon, server);
@@ -3896,7 +3896,7 @@ void smb2_reconnect_server(struct work_struct *work)
/* now we can safely release srv struct */
if (tcon_exist || ses_exist)
- cifs_put_tcp_session(server, 1);
+ cifs_put_server(server, 1);
}
int
@@ -3911,15 +3911,15 @@ SMB2_echo(struct TCP_Server_Info *server)
cifs_dbg(FYI, "In echo request for conn_id %lld\n", server->conn_id);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->ops->need_neg &&
server->ops->need_neg(server)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* No need to send echo on newly established connections */
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
return rc;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = smb2_plain_req_init(SMB2_ECHO, NULL, server,
(void **)&req, &total_len);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 53ff6bc11939..36c08e369841 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -86,9 +86,9 @@ int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key)
int i;
int rc = 0;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
- list_for_each_entry(it, &cifs_tcp_ses_list, tcp_ses_list) {
+ list_for_each_entry(it, &g_servers_list, server_head) {
list_for_each_entry(ses, &it->smb_ses_list, smb_ses_list) {
if (ses->Suid == ses_id)
goto found;
@@ -133,7 +133,7 @@ int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key)
rc = -ENOENT;
out:
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return rc;
}
@@ -157,9 +157,9 @@ smb2_find_smb_ses(struct TCP_Server_Info *server, __u64 ses_id)
{
struct cifs_ses *ses;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
ses = smb2_find_smb_ses_unlocked(server, ses_id);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return ses;
}
@@ -190,19 +190,19 @@ smb2_find_smb_tcon(struct TCP_Server_Info *server, __u64 ses_id, __u32 tid)
struct cifs_ses *ses;
struct cifs_tcon *tcon;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
ses = smb2_find_smb_ses_unlocked(server, ses_id);
if (!ses) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return NULL;
}
tcon = smb2_find_smb_sess_tcon_unlocked(ses, tid);
if (!tcon) {
cifs_put_smb_ses(ses);
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return NULL;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* tcon already has a ref to ses, so we don't need ses anymore */
cifs_put_smb_ses(ses);
@@ -640,13 +640,13 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server)
if (!is_signed)
return 0;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->ops->need_neg &&
server->ops->need_neg(server)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return 0;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (!is_binding && !server->session_estab) {
strncpy(shdr->Signature, "BSRSPYL", 8);
return 0;
@@ -762,28 +762,28 @@ static int
smb2_get_mid_entry(struct cifs_ses *ses, struct TCP_Server_Info *server,
struct smb2_hdr *shdr, struct mid_q_entry **mid)
{
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
if (server->tcpStatus == CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
return -EAGAIN;
}
if (server->tcpStatus == CifsNeedNegotiate &&
shdr->Command != SMB2_NEGOTIATE) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
if (ses->ses_status == SES_NEW) {
if ((shdr->Command != SMB2_SESSION_SETUP) &&
(shdr->Command != SMB2_NEGOTIATE)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
/* else ok - we are setting up session */
@@ -791,12 +791,12 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct TCP_Server_Info *server,
if (ses->ses_status == SES_EXITING) {
if (shdr->Command != SMB2_LOGOFF) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
/* else ok - we are shutting down the session */
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
*mid = smb2_mid_entry_alloc(shdr, server);
if (*mid == NULL)
@@ -869,13 +869,13 @@ smb2_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst)
(struct smb2_hdr *)rqst->rq_iov[0].iov_base;
struct mid_q_entry *mid;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsNeedNegotiate &&
shdr->Command != SMB2_NEGOTIATE) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return ERR_PTR(-EAGAIN);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
smb2_seq_num_into_buf(server, shdr);
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index dac8d6f9b309..5a7b4aa09720 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -577,12 +577,12 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,
} else {
spin_unlock(&server->req_lock);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/*
* For normal commands, reserve the last MAX_COMPOUND
@@ -725,11 +725,11 @@ cifs_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
struct mid_q_entry **ppmidQ)
{
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (ses->ses_status == SES_NEW) {
if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) &&
(in_buf->Command != SMB_COM_NEGOTIATE)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
/* else ok - we are setting up session */
@@ -738,12 +738,12 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
if (ses->ses_status == SES_EXITING) {
/* check if SMB session is bad because we are setting it up */
if (in_buf->Command != SMB_COM_LOGOFF_ANDX) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -EAGAIN;
}
/* else ok - we are shutting down session */
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
*ppmidQ = AllocMidQEntry(in_buf, ses->server);
if (*ppmidQ == NULL)
@@ -1078,12 +1078,12 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
return -EIO;
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/*
* Wait for all the requests to become available.
@@ -1186,17 +1186,17 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_server_lock(server);
smb311_update_preauth_hash(ses, server, rqst[0].rq_iov, rqst[0].rq_nvec);
cifs_server_unlock(server);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
for (i = 0; i < num_rqst; i++) {
rc = wait_for_response(server, midQ[i]);
@@ -1259,19 +1259,19 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
/*
* Compounding is never used during session establish.
*/
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
struct kvec iov = {
.iov_base = resp_iov[0].iov_base,
.iov_len = resp_iov[0].iov_len
};
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
cifs_server_lock(server);
smb311_update_preauth_hash(ses, server, &iov, 1);
cifs_server_unlock(server);
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
out:
/*
@@ -1360,12 +1360,12 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
return -EIO;
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* Ensure that we do not send more than 50 overlapping requests
to the same server. We may make this configurable later or
@@ -1505,12 +1505,12 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
return -EIO;
}
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if (server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
return -ENOENT;
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
/* Ensure that we do not send more than 50 overlapping requests
to the same server. We may make this configurable later or
@@ -1568,12 +1568,12 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
(server->tcpStatus != CifsNew)));
/* Were we interrupted by a signal ? */
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
if ((rc == -ERESTARTSYS) &&
(midQ->mid_state == MID_REQUEST_SUBMITTED) &&
((server->tcpStatus == CifsGood) ||
(server->tcpStatus == CifsNew))) {
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
if (in_buf->Command == SMB_COM_TRANSACTION2) {
/* POSIX lock. We send a NT_CANCEL SMB to cause the
@@ -1612,9 +1612,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
/* We got the response - restart system call. */
rstart = 1;
- spin_lock(&cifs_tcp_ses_lock);
+ spin_lock(&g_servers_lock);
}
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&g_servers_lock);
rc = cifs_sync_mid_result(midQ, server);
if (rc != 0)
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 02/14] cifs: rename xid/mid globals
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 03/14] cifs: rename global counters Enzo Matsumiya
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename XID and MID global locks and counters.
Convert from CamelCase to snake_case.
Prepend "g_" to indicate a global.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 18 +++++++++---------
fs/cifs/cifsfs.c | 6 +++---
fs/cifs/cifsglob.h | 12 ++++++------
fs/cifs/connect.c | 14 +++++++-------
fs/cifs/misc.c | 22 +++++++++++-----------
fs/cifs/smb1ops.c | 10 +++++-----
fs/cifs/smb2ops.c | 24 ++++++++++++------------
fs/cifs/smb2transport.c | 4 ++--
fs/cifs/transport.c | 38 +++++++++++++++++++-------------------
9 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index a8e05ab5c9bf..246a9bc972fe 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -55,7 +55,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
return;
cifs_dbg(VFS, "Dump pending requests:\n");
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
mid_entry->mid_state,
@@ -78,7 +78,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
mid_entry->resp_buf, 62);
}
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
#endif /* CONFIG_CIFS_DEBUG2 */
}
@@ -262,7 +262,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
#endif
seq_putc(m, '\n');
seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
- seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
+ seq_printf(m, "Active VFS Requests: %d\n", g_total_active_xid);
seq_printf(m, "\nServers: ");
@@ -463,7 +463,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\n\t\t[NONE]");
seq_puts(m, "\n\n\tMIDs: ");
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
seq_printf(m, "\n\tState: %d com: %d pid:"
" %d cbdata: %p mid %llu\n",
@@ -473,7 +473,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
mid_entry->callback_data,
mid_entry->mid);
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
seq_printf(m, "\n--\n");
}
if (c == 0)
@@ -507,10 +507,10 @@ static ssize_t cifs_stats_proc_write(struct file *file,
atomic_set(&tcpSesReconnectCount, 0);
atomic_set(&tconInfoReconnectCount, 0);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
GlobalMaxActiveXid = 0;
- GlobalCurrentXid = 0;
- spin_unlock(&GlobalMid_Lock);
+ g_current_xid = 0;
+ spin_unlock(&g_mid_lock);
spin_lock(&g_servers_lock);
list_for_each_entry(server, &g_servers_list, server_head) {
server->max_in_flight = 0;
@@ -575,7 +575,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
seq_printf(m,
"Total vfs operations: %d maximum at one time: %d\n",
- GlobalCurrentXid, GlobalMaxActiveXid);
+ g_current_xid, GlobalMaxActiveXid);
i = 0;
spin_lock(&g_servers_lock);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f40dffbc363d..88bee6544269 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1601,11 +1601,11 @@ init_cifs(void)
#endif /* CONFIG_CIFS_STATS2 */
atomic_set(&mid_count, 0);
- GlobalCurrentXid = 0;
- GlobalTotalActiveXid = 0;
+ g_current_xid = 0;
+ g_total_active_xid = 0;
GlobalMaxActiveXid = 0;
spin_lock_init(&g_servers_lock);
- spin_lock_init(&GlobalMid_Lock);
+ spin_lock_init(&g_mid_lock);
cifs_lock_secret = get_random_u32();
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 79b14f5f6afe..2701d741ddbd 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -658,7 +658,7 @@ struct TCP_Server_Info {
/* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
unsigned int capabilities; /* selective disabling of caps by smb sess */
int timeAdj; /* Adjust for difference in server time zone in sec */
- __u64 CurrentMid; /* multiplex id - rotating counter, protected by GlobalMid_Lock */
+ __u64 CurrentMid; /* multiplex id - rotating counter, protected by g_mid_lock */
char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
/* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
@@ -1904,7 +1904,7 @@ require use of the stronger protocol */
*
* Spinlocks
* ---------
- * GlobalMid_Lock protects:
+ * g_mid_lock protects:
* list operations on pending_mid_q and oplockQ
* updates to XID counters, multiplex id and SMB sequence numbers
* list operations on global DnotifyReqList
@@ -1958,10 +1958,10 @@ extern spinlock_t g_servers_lock;
/*
* Global transaction id (XID) information
*/
-GLOBAL_EXTERN unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN spinlock_t GlobalMid_Lock; /* protects above & list operations */
+GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */
+GLOBAL_EXTERN unsigned int g_total_active_xid; /* prot by g_mid_lock */
+GLOBAL_EXTERN unsigned int g_max_active_xid /* prot by g_mid_lock */
+GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations */
/* on midQ entries */
/*
* Global counters, updated atomically
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c0e712917fd6..e44e65cd53d2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -323,7 +323,7 @@ cifs_abort_connection(struct TCP_Server_Info *server)
/* mark submitted MIDs for retry and issue callback */
INIT_LIST_HEAD(&retry_list);
cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_entry_safe(mid, nmid, &server->pending_mid_q, qhead) {
kref_get(&mid->refcount);
if (mid->mid_state == MID_REQUEST_SUBMITTED)
@@ -331,7 +331,7 @@ cifs_abort_connection(struct TCP_Server_Info *server)
list_move(&mid->qhead, &retry_list);
mid->mid_flags |= MID_DELETED;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
cifs_server_unlock(server);
cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
@@ -849,7 +849,7 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
#ifdef CONFIG_CIFS_STATS2
mid->when_received = jiffies;
#endif
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (!malformed)
mid->mid_state = MID_RESPONSE_RECEIVED;
else
@@ -859,12 +859,12 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
* function has finished processing it is a bug.
*/
if (mid->mid_flags & MID_DELETED) {
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
pr_warn_once("trying to dequeue a deleted mid\n");
} else {
list_del_init(&mid->qhead);
mid->mid_flags |= MID_DELETED;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
}
@@ -948,7 +948,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
struct list_head *tmp, *tmp2;
INIT_LIST_HEAD(&dispose_list);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
cifs_dbg(FYI, "Clearing mid %llu\n", mid_entry->mid);
@@ -957,7 +957,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
list_move(&mid_entry->qhead, &dispose_list);
mid_entry->mid_flags |= MID_DELETED;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
/* now walk dispose list and issue callbacks */
list_for_each_safe(tmp, tmp2, &dispose_list) {
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index e88f33b8159f..9f450a1c947a 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -38,27 +38,27 @@ _get_xid(void)
{
unsigned int xid;
- spin_lock(&GlobalMid_Lock);
- GlobalTotalActiveXid++;
+ spin_lock(&g_mid_lock);
+ g_total_active_xid++;
/* keep high water mark for number of simultaneous ops in filesystem */
- if (GlobalTotalActiveXid > GlobalMaxActiveXid)
- GlobalMaxActiveXid = GlobalTotalActiveXid;
- if (GlobalTotalActiveXid > 65000)
+ if (g_total_active_xid > GlobalMaxActiveXid)
+ GlobalMaxActiveXid = g_total_active_xid;
+ if (g_total_active_xid > 65000)
cifs_dbg(FYI, "warning: more than 65000 requests active\n");
- xid = GlobalCurrentXid++;
- spin_unlock(&GlobalMid_Lock);
+ xid = g_current_xid++;
+ spin_unlock(&g_mid_lock);
return xid;
}
void
_free_xid(unsigned int xid)
{
- spin_lock(&GlobalMid_Lock);
- /* if (GlobalTotalActiveXid == 0)
+ spin_lock(&g_mid_lock);
+ /* if (g_total_active_xid == 0)
BUG(); */
- GlobalTotalActiveXid--;
- spin_unlock(&GlobalMid_Lock);
+ g_total_active_xid--;
+ spin_unlock(&g_mid_lock);
}
struct cifs_ses *
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 2e20ee4dab7b..f557856be943 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -92,17 +92,17 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer)
struct smb_hdr *buf = (struct smb_hdr *)buffer;
struct mid_q_entry *mid;
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_entry(mid, &server->pending_mid_q, qhead) {
if (compare_mid(mid->mid, buf) &&
mid->mid_state == MID_REQUEST_SUBMITTED &&
le16_to_cpu(mid->command) == buf->Command) {
kref_get(&mid->refcount);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return mid;
}
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return NULL;
}
@@ -166,7 +166,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
__u16 last_mid, cur_mid;
bool collision, reconnect = false;
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
/* mid is 16 bit only for CIFS/SMB */
cur_mid = (__u16)((server->CurrentMid) & 0xffff);
@@ -225,7 +225,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
}
cur_mid++;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
if (reconnect) {
cifs_signal_cifsd_for_reconnect(server, false);
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index a268454868ba..7a8f3744b895 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -319,19 +319,19 @@ smb2_get_next_mid(struct TCP_Server_Info *server)
{
__u64 mid;
/* for SMB2 we need the current value */
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
mid = server->CurrentMid++;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return mid;
}
static void
smb2_revert_current_mid(struct TCP_Server_Info *server, const unsigned int val)
{
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (server->CurrentMid >= val)
server->CurrentMid -= val;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
static struct mid_q_entry *
@@ -346,7 +346,7 @@ __smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)
return NULL;
}
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_for_each_entry(mid, &server->pending_mid_q, qhead) {
if ((mid->mid == wire_mid) &&
(mid->mid_state == MID_REQUEST_SUBMITTED) &&
@@ -356,11 +356,11 @@ __smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)
list_del_init(&mid->qhead);
mid->mid_flags |= MID_DELETED;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return mid;
}
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return NULL;
}
@@ -403,9 +403,9 @@ smb2_negotiate(const unsigned int xid,
{
int rc;
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
server->CurrentMid = 0;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
rc = SMB2_negotiate(xid, ses, server);
/* BB we probably don't need to retry with modern servers */
if (rc == -EAGAIN)
@@ -5079,10 +5079,10 @@ static void smb2_decrypt_offload(struct work_struct *work)
mid->callback(mid);
} else {
spin_lock(&g_servers_lock);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (dw->server->tcpStatus == CifsNeedReconnect) {
mid->mid_state = MID_RETRY_NEEDED;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
mid->callback(mid);
} else {
@@ -5090,7 +5090,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
mid->mid_flags &= ~(MID_DELETED);
list_add_tail(&mid->qhead,
&dw->server->pending_mid_q);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
}
}
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 36c08e369841..12220cb4fc10 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -801,9 +801,9 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct TCP_Server_Info *server,
*mid = smb2_mid_entry_alloc(shdr, server);
if (*mid == NULL)
return -ENOMEM;
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_add_tail(&(*mid)->qhead, &server->pending_mid_q);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return 0;
}
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 5a7b4aa09720..81041c87db3e 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -154,9 +154,9 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)
void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)
{
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
kref_put(&midEntry->refcount, _cifs_mid_q_entry_release);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
void DeleteMidQEntry(struct mid_q_entry *midEntry)
@@ -167,12 +167,12 @@ void DeleteMidQEntry(struct mid_q_entry *midEntry)
void
cifs_delete_mid(struct mid_q_entry *mid)
{
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (!(mid->mid_flags & MID_DELETED)) {
list_del_init(&mid->qhead);
mid->mid_flags |= MID_DELETED;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
DeleteMidQEntry(mid);
}
@@ -748,9 +748,9 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
*ppmidQ = AllocMidQEntry(in_buf, ses->server);
if (*ppmidQ == NULL)
return -ENOMEM;
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_add_tail(&(*ppmidQ)->qhead, &ses->server->pending_mid_q);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return 0;
}
@@ -849,9 +849,9 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
mid->mid_state = MID_REQUEST_SUBMITTED;
/* put it on the pending_mid_q */
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
list_add_tail(&mid->qhead, &server->pending_mid_q);
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
/*
* Need to store the time in mid before calling I/O. For call_async,
@@ -912,10 +912,10 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
cifs_dbg(FYI, "%s: cmd=%d mid=%llu state=%d\n",
__func__, le16_to_cpu(mid->command), mid->mid, mid->mid_state);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
switch (mid->mid_state) {
case MID_RESPONSE_RECEIVED:
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return rc;
case MID_RETRY_NEEDED:
rc = -EAGAIN;
@@ -935,7 +935,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
__func__, mid->mid, mid->mid_state);
rc = -EIO;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
DeleteMidQEntry(mid);
return rc;
@@ -1208,14 +1208,14 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
cifs_server_dbg(FYI, "Cancelling wait for mid %llu cmd: %d\n",
midQ[i]->mid, le16_to_cpu(midQ[i]->command));
send_cancel(server, &rqst[i], midQ[i]);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
midQ[i]->mid_flags |= MID_WAIT_CANCELLED;
if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) {
midQ[i]->callback = cifs_cancelled_callback;
cancelled_mid[i] = true;
credits[i].value = 0;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
}
@@ -1419,15 +1419,15 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
rc = wait_for_response(server, midQ);
if (rc != 0) {
send_cancel(server, &rqst, midQ);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
/* no longer considered to be "in-flight" */
midQ->callback = DeleteMidQEntry;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
add_credits(server, &credits, 0);
return rc;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
rc = cifs_sync_mid_result(midQ, server);
@@ -1600,14 +1600,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
rc = wait_for_response(server, midQ);
if (rc) {
send_cancel(server, &rqst, midQ);
- spin_lock(&GlobalMid_Lock);
+ spin_lock(&g_mid_lock);
if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
/* no longer considered to be "in-flight" */
midQ->callback = DeleteMidQEntry;
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
return rc;
}
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&g_mid_lock);
}
/* We got the response - restart system call. */
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 03/14] cifs: rename global counters
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 02/14] cifs: rename xid/mid globals Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 06/14] cifs: convert server info vars to snake_case Enzo Matsumiya
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename global counters from CamelCase to snake_case.
Rename server counters from "tcpSes" to use "servers" instead.
Prepend "g_" to indicate global.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 16 ++++++++--------
fs/cifs/cifsfs.c | 14 +++++++-------
fs/cifs/cifsglob.h | 18 +++++++++---------
fs/cifs/cifssmb.c | 2 +-
fs/cifs/connect.c | 10 +++++-----
fs/cifs/misc.c | 12 ++++++------
fs/cifs/smb2pdu.c | 2 +-
7 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 246a9bc972fe..2f0ca888330b 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -504,11 +504,11 @@ static ssize_t cifs_stats_proc_write(struct file *file,
atomic_set(&total_buf_alloc_count, 0);
atomic_set(&total_small_buf_alloc_count, 0);
#endif /* CONFIG_CIFS_STATS2 */
- atomic_set(&tcpSesReconnectCount, 0);
- atomic_set(&tconInfoReconnectCount, 0);
+ atomic_set(&g_server_reconnect_count, 0);
+ atomic_set(&g_tcon_reconnect_count, 0);
spin_lock(&g_mid_lock);
- GlobalMaxActiveXid = 0;
+ g_max_active_xid = 0;
g_current_xid = 0;
spin_unlock(&g_mid_lock);
spin_lock(&g_servers_lock);
@@ -554,12 +554,12 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
struct cifs_tcon *tcon;
seq_printf(m, "Resources in use\nCIFS Session: %d\n",
- sesInfoAllocCount.counter);
+ g_ses_alloc_count.counter);
seq_printf(m, "Share (unique mount targets): %d\n",
- tconInfoAllocCount.counter);
+ g_tcon_alloc_count.counter);
seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d\n",
buf_alloc_count.counter,
- cifs_min_rcv + tcpSesAllocCount.counter);
+ cifs_min_rcv + g_server_alloc_count.counter);
seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
small_buf_alloc_count.counter, cifs_min_small);
#ifdef CONFIG_CIFS_STATS2
@@ -571,11 +571,11 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&mid_count));
seq_printf(m,
"\n%d session %d share reconnects\n",
- tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
+ g_server_reconnect_count.counter, g_tcon_reconnect_count.counter);
seq_printf(m,
"Total vfs operations: %d maximum at one time: %d\n",
- g_current_xid, GlobalMaxActiveXid);
+ g_current_xid, g_max_active_xid);
i = 0;
spin_lock(&g_servers_lock);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 88bee6544269..8083fffeac0a 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1581,12 +1581,12 @@ init_cifs(void)
/*
* Initialize Global counters
*/
- atomic_set(&sesInfoAllocCount, 0);
- atomic_set(&tconInfoAllocCount, 0);
- atomic_set(&tcpSesNextId, 0);
- atomic_set(&tcpSesAllocCount, 0);
- atomic_set(&tcpSesReconnectCount, 0);
- atomic_set(&tconInfoReconnectCount, 0);
+ atomic_set(&g_ses_alloc_count, 0);
+ atomic_set(&g_tcon_alloc_count, 0);
+ atomic_set(&g_server_next_id, 0);
+ atomic_set(&g_server_alloc_count, 0);
+ atomic_set(&g_server_reconnect_count, 0);
+ atomic_set(&g_tcon_reconnect_count, 0);
atomic_set(&buf_alloc_count, 0);
atomic_set(&small_buf_alloc_count, 0);
@@ -1603,7 +1603,7 @@ init_cifs(void)
atomic_set(&mid_count, 0);
g_current_xid = 0;
g_total_active_xid = 0;
- GlobalMaxActiveXid = 0;
+ g_max_active_xid = 0;
spin_lock_init(&g_servers_lock);
spin_lock_init(&g_mid_lock);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 2701d741ddbd..fcaddcb07a90 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1958,20 +1958,20 @@ extern spinlock_t g_servers_lock;
/*
* Global transaction id (XID) information
*/
-GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */
+GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */
GLOBAL_EXTERN unsigned int g_total_active_xid; /* prot by g_mid_lock */
-GLOBAL_EXTERN unsigned int g_max_active_xid /* prot by g_mid_lock */
-GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations */
+GLOBAL_EXTERN unsigned int g_max_active_xid; /* prot by g_mid_lock */
+GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations */
/* on midQ entries */
/*
* Global counters, updated atomically
*/
-GLOBAL_EXTERN atomic_t sesInfoAllocCount;
-GLOBAL_EXTERN atomic_t tconInfoAllocCount;
-GLOBAL_EXTERN atomic_t tcpSesNextId;
-GLOBAL_EXTERN atomic_t tcpSesAllocCount;
-GLOBAL_EXTERN atomic_t tcpSesReconnectCount;
-GLOBAL_EXTERN atomic_t tconInfoReconnectCount;
+GLOBAL_EXTERN atomic_t g_ses_alloc_count;
+GLOBAL_EXTERN atomic_t g_tcon_alloc_count;
+GLOBAL_EXTERN atomic_t g_server_next_id;
+GLOBAL_EXTERN atomic_t g_server_alloc_count;
+GLOBAL_EXTERN atomic_t g_server_reconnect_count;
+GLOBAL_EXTERN atomic_t g_tcon_reconnect_count;
/* Various Debug counters */
extern atomic_t buf_alloc_count; /* current number allocated */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 80ae1b280b11..ad9071372fa4 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -248,7 +248,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
goto out;
}
- atomic_inc(&tconInfoReconnectCount);
+ atomic_inc(&g_tcon_reconnect_count);
/* tell server Unix caps we support */
if (cap_unix(ses))
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e44e65cd53d2..3aa9c24731b9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -412,7 +412,7 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,
cifs_dbg(FYI, "%s: reconnect error %d\n", __func__, rc);
msleep(3000);
} else {
- atomic_inc(&tcpSesReconnectCount);
+ atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsExiting)
@@ -539,7 +539,7 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)
* process waiting for reconnect will know it needs to re-establish session and tcon
* through the reconnected target server.
*/
- atomic_inc(&tcpSesReconnectCount);
+ atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
if (server->tcpStatus != CifsExiting)
@@ -994,7 +994,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
#endif
kfree(server);
- length = atomic_dec_return(&tcpSesAllocCount);
+ length = atomic_dec_return(&g_server_alloc_count);
if (length > 0)
mempool_resize(cifs_req_poolp, length + cifs_min_rcv);
}
@@ -1117,7 +1117,7 @@ cifs_demultiplex_thread(void *p)
noreclaim_flag = memalloc_noreclaim_save();
cifs_dbg(FYI, "Demultiplex PID: %d\n", task_pid_nr(current));
- length = atomic_inc_return(&tcpSesAllocCount);
+ length = atomic_inc_return(&g_server_alloc_count);
if (length > 1)
mempool_resize(cifs_req_poolp, length + cifs_min_rcv);
@@ -1582,7 +1582,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
server->vals = ctx->vals;
cifs_set_net_ns(server, get_net(current->nsproxy->net_ns));
- server->conn_id = atomic_inc_return(&tcpSesNextId);
+ server->conn_id = atomic_inc_return(&g_server_next_id);
server->noblockcnt = ctx->rootfs;
server->noblocksnd = ctx->noblocksnd || ctx->rootfs;
server->noautotune = ctx->noautotune;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 9f450a1c947a..8f2a06e47098 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -42,8 +42,8 @@ _get_xid(void)
g_total_active_xid++;
/* keep high water mark for number of simultaneous ops in filesystem */
- if (g_total_active_xid > GlobalMaxActiveXid)
- GlobalMaxActiveXid = g_total_active_xid;
+ if (g_total_active_xid > g_max_active_xid)
+ g_max_active_xid = g_total_active_xid;
if (g_total_active_xid > 65000)
cifs_dbg(FYI, "warning: more than 65000 requests active\n");
xid = g_current_xid++;
@@ -68,7 +68,7 @@ sesInfoAlloc(void)
ret_buf = kzalloc(sizeof(struct cifs_ses), GFP_KERNEL);
if (ret_buf) {
- atomic_inc(&sesInfoAllocCount);
+ atomic_inc(&g_ses_alloc_count);
ret_buf->ses_status = SES_NEW;
++ret_buf->ses_count;
INIT_LIST_HEAD(&ret_buf->smb_ses_list);
@@ -91,7 +91,7 @@ sesInfoFree(struct cifs_ses *buf_to_free)
return;
}
- atomic_dec(&sesInfoAllocCount);
+ atomic_dec(&g_ses_alloc_count);
kfree(buf_to_free->serverOS);
kfree(buf_to_free->serverDomain);
kfree(buf_to_free->serverNOS);
@@ -123,7 +123,7 @@ tconInfoAlloc(void)
INIT_LIST_HEAD(&ret_buf->crfid.dirents.entries);
mutex_init(&ret_buf->crfid.dirents.de_mutex);
- atomic_inc(&tconInfoAllocCount);
+ atomic_inc(&g_tcon_alloc_count);
ret_buf->status = TID_NEW;
++ret_buf->tc_count;
INIT_LIST_HEAD(&ret_buf->openFileList);
@@ -144,7 +144,7 @@ tconInfoFree(struct cifs_tcon *buf_to_free)
cifs_dbg(FYI, "Null buffer passed to tconInfoFree\n");
return;
}
- atomic_dec(&tconInfoAllocCount);
+ atomic_dec(&g_tcon_alloc_count);
kfree(buf_to_free->nativeFileSystem);
kfree_sensitive(buf_to_free->password);
kfree(buf_to_free->crfid.fid);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index f103ece8a3c9..66c1f1afb453 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -321,7 +321,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
if (smb2_command != SMB2_INTERNAL_CMD)
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
- atomic_inc(&tconInfoReconnectCount);
+ atomic_inc(&g_tcon_reconnect_count);
out:
/*
* Check if handle based operation so we know whether we can continue
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 06/14] cifs: convert server info vars to snake_case
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (2 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 03/14] cifs: rename global counters Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 07/14] cifs: typedef server status enum Enzo Matsumiya
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename cifs_server_info variables that were still in CamelCase or
Camel_Case to snake_case.
Rename [Alloc,Delete]MidQEntry() functions to
cifs_{alloc,delete}_mid_q_entry().
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 4 +-
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 24 ++++++------
fs/cifs/cifsproto.h | 4 +-
fs/cifs/cifssmb.c | 38 +++++++++----------
fs/cifs/connect.c | 84 ++++++++++++++++++++---------------------
fs/cifs/file.c | 8 ++--
fs/cifs/inode.c | 8 ++--
fs/cifs/readdir.c | 2 +-
fs/cifs/sess.c | 2 +-
fs/cifs/smb1ops.c | 12 +++---
fs/cifs/smb2file.c | 8 ++--
fs/cifs/smb2ops.c | 36 +++++++++---------
fs/cifs/smb2pdu.c | 20 +++++-----
fs/cifs/smb2transport.c | 10 ++---
fs/cifs/transport.c | 54 +++++++++++++-------------
16 files changed, 158 insertions(+), 158 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 50bf6d849285..eb24928e1298 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -136,7 +136,7 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
i+1, server->conn_id,
server->credits,
server->dialect,
- server->tcpStatus,
+ server->status,
server->reconnect_instance,
server->srv_count,
server->sec_mode,
@@ -364,7 +364,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\nRDMA ");
seq_printf(m, "\nTCP status: %d Instance: %d"
"\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
- server->tcpStatus,
+ server->status,
server->reconnect_instance,
server->srv_count,
server->sec_mode, in_flight(server));
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index ba70b8a50b3e..7d8020b90220 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -143,7 +143,7 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
- server->tcpStatus == CifsNeedNegotiate) {
+ server->status == CifsNeedNegotiate) {
spin_unlock(&g_servers_lock);
return rc;
}
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 0d3b2487e7d7..12b6aafa5fa6 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -608,11 +608,11 @@ struct cifs_server_info {
__u64 conn_id; /* connection identifier (useful for debugging) */
int srv_count; /* reference counter */
/* 15 character server name + 0x20 16th byte indicating type = srv */
- char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
+ char server_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL];
struct smb_version_operations *ops;
struct smb_version_values *vals;
- /* updates to tcpStatus protected by g_servers_lock */
- enum statusEnum tcpStatus; /* what we think the status is */
+ /* updates to status protected by g_servers_lock */
+ enum statusEnum status; /* what we think the status is */
char *hostname; /* hostname portion of UNC string */
struct socket *ssocket;
struct sockaddr_storage dstaddr;
@@ -635,7 +635,7 @@ struct cifs_server_info {
struct mutex _srv_mutex;
unsigned int nofs_flag;
struct task_struct *tsk;
- char server_GUID[16];
+ char server_guid[16];
__u16 sec_mode;
bool sign; /* is signing enabled on this connection? */
bool ignore_signature:1; /* skip validation of signatures in SMB2/3 rsp */
@@ -646,19 +646,19 @@ struct cifs_server_info {
__u8 client_guid[SMB2_CLIENT_GUID_SIZE]; /* Client GUID */
u16 dialect; /* dialect index that server chose */
bool oplocks:1; /* enable oplocks */
- unsigned int maxReq; /* Clients should submit no more */
- /* than maxReq distinct unanswered SMBs to the server when using */
+ unsigned int max_req; /* Clients should submit no more */
+ /* than max_req distinct unanswered SMBs to the server when using */
/* multiplexed reads or writes (for SMB1/CIFS only, not SMB2/SMB3) */
- unsigned int maxBuf; /* maxBuf specifies the maximum */
+ unsigned int max_buf; /* max_buf specifies the maximum */
/* message size the server can send or receive for non-raw SMBs */
- /* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */
+ /* max_buf is returned by SMB NegotiateProtocol so max_buf is only 0 */
/* when socket is setup (and during reconnect) before NegProt sent */
unsigned int max_rw; /* maxRw specifies the maximum */
/* message size the server can send or receive for */
/* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
unsigned int capabilities; /* selective disabling of caps by smb sess */
- int timeAdj; /* Adjust for difference in server time zone in sec */
- __u64 CurrentMid; /* multiplex id - rotating counter, protected by g_mid_lock */
+ int time_adjust; /* Adjust for difference in server time zone in sec */
+ __u64 current_mid; /* multiplex id - rotating counter, protected by g_mid_lock */
char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
/* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
@@ -1908,8 +1908,8 @@ require use of the stronger protocol */
* list operations on pending_mid_q and oplockQ
* updates to XID counters, multiplex id and SMB sequence numbers
* list operations on global DnotifyReqList
- * updates to ses->status and cifs_server_info->tcpStatus
- * updates to server->CurrentMid
+ * updates to ses->status and cifs_server_info->status
+ * updates to server->current_mid
* g_servers_lock protects:
* list operations on tcp and SMB session lists
* tcon->open_file_lock protects the list of open files hanging off the tcon
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 265a4f25ac93..fce0fd8b1024 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -79,9 +79,9 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,
const char *fullpath, const struct dfs_info3_param *ref,
char **devname);
/* extern void renew_parental_timestamps(struct dentry *direntry);*/
-extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
+extern struct mid_q_entry *cifs_alloc_mid_q_entry(const struct smb_hdr *smb_buffer,
struct cifs_server_info *server);
-extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
+extern void cifs_delete_mid_q_entry(struct mid_q_entry *midEntry);
extern void cifs_delete_mid(struct mid_q_entry *mid);
extern void cifs_mid_q_entry_release(struct mid_q_entry *midEntry);
extern void cifs_wake_up_task(struct mid_q_entry *mid);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index fd5bcebe1abf..326db1db353e 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -154,9 +154,9 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->tcpStatus == CifsNeedReconnect) {
+ while (server->status == CifsNeedReconnect) {
rc = wait_event_interruptible_timeout(server->response_q,
- (server->tcpStatus != CifsNeedReconnect),
+ (server->status != CifsNeedReconnect),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -166,7 +166,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->tcpStatus != CifsNeedReconnect) {
+ if (server->status != CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
break;
}
@@ -199,10 +199,10 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
/*
* Recheck after acquire mutex. If another thread is negotiating
* and the server never sends an answer the socket will be closed
- * and tcpStatus set to reconnect.
+ * and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedReconnect) {
+ if (server->status == CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
@@ -435,13 +435,13 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)
spin_lock(&g_servers_lock);
if (server->srv_count > 1) {
spin_unlock(&g_servers_lock);
- if (memcmp(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE) != 0) {
+ if (memcmp(server->server_guid, guid, SMB1_CLIENT_GUID_SIZE) != 0) {
cifs_dbg(FYI, "server UID changed\n");
- memcpy(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE);
+ memcpy(server->server_guid, guid, SMB1_CLIENT_GUID_SIZE);
}
} else {
spin_unlock(&g_servers_lock);
- memcpy(server->server_GUID, guid, SMB1_CLIENT_GUID_SIZE);
+ memcpy(server->server_guid, guid, SMB1_CLIENT_GUID_SIZE);
}
if (count == SMB1_CLIENT_GUID_SIZE) {
@@ -591,18 +591,18 @@ CIFSSMBNegotiate(const unsigned int xid,
/* one byte, so no need to convert this or EncryptionKeyLen from
little endian */
- server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount),
+ server->max_req = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount),
cifs_max_pending);
- set_credits(server, server->maxReq);
+ set_credits(server, server->max_req);
/* probably no need to store and check maxvcs */
- server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize);
+ server->max_buf = le32_to_cpu(pSMBr->MaxBufferSize);
/* set up max_read for readahead check */
- server->max_read = server->maxBuf;
+ server->max_read = server->max_buf;
server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
- cifs_dbg(NOISY, "Max buf = %d\n", ses->server->maxBuf);
+ cifs_dbg(NOISY, "Max buf = %d\n", ses->server->max_buf);
server->capabilities = le32_to_cpu(pSMBr->Capabilities);
- server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone);
- server->timeAdj *= 60;
+ server->time_adjust = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone);
+ server->time_adjust *= 60;
if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) {
server->negflavor = CIFS_NEGFLAVOR_UNENCAP;
@@ -684,7 +684,7 @@ cifs_echo_callback(struct mid_q_entry *mid)
struct cifs_server_info *server = mid->callback_data;
struct cifs_credits credits = { .value = 1, .instance = 0 };
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(server, &credits, CIFS_ECHO_OP);
}
@@ -1607,7 +1607,7 @@ cifs_readv_callback(struct mid_q_entry *mid)
}
queue_work(cifsiod_wq, &rdata->work);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(server, &credits, 0);
}
@@ -1849,7 +1849,7 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
if (tcon->ses->capabilities & CAP_LARGE_WRITE_X) {
bytes_sent = min_t(const unsigned int, CIFSMaxBufSize, count);
} else {
- bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)
+ bytes_sent = (tcon->ses->server->max_buf - MAX_CIFS_HDR_SIZE)
& ~0xFF;
}
@@ -2132,7 +2132,7 @@ cifs_writev_callback(struct mid_q_entry *mid)
}
queue_work(cifsiod_wq, &wdata->work);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(tcon->ses->server, &credits, 0);
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d8a003c27cf0..4ab1933fca76 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -186,7 +186,7 @@ static void cifs_resolve_server(struct work_struct *work)
}
/*
- * Update the tcpStatus for the server.
+ * Update the status for the server.
* This is used to signal the cifsd thread to call cifs_reconnect
* ONLY cifsd thread should call cifs_reconnect. For any other
* thread, use this function
@@ -207,7 +207,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!all_channels) {
- pserver->tcpStatus = CifsNeedReconnect;
+ pserver->status = CifsNeedReconnect;
spin_unlock(&g_servers_lock);
return;
}
@@ -215,7 +215,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
spin_lock(&ses->chan_lock);
for (i = 0; i < ses->chan_count; i++)
- ses->chans[i].server->tcpStatus = CifsNeedReconnect;
+ ses->chans[i].server->status = CifsNeedReconnect;
spin_unlock(&ses->chan_lock);
}
spin_unlock(&g_servers_lock);
@@ -298,7 +298,7 @@ cifs_abort_connection(struct cifs_server_info *server)
struct mid_q_entry *mid, *nmid;
struct list_head retry_list;
- server->maxBuf = 0;
+ server->max_buf = 0;
server->max_read = 0;
/* do not want to be sending data on a socket we are freeing */
@@ -352,7 +352,7 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
{
spin_lock(&g_servers_lock);
server->nr_targets = num_targets;
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
/* the demux thread will exit normally next time through the loop */
spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
@@ -360,9 +360,9 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
}
cifs_dbg(FYI, "Mark tcp session as need reconnect\n");
- trace_smb3_reconnect(server->CurrentMid, server->conn_id,
+ trace_smb3_reconnect(server->current_mid, server->conn_id,
server->hostname);
- server->tcpStatus = CifsNeedReconnect;
+ server->status = CifsNeedReconnect;
spin_unlock(&g_servers_lock);
return true;
@@ -415,17 +415,17 @@ static int __cifs_reconnect(struct cifs_server_info *server,
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->tcpStatus != CifsExiting)
- server->tcpStatus = CifsNeedNegotiate;
+ if (server->status != CifsExiting)
+ server->status = CifsNeedNegotiate;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
}
- } while (server->tcpStatus == CifsNeedReconnect);
+ } while (server->status == CifsNeedReconnect);
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedNegotiate)
+ if (server->status == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -542,13 +542,13 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->tcpStatus != CifsExiting)
- server->tcpStatus = CifsNeedNegotiate;
+ if (server->status != CifsExiting)
+ server->status = CifsNeedNegotiate;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
- } while (server->tcpStatus == CifsNeedReconnect);
+ } while (server->status == CifsNeedReconnect);
if (target_hint)
dfs_cache_noreq_update_tgthint(refpath, target_hint);
@@ -557,7 +557,7 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
/* Need to set up echo worker again once connection has been established */
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedNegotiate)
+ if (server->status == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -604,9 +604,9 @@ cifs_echo_request(struct work_struct *work)
* Also, no need to ping if we got a response recently.
*/
- if (server->tcpStatus == CifsNeedReconnect ||
- server->tcpStatus == CifsExiting ||
- server->tcpStatus == CifsNew ||
+ if (server->status == CifsNeedReconnect ||
+ server->status == CifsExiting ||
+ server->status == CifsNew ||
(server->ops->can_echo && !server->ops->can_echo(server)) ||
time_before(jiffies, server->lstrp + server->echo_interval - HZ))
goto requeue_echo;
@@ -671,8 +671,8 @@ server_unresponsive(struct cifs_server_info *server)
* a response in >60s.
*/
spin_lock(&g_servers_lock);
- if ((server->tcpStatus == CifsGood ||
- server->tcpStatus == CifsNeedNegotiate) &&
+ if ((server->status == CifsGood ||
+ server->status == CifsNeedNegotiate) &&
(!server->ops->can_echo || server->ops->can_echo(server)) &&
time_after(jiffies, server->lstrp + 3 * server->echo_interval)) {
spin_unlock(&g_servers_lock);
@@ -727,12 +727,12 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
length = sock_recvmsg(server->ssocket, smb_msg, 0);
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ESHUTDOWN;
}
- if (server->tcpStatus == CifsNeedReconnect) {
+ if (server->status == CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
cifs_reconnect(server, false);
return -ECONNABORTED;
@@ -744,7 +744,7 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
length == -EINTR) {
/*
* Minimum sleep to prevent looping, allowing socket
- * to clear and app threads to set tcpStatus
+ * to clear and app threads to set status
* CifsNeedReconnect if server hung.
*/
usleep_range(1000, 2000);
@@ -916,7 +916,7 @@ static void clean_demultiplex_info(struct cifs_server_info *server)
cancel_delayed_work_sync(&server->resolve);
spin_lock(&g_servers_lock);
- server->tcpStatus = CifsExiting;
+ server->status = CifsExiting;
spin_unlock(&g_servers_lock);
wake_up_all(&server->response_q);
@@ -1091,7 +1091,7 @@ smb2_add_credits_from_hdr(char *buffer, struct cifs_server_info *server)
spin_unlock(&server->req_lock);
wake_up(&server->request_q);
- trace_smb3_hdr_credits(server->CurrentMid,
+ trace_smb3_hdr_credits(server->current_mid,
server->conn_id, server->hostname, scredits,
le16_to_cpu(shdr->CreditRequest), in_flight);
cifs_server_dbg(FYI, "%s: added %u credits total=%d\n",
@@ -1123,7 +1123,7 @@ cifs_demultiplex_thread(void *p)
set_freezable();
allow_kernel_signal(SIGKILL);
- while (server->tcpStatus != CifsExiting) {
+ while (server->status != CifsExiting) {
if (try_to_freeze())
continue;
@@ -1534,7 +1534,7 @@ cifs_put_server(struct cifs_server_info *server, int from_reconnect)
cancel_delayed_work_sync(&server->reconnect);
spin_lock(&g_servers_lock);
- server->tcpStatus = CifsExiting;
+ server->status = CifsExiting;
spin_unlock(&g_servers_lock);
cifs_crypto_secmech_release(server);
@@ -1603,7 +1603,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
mutex_init(&server->_srv_mutex);
memcpy(server->workstation_RFC1001_name,
ctx->source_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
- memcpy(server->server_RFC1001_name,
+ memcpy(server->server_rfc1001_name,
ctx->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
server->session_estab = false;
server->sequence_number = 0;
@@ -1632,9 +1632,9 @@ cifs_get_server(struct smb3_fs_context *ctx,
/*
* at this point we are the only ones with the pointer
* to the struct since the kernel thread not created yet
- * no need to spinlock this init of tcpStatus or srv_count
+ * no need to spinlock this init of status or srv_count
*/
- server->tcpStatus = CifsNew;
+ server->status = CifsNew;
++server->srv_count;
if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&
@@ -1682,10 +1682,10 @@ cifs_get_server(struct smb3_fs_context *ctx,
/*
* at this point we are the only ones with the pointer
* to the struct since the kernel thread not created yet
- * no need to spinlock this update of tcpStatus
+ * no need to spinlock this update of status
*/
spin_lock(&g_servers_lock);
- server->tcpStatus = CifsNeedNegotiate;
+ server->status = CifsNeedNegotiate;
spin_unlock(&g_servers_lock);
if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
@@ -2767,10 +2767,10 @@ ip_rfc1001_connect(struct cifs_server_info *server)
if (ses_init_buf) {
ses_init_buf->trailer.session_req.called_len = 32;
- if (server->server_RFC1001_name[0] != 0)
+ if (server->server_rfc1001_name[0] != 0)
rfc1002mangle(ses_init_buf->trailer.
session_req.called_name,
- server->server_RFC1001_name,
+ server->server_rfc1001_name,
RFC1001_NAME_LEN_WITH_NULL);
else
rfc1002mangle(ses_init_buf->trailer.
@@ -3179,7 +3179,7 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
*/
reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx);
spin_lock(&g_servers_lock);
- if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
+ if ((tcon->ses->server->status == CifsNeedReconnect) &&
(le64_to_cpu(tcon->fsUnixInfo.Capability) &
CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)) {
spin_unlock(&g_servers_lock);
@@ -3988,25 +3988,25 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,
/* only send once per connect */
spin_lock(&g_servers_lock);
if (!server->ops->need_neg(server) ||
- server->tcpStatus != CifsNeedNegotiate) {
+ server->status != CifsNeedNegotiate) {
spin_unlock(&g_servers_lock);
return 0;
}
- server->tcpStatus = CifsInNegotiate;
+ server->status = CifsInNegotiate;
spin_unlock(&g_servers_lock);
rc = server->ops->negotiate(xid, ses, server);
if (rc == 0) {
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsInNegotiate)
- server->tcpStatus = CifsGood;
+ if (server->status == CifsInNegotiate)
+ server->status = CifsGood;
else
rc = -EHOSTDOWN;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsInNegotiate)
- server->tcpStatus = CifsNeedNegotiate;
+ if (server->status == CifsInNegotiate)
+ server->status = CifsNeedNegotiate;
spin_unlock(&g_servers_lock);
}
@@ -4067,7 +4067,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
}
cifs_dbg(FYI, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d\n",
- server->sec_mode, server->capabilities, server->timeAdj);
+ server->sec_mode, server->capabilities, server->time_adjust);
if (server->ops->sess_setup)
rc = server->ops->sess_setup(xid, ses, server, nls_info);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 6d2efcdcfe7e..c3561ac3c6d8 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1267,10 +1267,10 @@ cifs_push_mandatory_locks(struct cifs_file_info *cfile)
tcon = tlink_tcon(cfile->tlink);
/*
- * Accessing maxBuf is racy with cifs_reconnect - need to store value
+ * Accessing max_buf is racy with cifs_reconnect - need to store value
* and check it before using.
*/
- max_buf = tcon->ses->server->maxBuf;
+ max_buf = tcon->ses->server->max_buf;
if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) {
free_xid(xid);
return -EINVAL;
@@ -1611,10 +1611,10 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
INIT_LIST_HEAD(&tmp_llist);
/*
- * Accessing maxBuf is racy with cifs_reconnect - need to store value
+ * Accessing max_buf is racy with cifs_reconnect - need to store value
* and check it before using.
*/
- max_buf = tcon->ses->server->maxBuf;
+ max_buf = tcon->ses->server->max_buf;
if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE)))
return -EINVAL;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 6ae0c063841e..7dbbb2e4dafd 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -613,8 +613,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo *
fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
if (adjust_tz) {
- fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj;
- fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj;
+ fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust;
+ fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust;
}
fattr->cf_eof = le64_to_cpu(info->EndOfFile);
@@ -669,8 +669,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
if (adjust_tz) {
- fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj;
- fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj;
+ fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust;
+ fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust;
}
fattr->cf_eof = le64_to_cpu(info->EndOfFile);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 2820aa1f16ec..dbdabb83ea03 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -318,7 +318,7 @@ static void
cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info,
struct cifs_sb_info *cifs_sb)
{
- int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->timeAdj;
+ int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->time_adjust;
memset(fattr, 0, sizeof(*fattr));
fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index c63d9a5058ea..2584b150a648 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -514,7 +514,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses,
pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32,
CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4,
USHRT_MAX));
- pSMB->req.MaxMpxCount = cpu_to_le16(server->maxReq);
+ pSMB->req.MaxMpxCount = cpu_to_le16(server->max_req);
pSMB->req.VcNumber = cpu_to_le16(1);
/* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 1f4f7d78dfee..8b2a504c92f1 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -169,7 +169,7 @@ cifs_get_next_mid(struct cifs_server_info *server)
spin_lock(&g_mid_lock);
/* mid is 16 bit only for CIFS/SMB */
- cur_mid = (__u16)((server->CurrentMid) & 0xffff);
+ cur_mid = (__u16)((server->current_mid) & 0xffff);
/* we do not want to loop forever */
last_mid = cur_mid;
cur_mid++;
@@ -220,7 +220,7 @@ cifs_get_next_mid(struct cifs_server_info *server)
if (!collision) {
mid = (__u64)cur_mid;
- server->CurrentMid = mid;
+ server->current_mid = mid;
break;
}
cur_mid++;
@@ -416,7 +416,7 @@ cifs_check_trans2(struct mid_q_entry *mid, struct cifs_server_info *server,
static bool
cifs_need_neg(struct cifs_server_info *server)
{
- return server->maxBuf == 0;
+ return server->max_buf == 0;
}
static int
@@ -463,7 +463,7 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
if (!(server->capabilities & CAP_LARGE_WRITE_X) ||
(!(server->capabilities & CAP_UNIX) && server->sign))
wsize = min_t(unsigned int, wsize,
- server->maxBuf - sizeof(WRITE_REQ) + 4);
+ server->max_buf - sizeof(WRITE_REQ) + 4);
/* hard limit of CIFS_MAX_WSIZE */
wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);
@@ -495,7 +495,7 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
else if (server->capabilities & CAP_LARGE_READ_X)
defsize = CIFS_DEFAULT_NON_POSIX_RSIZE;
else
- defsize = server->maxBuf - sizeof(READ_RSP);
+ defsize = server->max_buf - sizeof(READ_RSP);
rsize = ctx->rsize ? ctx->rsize : defsize;
@@ -1024,7 +1024,7 @@ cifs_dir_needs_close(struct cifs_file_info *cfile)
static bool
cifs_can_echo(struct cifs_server_info *server)
{
- if (server->tcpStatus == CifsGood)
+ if (server->status == CifsGood)
return true;
return false;
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index 25397786a781..79b28a52f67e 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -116,10 +116,10 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
INIT_LIST_HEAD(&tmp_llist);
/*
- * Accessing maxBuf is racy with cifs_reconnect - need to store value
+ * Accessing max_buf is racy with cifs_reconnect - need to store value
* and check it before using.
*/
- max_buf = tcon->ses->server->maxBuf;
+ max_buf = tcon->ses->server->max_buf;
if (max_buf < sizeof(struct smb2_lock_element))
return -EINVAL;
@@ -257,10 +257,10 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile)
xid = get_xid();
/*
- * Accessing maxBuf is racy with cifs_reconnect - need to store value
+ * Accessing max_buf is racy with cifs_reconnect - need to store value
* and check it for zero before using.
*/
- max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf;
+ max_buf = tlink_tcon(cfile->tlink)->ses->server->max_buf;
if (max_buf < sizeof(struct smb2_lock_element)) {
free_xid(xid);
return -EINVAL;
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 5d5b05277c45..41d1237bb24c 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -86,7 +86,7 @@ smb2_add_credits(struct cifs_server_info *server,
if (*val > 65000) {
*val = 65000; /* Don't get near 64K credits, avoid srv bugs */
pr_warn_once("server overflowed SMB3 credits\n");
- trace_smb3_overflow_credits(server->CurrentMid,
+ trace_smb3_overflow_credits(server->current_mid,
server->conn_id, server->hostname, *val,
add, server->in_flight);
}
@@ -112,7 +112,7 @@ smb2_add_credits(struct cifs_server_info *server,
wake_up(&server->request_q);
if (reconnect_detected) {
- trace_smb3_reconnect_detected(server->CurrentMid,
+ trace_smb3_reconnect_detected(server->current_mid,
server->conn_id, server->hostname, scredits, add, in_flight);
cifs_dbg(FYI, "trying to put %d credits from the old server instance %d\n",
@@ -120,15 +120,15 @@ smb2_add_credits(struct cifs_server_info *server,
}
if (reconnect_with_invalid_credits) {
- trace_smb3_reconnect_with_invalid_credits(server->CurrentMid,
+ trace_smb3_reconnect_with_invalid_credits(server->current_mid,
server->conn_id, server->hostname, scredits, add, in_flight);
cifs_dbg(FYI, "Negotiate operation when server credits is non-zero. Optype: %d, server credits: %d, credits added: %d\n",
optype, scredits, add);
}
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedReconnect
- || server->tcpStatus == CifsExiting) {
+ if (server->status == CifsNeedReconnect
+ || server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return;
}
@@ -152,7 +152,7 @@ smb2_add_credits(struct cifs_server_info *server,
break;
}
- trace_smb3_add_credits(server->CurrentMid,
+ trace_smb3_add_credits(server->current_mid,
server->conn_id, server->hostname, scredits, add, in_flight);
cifs_dbg(FYI, "%s: added %u credits total=%d\n", __func__, add, scredits);
}
@@ -170,7 +170,7 @@ smb2_set_credits(struct cifs_server_info *server, const int val)
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_set_credits(server->CurrentMid,
+ trace_smb3_set_credits(server->current_mid,
server->conn_id, server->hostname, scredits, val, in_flight);
cifs_dbg(FYI, "%s: set %u credits\n", __func__, val);
@@ -219,7 +219,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size,
} else {
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -254,7 +254,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size,
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_wait_credits(server->CurrentMid,
+ trace_smb3_wait_credits(server->current_mid,
server->conn_id, server->hostname, scredits, -(credits->value), in_flight);
cifs_dbg(FYI, "%s: removed %u credits total=%d\n",
__func__, credits->value, scredits);
@@ -274,7 +274,7 @@ smb2_adjust_credits(struct cifs_server_info *server,
return 0;
if (credits->value < new_val) {
- trace_smb3_too_many_credits(server->CurrentMid,
+ trace_smb3_too_many_credits(server->current_mid,
server->conn_id, server->hostname, 0, credits->value - new_val, 0);
cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)",
credits->value, new_val);
@@ -289,7 +289,7 @@ smb2_adjust_credits(struct cifs_server_info *server,
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_reconnect_detected(server->CurrentMid,
+ trace_smb3_reconnect_detected(server->current_mid,
server->conn_id, server->hostname, scredits,
credits->value - new_val, in_flight);
cifs_server_dbg(VFS, "trying to return %d credits to old session\n",
@@ -303,7 +303,7 @@ smb2_adjust_credits(struct cifs_server_info *server,
spin_unlock(&server->req_lock);
wake_up(&server->request_q);
- trace_smb3_adj_credits(server->CurrentMid,
+ trace_smb3_adj_credits(server->current_mid,
server->conn_id, server->hostname, scredits,
credits->value - new_val, in_flight);
cifs_dbg(FYI, "%s: adjust added %u credits total=%d\n",
@@ -320,7 +320,7 @@ smb2_get_next_mid(struct cifs_server_info *server)
__u64 mid;
/* for SMB2 we need the current value */
spin_lock(&g_mid_lock);
- mid = server->CurrentMid++;
+ mid = server->current_mid++;
spin_unlock(&g_mid_lock);
return mid;
}
@@ -329,8 +329,8 @@ static void
smb2_revert_current_mid(struct cifs_server_info *server, const unsigned int val)
{
spin_lock(&g_mid_lock);
- if (server->CurrentMid >= val)
- server->CurrentMid -= val;
+ if (server->current_mid >= val)
+ server->current_mid -= val;
spin_unlock(&g_mid_lock);
}
@@ -404,7 +404,7 @@ smb2_negotiate(const unsigned int xid,
int rc;
spin_lock(&g_mid_lock);
- server->CurrentMid = 0;
+ server->current_mid = 0;
spin_unlock(&g_mid_lock);
rc = SMB2_negotiate(xid, ses, server);
/* BB we probably don't need to retry with modern servers */
@@ -2532,7 +2532,7 @@ smb2_is_status_pending(char *buf, struct cifs_server_info *server)
spin_unlock(&server->req_lock);
wake_up(&server->request_q);
- trace_smb3_pend_credits(server->CurrentMid,
+ trace_smb3_pend_credits(server->current_mid,
server->conn_id, server->hostname, scredits,
le16_to_cpu(shdr->CreditRequest), in_flight);
cifs_dbg(FYI, "%s: status pending add %u credits total=%d\n",
@@ -5080,7 +5080,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
} else {
spin_lock(&g_servers_lock);
spin_lock(&g_mid_lock);
- if (dw->server->tcpStatus == CifsNeedReconnect) {
+ if (dw->server->status == CifsNeedReconnect) {
mid->mid_state = MID_RETRY_NEEDED;
spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 26a4e37efc06..b5bdd7356d59 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -191,7 +191,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->tcpStatus == CifsNeedReconnect) {
+ while (server->status == CifsNeedReconnect) {
/*
* Return to caller for TREE_DISCONNECT and LOGOFF and CLOSE
* here since they are implicitly done when session drops.
@@ -208,7 +208,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
rc = wait_event_interruptible_timeout(server->response_q,
- (server->tcpStatus != CifsNeedReconnect),
+ (server->status != CifsNeedReconnect),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -218,7 +218,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->tcpStatus != CifsNeedReconnect) {
+ if (server->status != CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
break;
}
@@ -254,10 +254,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
/*
* Recheck after acquire mutex. If another thread is negotiating
* and the server never sends an answer the socket will be closed
- * and tcpStatus set to reconnect.
+ * and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedReconnect) {
+ if (server->status == CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
@@ -1032,7 +1032,7 @@ SMB2_negotiate(const unsigned int xid,
/* SMB2 only has an extended negflavor */
server->negflavor = CIFS_NEGFLAVOR_EXTENDED;
/* set it to the maximum buffer size value we can send with 1 credit */
- server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),
+ server->max_buf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),
SMB2_MAX_BUFFER_SIZE);
server->max_read = le32_to_cpu(rsp->MaxReadSize);
server->max_write = le32_to_cpu(rsp->MaxWriteSize);
@@ -3776,7 +3776,7 @@ smb2_echo_callback(struct mid_q_entry *mid)
credits.instance = server->reconnect_instance;
}
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(server, &credits, CIFS_ECHO_OP);
}
@@ -4201,7 +4201,7 @@ smb2_readv_callback(struct mid_q_entry *mid)
rdata->offset, rdata->got_bytes);
queue_work(cifsiod_wq, &rdata->work);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(server, &credits, 0);
}
@@ -4440,7 +4440,7 @@ smb2_writev_callback(struct mid_q_entry *mid)
wdata->offset, wdata->bytes);
queue_work(cifsiod_wq, &wdata->work);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
add_credits(server, &credits, 0);
}
@@ -4874,7 +4874,7 @@ int SMB2_query_directory_init(const unsigned int xid,
* BB could be 30 bytes or so longer if we used SMB2 specific
* buffer lengths, but this is safe and close enough.
*/
- output_size = min_t(unsigned int, output_size, server->maxBuf);
+ output_size = min_t(unsigned int, output_size, server->max_buf);
output_size = min_t(unsigned int, output_size, 2 << 15);
req->OutputBufferLength = cpu_to_le32(output_size);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index a422bcd02420..4417953ecbb2 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -763,18 +763,18 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
struct smb2_hdr *shdr, struct mid_q_entry **mid)
{
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
- if (server->tcpStatus == CifsNeedReconnect) {
+ if (server->status == CifsNeedReconnect) {
spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
return -EAGAIN;
}
- if (server->tcpStatus == CifsNeedNegotiate &&
+ if (server->status == CifsNeedNegotiate &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return -EAGAIN;
@@ -870,7 +870,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
struct mid_q_entry *mid;
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsNeedNegotiate &&
+ if (server->status == CifsNeedNegotiate &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return ERR_PTR(-EAGAIN);
@@ -888,7 +888,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
rc = smb2_sign_rqst(rqst, server);
if (rc) {
revert_current_mid_from_hdr(server, shdr);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
return ERR_PTR(rc);
}
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 71cc66b8f8d2..22ed055c0c39 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -38,12 +38,12 @@ cifs_wake_up_task(struct mid_q_entry *mid)
}
struct mid_q_entry *
-AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifs_server_info *server)
+cifs_alloc_mid_q_entry(const struct smb_hdr *smb_buffer, struct cifs_server_info *server)
{
struct mid_q_entry *temp;
if (server == NULL) {
- cifs_dbg(VFS, "Null TCP session in AllocMidQEntry\n");
+ cifs_dbg(VFS, "Null TCP session in cifs_alloc_mid_q_entry\n");
return NULL;
}
@@ -159,7 +159,7 @@ void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)
spin_unlock(&g_mid_lock);
}
-void DeleteMidQEntry(struct mid_q_entry *midEntry)
+void cifs_delete_mid_q_entry(struct mid_q_entry *midEntry)
{
cifs_mid_q_entry_release(midEntry);
}
@@ -174,7 +174,7 @@ cifs_delete_mid(struct mid_q_entry *mid)
}
spin_unlock(&g_mid_lock);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
}
/*
@@ -431,7 +431,7 @@ __smb_send_rqst(struct cifs_server_info *server, int num_rqst,
* socket so the server throws away the partial SMB
*/
cifs_signal_cifsd_for_reconnect(server, false);
- trace_smb3_partial_send_reconnect(server->CurrentMid,
+ trace_smb3_partial_send_reconnect(server->current_mid,
server->conn_id, server->hostname);
}
smbd_done:
@@ -541,7 +541,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_nblk_credits(server->CurrentMid,
+ trace_smb3_nblk_credits(server->current_mid,
server->conn_id, server->hostname, scredits, -1, in_flight);
cifs_dbg(FYI, "%s: remove %u credits total=%d\n",
__func__, 1, scredits);
@@ -564,7 +564,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_credit_timeout(server->CurrentMid,
+ trace_smb3_credit_timeout(server->current_mid,
server->conn_id, server->hostname, scredits,
num_credits, in_flight);
cifs_server_dbg(VFS, "wait timed out after %d ms\n",
@@ -578,7 +578,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -617,7 +617,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
spin_unlock(&server->req_lock);
trace_smb3_credit_timeout(
- server->CurrentMid,
+ server->current_mid,
server->conn_id, server->hostname,
scredits, num_credits, in_flight);
cifs_server_dbg(VFS, "wait timed out after %d ms\n",
@@ -647,7 +647,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
- trace_smb3_waitff_credits(server->CurrentMid,
+ trace_smb3_waitff_credits(server->current_mid,
server->conn_id, server->hostname, scredits,
-(num_credits), in_flight);
cifs_dbg(FYI, "%s: remove %u credits total=%d\n",
@@ -698,7 +698,7 @@ wait_for_compound_request(struct cifs_server_info *server, int num,
*/
if (server->in_flight == 0) {
spin_unlock(&server->req_lock);
- trace_smb3_insufficient_credits(server->CurrentMid,
+ trace_smb3_insufficient_credits(server->current_mid,
server->conn_id, server->hostname, scredits,
num, in_flight);
cifs_dbg(FYI, "%s: %d requests in flight, needed %d total=%d\n",
@@ -745,7 +745,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
}
spin_unlock(&g_servers_lock);
- *ppmidQ = AllocMidQEntry(in_buf, ses->server);
+ *ppmidQ = cifs_alloc_mid_q_entry(in_buf, ses->server);
if (*ppmidQ == NULL)
return -ENOMEM;
spin_lock(&g_mid_lock);
@@ -782,13 +782,13 @@ cifs_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
if (server->sign)
hdr->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
- mid = AllocMidQEntry(hdr, server);
+ mid = cifs_alloc_mid_q_entry(hdr, server);
if (mid == NULL)
return ERR_PTR(-ENOMEM);
rc = cifs_sign_rqst(rqst, server, &mid->sequence_number);
if (rc) {
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
return ERR_PTR(rc);
}
@@ -937,7 +937,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct cifs_server_info *server)
}
spin_unlock(&g_mid_lock);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
return rc;
}
@@ -1026,7 +1026,7 @@ static void
cifs_cancelled_callback(struct mid_q_entry *mid)
{
cifs_compound_callback(mid);
- DeleteMidQEntry(mid);
+ cifs_delete_mid_q_entry(mid);
}
/*
@@ -1079,7 +1079,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1361,7 +1361,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1369,7 +1369,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
/* Ensure that we do not send more than 50 overlapping requests
to the same server. We may make this configurable later or
- use ses->maxReq */
+ use ses->max_req */
if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
cifs_server_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",
@@ -1422,7 +1422,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
spin_lock(&g_mid_lock);
if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
/* no longer considered to be "in-flight" */
- midQ->callback = DeleteMidQEntry;
+ midQ->callback = cifs_delete_mid_q_entry;
spin_unlock(&g_mid_lock);
add_credits(server, &credits, 0);
return rc;
@@ -1506,7 +1506,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
}
spin_lock(&g_servers_lock);
- if (server->tcpStatus == CifsExiting) {
+ if (server->status == CifsExiting) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1514,7 +1514,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
/* Ensure that we do not send more than 50 overlapping requests
to the same server. We may make this configurable later or
- use ses->maxReq */
+ use ses->max_req */
if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
cifs_tcon_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",
@@ -1564,15 +1564,15 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
/* Wait for a reply - allow signals to interrupt. */
rc = wait_event_interruptible(server->response_q,
(!(midQ->mid_state == MID_REQUEST_SUBMITTED)) ||
- ((server->tcpStatus != CifsGood) &&
- (server->tcpStatus != CifsNew)));
+ ((server->status != CifsGood) &&
+ (server->status != CifsNew)));
/* Were we interrupted by a signal ? */
spin_lock(&g_servers_lock);
if ((rc == -ERESTARTSYS) &&
(midQ->mid_state == MID_REQUEST_SUBMITTED) &&
- ((server->tcpStatus == CifsGood) ||
- (server->tcpStatus == CifsNew))) {
+ ((server->status == CifsGood) ||
+ (server->status == CifsNew))) {
spin_unlock(&g_servers_lock);
if (in_buf->Command == SMB_COM_TRANSACTION2) {
@@ -1603,7 +1603,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
spin_lock(&g_mid_lock);
if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
/* no longer considered to be "in-flight" */
- midQ->callback = DeleteMidQEntry;
+ midQ->callback = cifs_delete_mid_q_entry;
spin_unlock(&g_mid_lock);
return rc;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 07/14] cifs: typedef server status enum
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (3 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 06/14] cifs: convert server info vars to snake_case Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-25 5:31 ` Christoph Hellwig
2022-07-24 15:11 ` [RFC PATCH 08/14] cifs: typedef ses " Enzo Matsumiya
` (5 subsequent siblings)
10 siblings, 1 reply; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
typedef "enum statusEnum" to "cifs_server_status_t".
Rename the status values from CamelCase to snake_case.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 18 +++++------
fs/cifs/cifssmb.c | 8 ++---
fs/cifs/connect.c | 68 ++++++++++++++++++++---------------------
fs/cifs/smb1ops.c | 2 +-
fs/cifs/smb2ops.c | 8 ++---
fs/cifs/smb2pdu.c | 8 ++---
fs/cifs/smb2transport.c | 8 ++---
fs/cifs/transport.c | 16 +++++-----
9 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 7d8020b90220..0ff54aba4a96 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -143,7 +143,7 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
- server->status == CifsNeedNegotiate) {
+ server->status == SERVER_STATUS_NEED_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return rc;
}
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 12b6aafa5fa6..49e0821fd61d 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -111,14 +111,14 @@
*/
/* associated with each connection */
-enum statusEnum {
- CifsNew = 0,
- CifsGood,
- CifsExiting,
- CifsNeedReconnect,
- CifsNeedNegotiate,
- CifsInNegotiate,
-};
+typedef enum {
+ SERVER_STATUS_NEW = 0,
+ SERVER_STATUS_GOOD,
+ SERVER_STATUS_EXITING,
+ SERVER_STATUS_NEED_RECONNECT,
+ SERVER_STATUS_NEED_NEGOTIATE,
+ SERVER_STATUS_IN_NEGOTIATE,
+} cifs_server_status_t;
/* associated with each smb session */
enum ses_status_enum {
@@ -612,7 +612,7 @@ struct cifs_server_info {
struct smb_version_operations *ops;
struct smb_version_values *vals;
/* updates to status protected by g_servers_lock */
- enum statusEnum status; /* what we think the status is */
+ cifs_server_status_t status; /* what we think the status is */
char *hostname; /* hostname portion of UNC string */
struct socket *ssocket;
struct sockaddr_storage dstaddr;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 326db1db353e..c88a42ebb509 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -154,9 +154,9 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->status == CifsNeedReconnect) {
+ while (server->status == SERVER_STATUS_NEED_RECONNECT) {
rc = wait_event_interruptible_timeout(server->response_q,
- (server->status != CifsNeedReconnect),
+ (server->status != SERVER_STATUS_NEED_RECONNECT),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -166,7 +166,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->status != CifsNeedReconnect) {
+ if (server->status != SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
break;
}
@@ -202,7 +202,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4ab1933fca76..ec014e007ff9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -207,7 +207,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!all_channels) {
- pserver->status = CifsNeedReconnect;
+ pserver->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&g_servers_lock);
return;
}
@@ -215,7 +215,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
spin_lock(&ses->chan_lock);
for (i = 0; i < ses->chan_count; i++)
- ses->chans[i].server->status = CifsNeedReconnect;
+ ses->chans[i].server->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&ses->chan_lock);
}
spin_unlock(&g_servers_lock);
@@ -228,7 +228,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
* cifs_signal_cifsd_for_reconnect
*
* @server: the tcp ses for which reconnect is needed
- * @server needs to be previously set to CifsNeedReconnect.
+ * @server needs to be previously set to SERVER_STATUS_NEED_RECONNECT.
* @mark_smb_session: whether even sessions need to be marked
*/
void
@@ -352,7 +352,7 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
{
spin_lock(&g_servers_lock);
server->nr_targets = num_targets;
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
/* the demux thread will exit normally next time through the loop */
spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
@@ -362,7 +362,7 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
cifs_dbg(FYI, "Mark tcp session as need reconnect\n");
trace_smb3_reconnect(server->current_mid, server->conn_id,
server->hostname);
- server->status = CifsNeedReconnect;
+ server->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&g_servers_lock);
return true;
@@ -415,17 +415,17 @@ static int __cifs_reconnect(struct cifs_server_info *server,
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->status != CifsExiting)
- server->status = CifsNeedNegotiate;
+ if (server->status != SERVER_STATUS_EXITING)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
}
- } while (server->status == CifsNeedReconnect);
+ } while (server->status == SERVER_STATUS_NEED_RECONNECT);
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate)
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -535,20 +535,20 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
continue;
}
/*
- * Socket was created. Update tcp session status to CifsNeedNegotiate so that a
+ * Socket was created. Update tcp session status to SERVER_STATUS_NEED_NEGOTIATE so that a
* process waiting for reconnect will know it needs to re-establish session and tcon
* through the reconnected target server.
*/
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->status != CifsExiting)
- server->status = CifsNeedNegotiate;
+ if (server->status != SERVER_STATUS_EXITING)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
- } while (server->status == CifsNeedReconnect);
+ } while (server->status == SERVER_STATUS_NEED_RECONNECT);
if (target_hint)
dfs_cache_noreq_update_tgthint(refpath, target_hint);
@@ -557,7 +557,7 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
/* Need to set up echo worker again once connection has been established */
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate)
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -604,9 +604,9 @@ cifs_echo_request(struct work_struct *work)
* Also, no need to ping if we got a response recently.
*/
- if (server->status == CifsNeedReconnect ||
- server->status == CifsExiting ||
- server->status == CifsNew ||
+ if (server->status == SERVER_STATUS_NEED_RECONNECT ||
+ server->status == SERVER_STATUS_EXITING ||
+ server->status == SERVER_STATUS_NEW ||
(server->ops->can_echo && !server->ops->can_echo(server)) ||
time_before(jiffies, server->lstrp + server->echo_interval - HZ))
goto requeue_echo;
@@ -671,8 +671,8 @@ server_unresponsive(struct cifs_server_info *server)
* a response in >60s.
*/
spin_lock(&g_servers_lock);
- if ((server->status == CifsGood ||
- server->status == CifsNeedNegotiate) &&
+ if ((server->status == SERVER_STATUS_GOOD ||
+ server->status == SERVER_STATUS_NEED_NEGOTIATE) &&
(!server->ops->can_echo || server->ops->can_echo(server)) &&
time_after(jiffies, server->lstrp + 3 * server->echo_interval)) {
spin_unlock(&g_servers_lock);
@@ -727,12 +727,12 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
length = sock_recvmsg(server->ssocket, smb_msg, 0);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ESHUTDOWN;
}
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
cifs_reconnect(server, false);
return -ECONNABORTED;
@@ -745,7 +745,7 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
/*
* Minimum sleep to prevent looping, allowing socket
* to clear and app threads to set status
- * CifsNeedReconnect if server hung.
+ * SERVER_STATUS_NEED_RECONNECT if server hung.
*/
usleep_range(1000, 2000);
length = 0;
@@ -916,7 +916,7 @@ static void clean_demultiplex_info(struct cifs_server_info *server)
cancel_delayed_work_sync(&server->resolve);
spin_lock(&g_servers_lock);
- server->status = CifsExiting;
+ server->status = SERVER_STATUS_EXITING;
spin_unlock(&g_servers_lock);
wake_up_all(&server->response_q);
@@ -1123,7 +1123,7 @@ cifs_demultiplex_thread(void *p)
set_freezable();
allow_kernel_signal(SIGKILL);
- while (server->status != CifsExiting) {
+ while (server->status != SERVER_STATUS_EXITING) {
if (try_to_freeze())
continue;
@@ -1534,7 +1534,7 @@ cifs_put_server(struct cifs_server_info *server, int from_reconnect)
cancel_delayed_work_sync(&server->reconnect);
spin_lock(&g_servers_lock);
- server->status = CifsExiting;
+ server->status = SERVER_STATUS_EXITING;
spin_unlock(&g_servers_lock);
cifs_crypto_secmech_release(server);
@@ -1634,7 +1634,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
* to the struct since the kernel thread not created yet
* no need to spinlock this init of status or srv_count
*/
- server->status = CifsNew;
+ server->status = SERVER_STATUS_NEW;
++server->srv_count;
if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&
@@ -1685,7 +1685,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
* no need to spinlock this update of status
*/
spin_lock(&g_servers_lock);
- server->status = CifsNeedNegotiate;
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
@@ -3179,7 +3179,7 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
*/
reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx);
spin_lock(&g_servers_lock);
- if ((tcon->ses->server->status == CifsNeedReconnect) &&
+ if ((tcon->ses->server->status == SERVER_STATUS_NEED_RECONNECT) &&
(le64_to_cpu(tcon->fsUnixInfo.Capability) &
CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)) {
spin_unlock(&g_servers_lock);
@@ -3988,25 +3988,25 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,
/* only send once per connect */
spin_lock(&g_servers_lock);
if (!server->ops->need_neg(server) ||
- server->status != CifsNeedNegotiate) {
+ server->status != SERVER_STATUS_NEED_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return 0;
}
- server->status = CifsInNegotiate;
+ server->status = SERVER_STATUS_IN_NEGOTIATE;
spin_unlock(&g_servers_lock);
rc = server->ops->negotiate(xid, ses, server);
if (rc == 0) {
spin_lock(&g_servers_lock);
- if (server->status == CifsInNegotiate)
- server->status = CifsGood;
+ if (server->status == SERVER_STATUS_IN_NEGOTIATE)
+ server->status = SERVER_STATUS_GOOD;
else
rc = -EHOSTDOWN;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (server->status == CifsInNegotiate)
- server->status = CifsNeedNegotiate;
+ if (server->status == SERVER_STATUS_IN_NEGOTIATE)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
}
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 8b2a504c92f1..9d63099ad26a 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -1024,7 +1024,7 @@ cifs_dir_needs_close(struct cifs_file_info *cfile)
static bool
cifs_can_echo(struct cifs_server_info *server)
{
- if (server->status == CifsGood)
+ if (server->status == SERVER_STATUS_GOOD)
return true;
return false;
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 41d1237bb24c..9d2064cf44d8 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -127,8 +127,8 @@ smb2_add_credits(struct cifs_server_info *server,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect
- || server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT
+ || server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return;
}
@@ -219,7 +219,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size,
} else {
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -5080,7 +5080,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
} else {
spin_lock(&g_servers_lock);
spin_lock(&g_mid_lock);
- if (dw->server->status == CifsNeedReconnect) {
+ if (dw->server->status == SERVER_STATUS_NEED_RECONNECT) {
mid->mid_state = MID_RETRY_NEEDED;
spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index b5bdd7356d59..8b06b3267318 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -191,7 +191,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->status == CifsNeedReconnect) {
+ while (server->status == SERVER_STATUS_NEED_RECONNECT) {
/*
* Return to caller for TREE_DISCONNECT and LOGOFF and CLOSE
* here since they are implicitly done when session drops.
@@ -208,7 +208,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
rc = wait_event_interruptible_timeout(server->response_q,
- (server->status != CifsNeedReconnect),
+ (server->status != SERVER_STATUS_NEED_RECONNECT),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -218,7 +218,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->status != CifsNeedReconnect) {
+ if (server->status != SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
break;
}
@@ -257,7 +257,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 4417953ecbb2..5ffe472e692d 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -763,18 +763,18 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
struct smb2_hdr *shdr, struct mid_q_entry **mid)
{
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
return -EAGAIN;
}
- if (server->status == CifsNeedNegotiate &&
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return -EAGAIN;
@@ -870,7 +870,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
struct mid_q_entry *mid;
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate &&
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return ERR_PTR(-EAGAIN);
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 22ed055c0c39..41da942de4a3 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -578,7 +578,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1079,7 +1079,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1361,7 +1361,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1506,7 +1506,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1564,15 +1564,15 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
/* Wait for a reply - allow signals to interrupt. */
rc = wait_event_interruptible(server->response_q,
(!(midQ->mid_state == MID_REQUEST_SUBMITTED)) ||
- ((server->status != CifsGood) &&
- (server->status != CifsNew)));
+ ((server->status != SERVER_STATUS_GOOD) &&
+ (server->status != SERVER_STATUS_NEW)));
/* Were we interrupted by a signal ? */
spin_lock(&g_servers_lock);
if ((rc == -ERESTARTSYS) &&
(midQ->mid_state == MID_REQUEST_SUBMITTED) &&
- ((server->status == CifsGood) ||
- (server->status == CifsNew))) {
+ ((server->status == SERVER_STATUS_GOOD) ||
+ (server->status == SERVER_STATUS_NEW))) {
spin_unlock(&g_servers_lock);
if (in_buf->Command == SMB_COM_TRANSACTION2) {
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 08/14] cifs: typedef ses status enum
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (4 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 07/14] cifs: typedef server status enum Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 09/14] cifs: typedef tcon " Enzo Matsumiya
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
typedef "enum ses_status_enum" to "cifs_ses_status_t".
Rename the status values.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 4 ++--
fs/cifs/cifsglob.h | 16 ++++++++--------
fs/cifs/cifssmb.c | 2 +-
fs/cifs/connect.c | 34 +++++++++++++++++-----------------
fs/cifs/misc.c | 2 +-
fs/cifs/smb2pdu.c | 2 +-
fs/cifs/smb2transport.c | 4 ++--
fs/cifs/transport.c | 8 ++++----
8 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index eb24928e1298..c88bea9d3ac3 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -382,7 +382,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
(ses->serverNOS == NULL)) {
seq_printf(m, "\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
i, ses->ip_addr, ses->ses_count,
- ses->capabilities, ses->ses_status);
+ ses->capabilities, ses->status);
if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
seq_printf(m, "Guest ");
else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
@@ -394,7 +394,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
"\n\tSMB session status: %d ",
i, ses->ip_addr, ses->serverDomain,
ses->ses_count, ses->serverOS, ses->serverNOS,
- ses->capabilities, ses->ses_status);
+ ses->capabilities, ses->status);
}
seq_printf(m, "\n\tSecurity type: %s ",
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 49e0821fd61d..0fa23f392bb9 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -121,13 +121,13 @@ typedef enum {
} cifs_server_status_t;
/* associated with each smb session */
-enum ses_status_enum {
- SES_NEW = 0,
- SES_GOOD,
- SES_EXITING,
- SES_NEED_RECON,
- SES_IN_SETUP
-};
+typedef enum {
+ SES_STATUS_NEW = 0,
+ SES_STATUS_GOOD,
+ SES_STATUS_EXITING,
+ SES_STATUS_NEED_RECONNECT,
+ SES_STATUS_IN_SETUP
+} cifs_ses_status_t;
/* associated with each tree connection to the server */
enum tid_status_enum {
@@ -1011,7 +1011,7 @@ struct cifs_ses {
struct mutex session_mutex;
struct cifs_server_info *server; /* pointer to server info */
int ses_count; /* reference counter */
- enum ses_status_enum ses_status; /* updates protected by g_servers_lock */
+ cifs_ses_status_t status; /* updates protected by g_servers_lock */
unsigned overrideSecFlg; /* if non-zero override global sec flags */
char *serverOS; /* name of operating system underlying server */
char *serverNOS; /* name of network operating system of server */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index c88a42ebb509..25009dd47f96 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -75,7 +75,7 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
/* only send once per connect */
spin_lock(&g_servers_lock);
- if ((tcon->ses->ses_status != SES_GOOD) || (tcon->status != TID_NEED_RECON)) {
+ if ((tcon->ses->status != SES_STATUS_GOOD) || (tcon->status != TID_NEED_RECON)) {
spin_unlock(&g_servers_lock);
return;
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ec014e007ff9..55264aef1b83 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -277,7 +277,7 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,
if (!mark_smb_session && !CIFS_ALL_CHANS_NEED_RECONNECT(ses))
goto next_session;
- ses->ses_status = SES_NEED_RECON;
+ ses->status = SES_STATUS_NEED_RECONNECT;
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
tcon->need_reconnect = true;
@@ -1863,7 +1863,7 @@ cifs_find_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
spin_lock(&g_servers_lock);
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- if (ses->ses_status == SES_EXITING)
+ if (ses->status == SES_STATUS_EXITING)
continue;
if (!match_session(ses, ctx))
continue;
@@ -1882,7 +1882,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
struct cifs_server_info *server = ses->server;
spin_lock(&g_servers_lock);
- if (ses->ses_status == SES_EXITING) {
+ if (ses->status == SES_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return;
}
@@ -1898,13 +1898,13 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
/* ses_count can never go negative */
WARN_ON(ses->ses_count < 0);
- if (ses->ses_status == SES_GOOD)
- ses->ses_status = SES_EXITING;
+ if (ses->status == SES_STATUS_GOOD)
+ ses->status = SES_STATUS_EXITING;
spin_unlock(&g_servers_lock);
cifs_free_ipc(ses);
- if (ses->ses_status == SES_EXITING && server->ops->logoff) {
+ if (ses->status == SES_STATUS_EXITING && server->ops->logoff) {
xid = get_xid();
rc = server->ops->logoff(xid, ses);
if (rc)
@@ -2113,7 +2113,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
ses = cifs_find_smb_ses(server, ctx);
if (ses) {
cifs_dbg(FYI, "Existing smb sess found (status=%d)\n",
- ses->ses_status);
+ ses->status);
spin_lock(&ses->chan_lock);
if (cifs_chan_needs_reconnect(ses, server)) {
@@ -4029,9 +4029,9 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
else
scnprintf(ses->ip_addr, sizeof(ses->ip_addr), "%pI4", &addr->sin_addr);
- if (ses->ses_status != SES_GOOD &&
- ses->ses_status != SES_NEW &&
- ses->ses_status != SES_NEED_RECON) {
+ if (ses->status != SES_STATUS_GOOD &&
+ ses->status != SES_STATUS_NEW &&
+ ses->status != SES_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
return 0;
}
@@ -4049,7 +4049,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
spin_unlock(&ses->chan_lock);
if (!is_binding)
- ses->ses_status = SES_IN_SETUP;
+ ses->status = SES_STATUS_IN_SETUP;
spin_unlock(&g_servers_lock);
if (!is_binding) {
@@ -4075,16 +4075,16 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
if (rc) {
cifs_server_dbg(VFS, "Send error in SessSetup = %d\n", rc);
spin_lock(&g_servers_lock);
- if (ses->ses_status == SES_IN_SETUP)
- ses->ses_status = SES_NEED_RECON;
+ if (ses->status == SES_STATUS_IN_SETUP)
+ ses->status = SES_STATUS_NEED_RECONNECT;
spin_lock(&ses->chan_lock);
cifs_chan_clear_in_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (ses->ses_status == SES_IN_SETUP)
- ses->ses_status = SES_GOOD;
+ if (ses->status == SES_STATUS_IN_SETUP)
+ ses->status = SES_STATUS_GOOD;
spin_lock(&ses->chan_lock);
cifs_chan_clear_in_reconnect(ses, server);
cifs_chan_clear_need_reconnect(ses, server);
@@ -4559,7 +4559,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
- if (tcon->ses->ses_status != SES_GOOD ||
+ if (tcon->ses->status != SES_STATUS_GOOD ||
(tcon->status != TID_NEW &&
tcon->status != TID_NEED_TCON)) {
spin_unlock(&g_servers_lock);
@@ -4627,7 +4627,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
- if (tcon->ses->ses_status != SES_GOOD ||
+ if (tcon->ses->status != SES_STATUS_GOOD ||
(tcon->status != TID_NEW &&
tcon->status != TID_NEED_TCON)) {
spin_unlock(&g_servers_lock);
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index a31780cf6d21..e209aa3194de 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -69,7 +69,7 @@ sesInfoAlloc(void)
ret_buf = kzalloc(sizeof(struct cifs_ses), GFP_KERNEL);
if (ret_buf) {
atomic_inc(&g_ses_alloc_count);
- ret_buf->ses_status = SES_NEW;
+ ret_buf->status = SES_STATUS_NEW;
++ret_buf->ses_count;
INIT_LIST_HEAD(&ret_buf->smb_ses_list);
INIT_LIST_HEAD(&ret_buf->tcon_list);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8b06b3267318..e495121f7d99 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -179,7 +179,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
}
spin_unlock(&g_servers_lock);
- if ((!tcon->ses) || (tcon->ses->ses_status == SES_EXITING) ||
+ if ((!tcon->ses) || (tcon->ses->status == SES_STATUS_EXITING) ||
(!tcon->ses->server) || !server)
return -EIO;
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 5ffe472e692d..5ac2dbffb939 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -780,7 +780,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
return -EAGAIN;
}
- if (ses->ses_status == SES_NEW) {
+ if (ses->status == SES_STATUS_NEW) {
if ((shdr->Command != SMB2_SESSION_SETUP) &&
(shdr->Command != SMB2_NEGOTIATE)) {
spin_unlock(&g_servers_lock);
@@ -789,7 +789,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
/* else ok - we are setting up session */
}
- if (ses->ses_status == SES_EXITING) {
+ if (ses->status == SES_STATUS_EXITING) {
if (shdr->Command != SMB2_LOGOFF) {
spin_unlock(&g_servers_lock);
return -EAGAIN;
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 41da942de4a3..b681a0c9b03d 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -726,7 +726,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
struct mid_q_entry **ppmidQ)
{
spin_lock(&g_servers_lock);
- if (ses->ses_status == SES_NEW) {
+ if (ses->status == SES_STATUS_NEW) {
if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) &&
(in_buf->Command != SMB_COM_NEGOTIATE)) {
spin_unlock(&g_servers_lock);
@@ -735,7 +735,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
/* else ok - we are setting up session */
}
- if (ses->ses_status == SES_EXITING) {
+ if (ses->status == SES_STATUS_EXITING) {
/* check if SMB session is bad because we are setting it up */
if (in_buf->Command != SMB_COM_LOGOFF_ANDX) {
spin_unlock(&g_servers_lock);
@@ -1187,7 +1187,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
* Compounding is never used during session establish.
*/
spin_lock(&g_servers_lock);
- if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
+ if ((ses->status == SES_STATUS_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
spin_unlock(&g_servers_lock);
cifs_server_lock(server);
@@ -1260,7 +1260,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
* Compounding is never used during session establish.
*/
spin_lock(&g_servers_lock);
- if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
+ if ((ses->status == SES_STATUS_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
struct kvec iov = {
.iov_base = resp_iov[0].iov_base,
.iov_len = resp_iov[0].iov_len
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 09/14] cifs: typedef tcon status enum
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (5 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 08/14] cifs: typedef ses " Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 10/14] cifs: typedef securityEnum Enzo Matsumiya
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
typedef "enum tid_status_enum" to "cifs_tcon_status_t".
Rename the status values.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifsfs.c | 4 ++--
fs/cifs/cifsglob.h | 22 +++++++++++-----------
fs/cifs/cifssmb.c | 11 ++++++-----
fs/cifs/connect.c | 32 ++++++++++++++++----------------
fs/cifs/misc.c | 2 +-
fs/cifs/smb2pdu.c | 4 ++--
6 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 6db4b008dbb1..a8eb41657859 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -712,14 +712,14 @@ static void cifs_umount_begin(struct super_block *sb)
tcon = cifs_sb_master_tcon(cifs_sb);
spin_lock(&g_servers_lock);
- if ((tcon->tc_count > 1) || (tcon->status == TID_EXITING)) {
+ if ((tcon->tc_count > 1) || (tcon->status == TCON_STATUS_EXITING)) {
/* we have other mounts to same share or we have
already tried to force umount this and woken up
all waiting network requests, nothing to do */
spin_unlock(&g_servers_lock);
return;
} else if (tcon->tc_count == 1)
- tcon->status = TID_EXITING;
+ tcon->status = TCON_STATUS_EXITING;
spin_unlock(&g_servers_lock);
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 0fa23f392bb9..dddd63b6dc82 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -130,16 +130,16 @@ typedef enum {
} cifs_ses_status_t;
/* associated with each tree connection to the server */
-enum tid_status_enum {
- TID_NEW = 0,
- TID_GOOD,
- TID_EXITING,
- TID_NEED_RECON,
- TID_NEED_TCON,
- TID_IN_TCON,
- TID_NEED_FILES_INVALIDATE, /* currently unused */
- TID_IN_FILES_INVALIDATE
-};
+typedef enum {
+ TCON_STATUS_NEW = 0,
+ TCON_STATUS_GOOD,
+ TCON_STATUS_EXITING,
+ TCON_STATUS_NEED_RECONNECT,
+ TCON_STATUS_NEED_TCON,
+ TCON_STATUS_IN_TCON,
+ TCON_STATUS_NEED_FILES_INVALIDATE, /* currently unused */
+ TCON_STATUS_IN_FILES_INVALIDATE
+} cifs_tcon_status_t;
enum securityEnum {
Unspecified = 0, /* not specified */
@@ -1179,7 +1179,7 @@ struct cifs_tcon {
char *password; /* for share-level security */
__u32 tid; /* The 4 byte tree id */
__u16 Flags; /* optional support bits */
- enum tid_status_enum status;
+ cifs_tcon_status_t status;
atomic_t num_smbs_sent;
union {
struct {
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 25009dd47f96..e286bb535c5d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -75,11 +75,12 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
/* only send once per connect */
spin_lock(&g_servers_lock);
- if ((tcon->ses->status != SES_STATUS_GOOD) || (tcon->status != TID_NEED_RECON)) {
+ if ((tcon->ses->status != SES_STATUS_GOOD) ||
+ (tcon->status != TCON_STATUS_NEED_RECONNECT)) {
spin_unlock(&g_servers_lock);
return;
}
- tcon->status = TID_IN_FILES_INVALIDATE;
+ tcon->status = TCON_STATUS_IN_FILES_INVALIDATE;
spin_unlock(&g_servers_lock);
/* list all files open on tree connection and mark them invalid */
@@ -99,8 +100,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
mutex_unlock(&tcon->crfid.fid_mutex);
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_FILES_INVALIDATE)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_FILES_INVALIDATE)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
/*
@@ -135,7 +136,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* have tcon) are allowed as we start force umount
*/
spin_lock(&g_servers_lock);
- if (tcon->status == TID_EXITING) {
+ if (tcon->status == TCON_STATUS_EXITING) {
if (smb_command != SMB_COM_WRITE_ANDX &&
smb_command != SMB_COM_OPEN_ANDX &&
smb_command != SMB_COM_TREE_DISCONNECT) {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 55264aef1b83..467f1b598eec 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -281,7 +281,7 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
tcon->need_reconnect = true;
- tcon->status = TID_NEED_RECON;
+ tcon->status = TCON_STATUS_NEED_RECONNECT;
}
if (ses->tcon_ipc)
ses->tcon_ipc->need_reconnect = true;
@@ -2237,7 +2237,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
{
- if (tcon->status == TID_EXITING)
+ if (tcon->status == TCON_STATUS_EXITING)
return 0;
if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE))
return 0;
@@ -4560,12 +4560,12 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
if (tcon->ses->status != SES_STATUS_GOOD ||
- (tcon->status != TID_NEW &&
- tcon->status != TID_NEED_TCON)) {
+ (tcon->status != TCON_STATUS_NEW &&
+ tcon->status != TCON_STATUS_NEED_TCON)) {
spin_unlock(&g_servers_lock);
return 0;
}
- tcon->status = TID_IN_TCON;
+ tcon->status = TCON_STATUS_IN_TCON;
spin_unlock(&g_servers_lock);
tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
@@ -4606,13 +4606,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
if (rc) {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_GOOD;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_GOOD;
spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
@@ -4628,24 +4628,24 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
if (tcon->ses->status != SES_STATUS_GOOD ||
- (tcon->status != TID_NEW &&
- tcon->status != TID_NEED_TCON)) {
+ (tcon->status != TCON_STATUS_NEW &&
+ tcon->status != TCON_STATUS_NEED_TCON)) {
spin_unlock(&g_servers_lock);
return 0;
}
- tcon->status = TID_IN_TCON;
+ tcon->status = TCON_STATUS_IN_TCON;
spin_unlock(&g_servers_lock);
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_GOOD;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_GOOD;
spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index e209aa3194de..c37ad2bb3ac4 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -124,7 +124,7 @@ tconInfoAlloc(void)
mutex_init(&ret_buf->crfid.dirents.de_mutex);
atomic_inc(&g_tcon_alloc_count);
- ret_buf->status = TID_NEW;
+ ret_buf->status = TCON_STATUS_NEW;
++ret_buf->tc_count;
INIT_LIST_HEAD(&ret_buf->openFileList);
INIT_LIST_HEAD(&ret_buf->tcon_list);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e495121f7d99..73d28b2b4517 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
return 0;
spin_lock(&g_servers_lock);
- if (tcon->status == TID_EXITING) {
+ if (tcon->status == TCON_STATUS_EXITING) {
/*
* only tree disconnect, open, and write,
* (and ulogoff which does not have tcon)
@@ -3873,7 +3873,7 @@ void smb2_reconnect_server(struct work_struct *work)
goto done;
}
- tcon->status = TID_GOOD;
+ tcon->status = TCON_STATUS_GOOD;
tcon->retry = false;
tcon->need_reconnect = false;
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 10/14] cifs: typedef securityEnum
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (6 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 09/14] cifs: typedef tcon " Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 11/14] cifs: rename cifsFYI to debug_level Enzo Matsumiya
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
typedef "enum securityEnum" to "cifs_sectype_t".
Rename the security types values.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_swn.c | 8 ++++----
fs/cifs/cifsfs.c | 10 +++++-----
fs/cifs/cifsglob.h | 28 ++++++++++++++--------------
fs/cifs/cifsproto.h | 8 ++++----
fs/cifs/cifssmb.c | 8 ++++----
fs/cifs/connect.c | 10 +++++-----
fs/cifs/fs_context.c | 8 ++++----
fs/cifs/fs_context.h | 2 +-
fs/cifs/sess.c | 32 ++++++++++++++++----------------
fs/cifs/smb2pdu.c | 30 +++++++++++++++---------------
fs/cifs/smb2proto.h | 4 ++--
11 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c
index 1e4c7cc5287f..58ead3334aae 100644
--- a/fs/cifs/cifs_swn.c
+++ b/fs/cifs/cifs_swn.c
@@ -77,7 +77,7 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg)
{
struct sk_buff *skb;
struct genlmsghdr *hdr;
- enum securityEnum authtype;
+ cifs_sectype_t authtype;
struct sockaddr_storage *addr;
int ret;
@@ -140,15 +140,15 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg)
authtype = cifs_select_sectype(swnreg->tcon->ses->server, swnreg->tcon->ses->sectype);
switch (authtype) {
- case Kerberos:
+ case CIFS_SECTYPE_KERBEROS:
ret = cifs_swn_auth_info_krb(swnreg->tcon, skb);
if (ret < 0) {
cifs_dbg(VFS, "%s: Failed to get kerberos auth info: %d\n", __func__, ret);
goto nlmsg_fail;
}
break;
- case NTLMv2:
- case RawNTLMSSP:
+ case CIFS_SECTYPE_NTLMv2:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
ret = cifs_swn_auth_info_ntlm(swnreg->tcon, skb);
if (ret < 0) {
cifs_dbg(VFS, "%s: Failed to get NTLM auth info: %d\n", __func__, ret);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index a8eb41657859..3a0eb78a3378 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -449,7 +449,7 @@ cifs_show_address(struct seq_file *s, struct cifs_server_info *server)
static void
cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
{
- if (ses->sectype == Unspecified) {
+ if (ses->sectype == CIFS_SECTYPE_UNSPEC) {
if (ses->user_name == NULL)
seq_puts(s, ",sec=none");
return;
@@ -458,13 +458,13 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
seq_puts(s, ",sec=");
switch (ses->sectype) {
- case NTLMv2:
+ case CIFS_SECTYPE_NTLMv2:
seq_puts(s, "ntlmv2");
break;
- case Kerberos:
+ case CIFS_SECTYPE_KERBEROS:
seq_puts(s, "krb5");
break;
- case RawNTLMSSP:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
seq_puts(s, "ntlmssp");
break;
default:
@@ -476,7 +476,7 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
if (ses->sign)
seq_puts(s, "i");
- if (ses->sectype == Kerberos)
+ if (ses->sectype == CIFS_SECTYPE_KERBEROS)
seq_printf(s, ",cruid=%u",
from_kuid_munged(&init_user_ns, ses->cred_uid));
}
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index dddd63b6dc82..e2c6cbacb6d5 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -141,12 +141,12 @@ typedef enum {
TCON_STATUS_IN_FILES_INVALIDATE
} cifs_tcon_status_t;
-enum securityEnum {
- Unspecified = 0, /* not specified */
- NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */
- RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */
- Kerberos, /* Kerberos via SPNEGO */
-};
+typedef enum {
+ CIFS_SECTYPE_UNSPEC = 0, /* not specified */
+ CIFS_SECTYPE_NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */
+ CIFS_SECTYPE_RAW_NTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */
+ CIFS_SECTYPE_KERBEROS, /* Kerberos via SPNEGO */
+} cifs_sectype_t;
struct session_key {
unsigned int len;
@@ -506,8 +506,8 @@ struct smb_version_operations {
int (*is_transform_hdr)(void *buf);
int (*receive_transform)(struct cifs_server_info *,
struct mid_q_entry **, char **, int *);
- enum securityEnum (*select_sectype)(struct cifs_server_info *,
- enum securityEnum);
+ cifs_sectype_t (*select_sectype)(struct cifs_server_info *,
+ cifs_sectype_t);
int (*next_header)(char *);
/* ioctl passthrough for query_info */
int (*ioctl_query_info)(const unsigned int xid,
@@ -1028,7 +1028,7 @@ struct cifs_ses {
char workstation_name[CIFS_MAX_WORKSTATION_LEN];
struct session_key auth_key;
struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */
- enum securityEnum sectype; /* what security flavor was specified? */
+ cifs_sectype_t sectype; /* what security flavor was specified? */
bool sign; /* is signing required? */
bool domainAuto:1;
__u16 session_flags;
@@ -2041,14 +2041,14 @@ extern struct smb_version_values smb302_values;
extern struct smb_version_operations smb311_operations;
extern struct smb_version_values smb311_values;
-static inline char *get_security_type_str(enum securityEnum sectype)
+static inline char *get_security_type_str(cifs_sectype_t sectype)
{
switch (sectype) {
- case RawNTLMSSP:
- return "RawNTLMSSP";
- case Kerberos:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
+ return "CIFS_SECTYPE_RAW_NTLMSSP";
+ case CIFS_SECTYPE_KERBEROS:
return "Kerberos";
- case NTLMv2:
+ case CIFS_SECTYPE_NTLMv2:
return "NTLMv2";
default:
return "Unknown";
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index fce0fd8b1024..439ea5bfc196 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -168,8 +168,8 @@ extern void header_assemble(struct smb_hdr *, char /* command */ ,
extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
struct cifs_ses *ses,
void **request_buf);
-extern enum securityEnum select_sectype(struct cifs_server_info *server,
- enum securityEnum requested);
+extern cifs_sectype_t select_sectype(struct cifs_server_info *server,
+ cifs_sectype_t requested);
extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
struct cifs_server_info *server,
const struct nls_table *nls_cp);
@@ -594,8 +594,8 @@ int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
int __cifs_calc_signature(struct smb_rqst *rqst,
struct cifs_server_info *server, char *signature,
struct shash_desc *shash);
-enum securityEnum cifs_select_sectype(struct cifs_server_info *,
- enum securityEnum);
+cifs_sectype_t cifs_select_sectype(struct cifs_server_info *,
+ cifs_sectype_t);
struct cifs_aio_ctx *cifs_aio_ctx_alloc(void);
void cifs_aio_ctx_release(struct kref *refcount);
int setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index e286bb535c5d..bd987f4042ca 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -505,13 +505,13 @@ cifs_enable_signing(struct cifs_server_info *server, bool mnt_sign_required)
}
static bool
-should_set_ext_sec_flag(enum securityEnum sectype)
+should_set_ext_sec_flag(cifs_sectype_t sectype)
{
switch (sectype) {
- case RawNTLMSSP:
- case Kerberos:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
+ case CIFS_SECTYPE_KERBEROS:
return true;
- case Unspecified:
+ case CIFS_SECTYPE_UNSPEC:
if (global_secflags &
(CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_NTLMSSP))
return true;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 467f1b598eec..0d0bbd2aa880 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1392,11 +1392,11 @@ match_security(struct cifs_server_info *server, struct smb3_fs_context *ctx)
{
/*
* The select_sectype function should either return the ctx->sectype
- * that was specified, or "Unspecified" if that sectype was not
+ * that was specified, or "CIFS_SECTYPE_UNSPEC" if that sectype was not
* compatible with the given NEGOTIATE request.
*/
if (server->ops->select_sectype(server, ctx->sectype)
- == Unspecified)
+ == CIFS_SECTYPE_UNSPEC)
return false;
/*
@@ -1730,7 +1730,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)
{
- if (ctx->sectype != Unspecified &&
+ if (ctx->sectype != CIFS_SECTYPE_UNSPEC &&
ctx->sectype != ses->sectype)
return 0;
@@ -1746,7 +1746,7 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)
spin_unlock(&ses->chan_lock);
switch (ses->sectype) {
- case Kerberos:
+ case CIFS_SECTYPE_KERBEROS:
if (!uid_eq(ctx->cred_uid, ses->cred_uid))
return 0;
break;
@@ -4101,7 +4101,7 @@ cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses)
ctx->sectype = ses->sectype;
/* krb5 is special, since we don't need username or pw */
- if (ctx->sectype == Kerberos)
+ if (ctx->sectype == CIFS_SECTYPE_KERBEROS)
return 0;
return cifs_set_cifscreds(ctx, ses);
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 8dc0d923ef6a..7a2f15e71fa4 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -203,7 +203,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c
* With mount options, the last one should win. Reset any existing
* settings back to default.
*/
- ctx->sectype = Unspecified;
+ ctx->sectype = CIFS_SECTYPE_UNSPEC;
ctx->sign = false;
switch (match_token(value, cifs_secflavor_tokens, args)) {
@@ -214,19 +214,19 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c
ctx->sign = true;
fallthrough;
case Opt_sec_krb5:
- ctx->sectype = Kerberos;
+ ctx->sectype = CIFS_SECTYPE_KERBEROS;
break;
case Opt_sec_ntlmsspi:
ctx->sign = true;
fallthrough;
case Opt_sec_ntlmssp:
- ctx->sectype = RawNTLMSSP;
+ ctx->sectype = CIFS_SECTYPE_RAW_NTLMSSP;
break;
case Opt_sec_ntlmv2i:
ctx->sign = true;
fallthrough;
case Opt_sec_ntlmv2:
- ctx->sectype = NTLMv2;
+ ctx->sectype = CIFS_SECTYPE_NTLMv2;
break;
case Opt_sec_none:
ctx->nullauth = 1;
diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h
index 5f093cb7e9b9..52da4e67cae0 100644
--- a/fs/cifs/fs_context.h
+++ b/fs/cifs/fs_context.h
@@ -182,7 +182,7 @@ struct smb3_fs_context {
kgid_t backupgid;
umode_t file_mode;
umode_t dir_mode;
- enum securityEnum sectype; /* sectype requested via mnt opts */
+ cifs_sectype_t sectype; /* sectype requested via mnt opts */
bool sign; /* was signing requested via mnt opts? */
bool ignore_signature:1;
bool retry:1;
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 2584b150a648..dd34b73eea97 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -1114,40 +1114,40 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
return rc;
}
-enum securityEnum
-cifs_select_sectype(struct cifs_server_info *server, enum securityEnum requested)
+cifs_sectype_t
+cifs_select_sectype(struct cifs_server_info *server, cifs_sectype_t requested)
{
switch (server->negflavor) {
case CIFS_NEGFLAVOR_EXTENDED:
switch (requested) {
- case Kerberos:
- case RawNTLMSSP:
+ case CIFS_SECTYPE_KERBEROS:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
return requested;
- case Unspecified:
+ case CIFS_SECTYPE_UNSPEC:
if (server->sec_ntlmssp &&
(global_secflags & CIFSSEC_MAY_NTLMSSP))
- return RawNTLMSSP;
+ return CIFS_SECTYPE_RAW_NTLMSSP;
if ((server->sec_kerberos || server->sec_mskerberos) &&
(global_secflags & CIFSSEC_MAY_KRB5))
- return Kerberos;
+ return CIFS_SECTYPE_KERBEROS;
fallthrough;
default:
- return Unspecified;
+ return CIFS_SECTYPE_UNSPEC;
}
case CIFS_NEGFLAVOR_UNENCAP:
switch (requested) {
- case NTLMv2:
+ case CIFS_SECTYPE_NTLMv2:
return requested;
- case Unspecified:
+ case CIFS_SECTYPE_UNSPEC:
if (global_secflags & CIFSSEC_MAY_NTLMV2)
- return NTLMv2;
+ return CIFS_SECTYPE_NTLMv2;
break;
default:
break;
}
fallthrough;
default:
- return Unspecified;
+ return CIFS_SECTYPE_UNSPEC;
}
}
@@ -1782,16 +1782,16 @@ static int select_sec(struct sess_data *sess_data)
type = cifs_select_sectype(server, ses->sectype);
cifs_dbg(FYI, "sess setup type %d\n", type);
- if (type == Unspecified) {
+ if (type == CIFS_SECTYPE_UNSPEC) {
cifs_dbg(VFS, "Unable to select appropriate authentication method!\n");
return -EINVAL;
}
switch (type) {
- case NTLMv2:
+ case CIFS_SECTYPE_NTLMv2:
sess_data->func = sess_auth_ntlmv2;
break;
- case Kerberos:
+ case CIFS_SECTYPE_KERBEROS:
#ifdef CONFIG_CIFS_UPCALL
sess_data->func = sess_auth_kerberos;
break;
@@ -1799,7 +1799,7 @@ static int select_sec(struct sess_data *sess_data)
cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n");
return -ENOSYS;
#endif /* CONFIG_CIFS_UPCALL */
- case RawNTLMSSP:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
sess_data->func = sess_auth_rawntlmssp_negotiate;
break;
default:
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 73d28b2b4517..c514d405f9d0 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1056,7 +1056,7 @@ SMB2_negotiate(const unsigned int xid,
/*
* See MS-SMB2 section 2.2.4: if no blob, client picks default which
* for us will be
- * ses->sectype = RawNTLMSSP;
+ * ses->sectype = CIFS_SECTYPE_RAW_NTLMSSP;
* but for time being this is our only auth choice so doesn't matter.
* We just found a server which sets blob length to zero expecting raw.
*/
@@ -1227,25 +1227,25 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
return rc;
}
-enum securityEnum
-smb2_select_sectype(struct cifs_server_info *server, enum securityEnum requested)
+cifs_sectype_t
+smb2_select_sectype(struct cifs_server_info *server, cifs_sectype_t requested)
{
switch (requested) {
- case Kerberos:
- case RawNTLMSSP:
+ case CIFS_SECTYPE_KERBEROS:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
return requested;
- case NTLMv2:
- return RawNTLMSSP;
- case Unspecified:
+ case CIFS_SECTYPE_NTLMv2:
+ return CIFS_SECTYPE_RAW_NTLMSSP;
+ case CIFS_SECTYPE_UNSPEC:
if (server->sec_ntlmssp &&
(global_secflags & CIFSSEC_MAY_NTLMSSP))
- return RawNTLMSSP;
+ return CIFS_SECTYPE_RAW_NTLMSSP;
if ((server->sec_kerberos || server->sec_mskerberos) &&
(global_secflags & CIFSSEC_MAY_KRB5))
- return Kerberos;
+ return CIFS_SECTYPE_KERBEROS;
fallthrough;
default:
- return Unspecified;
+ return CIFS_SECTYPE_UNSPEC;
}
}
@@ -1671,16 +1671,16 @@ SMB2_select_sec(struct SMB2_sess_data *sess_data)
type = smb2_select_sectype(server, ses->sectype);
cifs_dbg(FYI, "sess setup type %d\n", type);
- if (type == Unspecified) {
+ if (type == CIFS_SECTYPE_UNSPEC) {
cifs_dbg(VFS, "Unable to select appropriate authentication method!\n");
return -EINVAL;
}
switch (type) {
- case Kerberos:
+ case CIFS_SECTYPE_KERBEROS:
sess_data->func = SMB2_auth_kerberos;
break;
- case RawNTLMSSP:
+ case CIFS_SECTYPE_RAW_NTLMSSP:
sess_data->func = SMB2_sess_auth_rawntlmssp_negotiate;
break;
default:
@@ -1884,7 +1884,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
!smb3_encryption_required(tcon) &&
!(ses->session_flags &
(SMB2_SESSION_FLAG_IS_GUEST|SMB2_SESSION_FLAG_IS_NULL)) &&
- ((ses->user_name != NULL) || (ses->sectype == Kerberos)))
+ ((ses->user_name != NULL) || (ses->sectype == CIFS_SECTYPE_KERBEROS)))
req->hdr.Flags |= SMB2_FLAGS_SIGNED;
memset(&rqst, 0, sizeof(struct smb_rqst));
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 8ae83ce0083d..81241e844b6d 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -260,8 +260,8 @@ extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
__u8 *lease_key, const __le32 lease_state);
extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *);
-extern enum securityEnum smb2_select_sectype(struct cifs_server_info *,
- enum securityEnum);
+extern cifs_sectype_t smb2_select_sectype(struct cifs_server_info *,
+ cifs_sectype_t);
extern void smb2_parse_contexts(struct cifs_server_info *server,
struct smb2_create_rsp *rsp,
unsigned int *epoch, char *lease_key,
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 11/14] cifs: rename cifsFYI to debug_level
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (7 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 10/14] cifs: typedef securityEnum Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 12/14] cifs: rename list_head fields Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 14/14] cifs: rename more list_heads, remove redundant prefixes Enzo Matsumiya
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename "cifsFYI" to "debug_level" to add more meaning to it.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/Kconfig | 2 +-
fs/cifs/cifs_debug.c | 26 +++++++++++++-------------
fs/cifs/cifs_debug.h | 19 +++++++++----------
fs/cifs/cifs_spnego.c | 2 +-
fs/cifs/cifsfs.c | 4 ++--
fs/cifs/netmisc.c | 2 +-
fs/cifs/smb2maperror.c | 2 +-
fs/cifs/smb2misc.c | 2 +-
fs/cifs/transport.c | 2 +-
9 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index 3b7e3b9e4fd2..5b3a6dbc6eda 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -61,7 +61,7 @@ config CIFS_STATS2
Enabling this option will allow more detailed statistics on SMB
request timing to be displayed in /proc/fs/cifs/DebugData and also
allow optional logging of slow responses to dmesg (depending on the
- value of /proc/fs/cifs/cifsFYI). See Documentation/admin-guide/cifs/usage.rst
+ value of /proc/fs/cifs/debug_level). See Documentation/admin-guide/cifs/usage.rst
for more details. These additional statistics may have a minor effect
on performance and memory utilization.
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index c88bea9d3ac3..0c08166f8f30 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -670,7 +670,7 @@ PROC_FILE_DEFINE(smbd_receive_credit_max);
#endif
static struct proc_dir_entry *proc_fs_cifs;
-static const struct proc_ops cifsFYI_proc_ops;
+static const struct proc_ops debug_level_proc_ops;
static const struct proc_ops cifs_lookup_cache_proc_ops;
static const struct proc_ops traceSMB_proc_ops;
static const struct proc_ops cifs_security_flags_proc_ops;
@@ -691,7 +691,7 @@ cifs_proc_init(void)
cifs_debug_files_proc_show);
proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
- proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
+ proc_create("debug_level", 0644, proc_fs_cifs, &debug_level_proc_ops);
proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
&cifs_linux_ext_proc_ops);
@@ -734,7 +734,7 @@ cifs_proc_clean(void)
remove_proc_entry("DebugData", proc_fs_cifs);
remove_proc_entry("open_files", proc_fs_cifs);
- remove_proc_entry("cifsFYI", proc_fs_cifs);
+ remove_proc_entry("debug_level", proc_fs_cifs);
remove_proc_entry("traceSMB", proc_fs_cifs);
remove_proc_entry("Stats", proc_fs_cifs);
remove_proc_entry("SecurityFlags", proc_fs_cifs);
@@ -758,18 +758,18 @@ cifs_proc_clean(void)
remove_proc_entry("fs/cifs", NULL);
}
-static int cifsFYI_proc_show(struct seq_file *m, void *v)
+static int debug_level_proc_show(struct seq_file *m, void *v)
{
- seq_printf(m, "%d\n", cifsFYI);
+ seq_printf(m, "%d\n", debug_level);
return 0;
}
-static int cifsFYI_proc_open(struct inode *inode, struct file *file)
+static int debug_level_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, cifsFYI_proc_show, NULL);
+ return single_open(file, debug_level_proc_show, NULL);
}
-static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
+static ssize_t debug_level_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
char c[2] = { '\0' };
@@ -780,21 +780,21 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
if (rc)
return rc;
if (strtobool(c, &bv) == 0)
- cifsFYI = bv;
+ debug_level = bv;
else if ((c[0] > '1') && (c[0] <= '9'))
- cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */
+ debug_level = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */
else
return -EINVAL;
return count;
}
-static const struct proc_ops cifsFYI_proc_ops = {
- .proc_open = cifsFYI_proc_open,
+static const struct proc_ops debug_level_proc_ops = {
+ .proc_open = debug_level_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
- .proc_write = cifsFYI_proc_write,
+ .proc_write = debug_level_proc_write,
};
static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
index 2ac0e384fd12..3e5f9a68c62d 100644
--- a/fs/cifs/cifs_debug.h
+++ b/fs/cifs/cifs_debug.h
@@ -5,13 +5,10 @@
* Modified by Steve French (sfrench@us.ibm.com)
*/
-#ifndef _H_CIFS_DEBUG
-#define _H_CIFS_DEBUG
+#ifndef _CIFS_DEBUG_H
+#define _CIFS_DEBUG_H
-#ifdef pr_fmt
#undef pr_fmt
-#endif
-
#define pr_fmt(fmt) "CIFS: " fmt
void cifs_dump_mem(char *, void *, int );
@@ -19,13 +16,15 @@ void cifs_dump_detail(void *, struct cifs_server_info *);
void cifs_dump_mids(struct cifs_server_info *);
extern bool traceSMB; /* flag which enables the function below */
void dump_smb(void *, int);
+
#define CIFS_INFO 0x01
#define CIFS_RC 0x02
#define CIFS_TIMER 0x04
#define VFS 1
#define FYI 2
-extern int cifsFYI;
+extern int debug_level;
+
#ifdef CONFIG_CIFS_DEBUG2
#define NOISY 4
#else
@@ -61,7 +60,7 @@ extern int cifsFYI;
/* information message: e.g., configuration, major event */
#define cifs_dbg_func(ratefunc, type, fmt, ...) \
do { \
- if ((type) & FYI && cifsFYI & CIFS_INFO) { \
+ if ((type) & FYI && debug_level & CIFS_INFO) { \
pr_debug_ ## ratefunc("%s: " fmt, \
__FILE__, ##__VA_ARGS__); \
} else if ((type) & VFS) { \
@@ -84,7 +83,7 @@ do { \
const char *sn = ""; \
if (server && server->hostname) \
sn = server->hostname; \
- if ((type) & FYI && cifsFYI & CIFS_INFO) { \
+ if ((type) & FYI && debug_level & CIFS_INFO) { \
pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \
__FILE__, sn, ##__VA_ARGS__); \
} else if ((type) & VFS) { \
@@ -110,7 +109,7 @@ do { \
const char *tn = ""; \
if (tcon && tcon->treeName) \
tn = tcon->treeName; \
- if ((type) & FYI && cifsFYI & CIFS_INFO) { \
+ if ((type) & FYI && debug_level & CIFS_INFO) { \
pr_debug_ ## ratefunc("%s: %s " fmt, \
__FILE__, tn, ##__VA_ARGS__); \
} else if ((type) & VFS) { \
@@ -157,4 +156,4 @@ do { \
pr_info(fmt, ##__VA_ARGS__)
#endif
-#endif /* _H_CIFS_DEBUG */
+#endif /* _CIFS_DEBUG_H */
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index 60f551deb443..46a50aceb23d 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -162,7 +162,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo,
revert_creds(saved_cred);
#ifdef CONFIG_CIFS_DEBUG2
- if (cifsFYI && !IS_ERR(spnego_key)) {
+ if (debug_level && !IS_ERR(spnego_key)) {
struct cifs_spnego_msg *msg = spnego_key->payload.data[0];
cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024U,
msg->secblob_len + msg->sesskey_len));
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 3a0eb78a3378..5bb51b8cd3bd 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -56,7 +56,7 @@
#define SMB_DATE_MIN (0<<9 | 1<<5 | 1)
#define SMB_TIME_MAX (23<<11 | 59<<5 | 29)
-int cifsFYI = 0;
+int debug_level = 0;
bool traceSMB;
bool enable_oplocks = true;
bool linuxExtEnabled = true;
@@ -856,7 +856,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
* Prints in Kernel / CIFS log the attempted mount operation
* If CIFS_DEBUG && cifs_FYI
*/
- if (cifsFYI)
+ if (debug_level)
cifs_dbg(FYI, "Devname: %s flags: %d\n", old_ctx->UNC, flags);
else
cifs_info("Attempting to mount %s\n", old_ctx->UNC);
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 0efd58db351e..33beaf148223 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -827,7 +827,7 @@ map_smb_to_linux_error(char *buf, bool logErr)
__u32 err = le32_to_cpu(smb->Status.CifsError);
if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED)))
cifs_print_status(err);
- else if (cifsFYI & CIFS_RC)
+ else if (debug_level & CIFS_RC)
cifs_print_status(err);
ntstatus_to_dos(err, &smberrclass, &smberrcode);
} else {
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
index 194799ddd382..1b0eae9c367b 100644
--- a/fs/cifs/smb2maperror.c
+++ b/fs/cifs/smb2maperror.c
@@ -2456,7 +2456,7 @@ map_smb2_to_linux_error(char *buf, bool log_err)
if (log_err && (smb2err != STATUS_MORE_PROCESSING_REQUIRED) &&
(smb2err != STATUS_END_OF_FILE))
smb2_print_status(smb2err);
- else if (cifsFYI & CIFS_RC)
+ else if (debug_level & CIFS_RC)
smb2_print_status(smb2err);
for (i = 0; i < sizeof(smb2_error_map_table) /
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index dbaee6343fdc..587362124842 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -260,7 +260,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)
return 0;
/* Only log a message if len was really miscalculated */
- if (unlikely(cifsFYI))
+ if (unlikely(debug_level))
cifs_dbg(FYI, "Server response too short: calculated "
"length %u doesn't match read length %u (cmd=%d, mid=%llu)\n",
calc_len, len, command, mid);
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index b681a0c9b03d..74ddf1201ab1 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -137,7 +137,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)
trace_smb3_slow_rsp(smb_cmd, midEntry->mid, midEntry->pid,
midEntry->when_sent, midEntry->when_received);
- if (cifsFYI & CIFS_TIMER) {
+ if (debug_level & CIFS_TIMER) {
pr_debug("slow rsp: cmd %d mid %llu",
midEntry->command, midEntry->mid);
cifs_info("A: 0x%lx S: 0x%lx R: 0x%lx\n",
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 12/14] cifs: rename list_head fields
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (8 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 11/14] cifs: rename cifsFYI to debug_level Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 14/14] cifs: rename more list_heads, remove redundant prefixes Enzo Matsumiya
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename list_head fields for several structs to give more meaning and/or
set some standard for all cifs.ko structs.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 38 ++++----
fs/cifs/cifsfs.c | 6 +-
fs/cifs/cifsglob.h | 68 +++++++--------
fs/cifs/cifssmb.c | 10 +--
fs/cifs/connect.c | 48 +++++-----
fs/cifs/dfs_cache.c | 6 +-
fs/cifs/file.c | 188 ++++++++++++++++++++--------------------
fs/cifs/ioctl.c | 4 +-
fs/cifs/misc.c | 65 +++++++-------
fs/cifs/readdir.c | 4 +-
fs/cifs/sess.c | 8 +-
fs/cifs/smb1ops.c | 4 +-
fs/cifs/smb2file.c | 14 +--
fs/cifs/smb2misc.c | 32 +++----
fs/cifs/smb2ops.c | 31 ++++---
fs/cifs/smb2pdu.c | 4 +-
fs/cifs/smb2transport.c | 10 +--
fs/cifs/transport.c | 8 +-
18 files changed, 273 insertions(+), 275 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 0c08166f8f30..8c8e33642fdd 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -56,7 +56,7 @@ void cifs_dump_mids(struct cifs_server_info *server)
cifs_dbg(VFS, "Dump pending requests:\n");
spin_lock(&g_mid_lock);
- list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
+ list_for_each_entry(mid_entry, &server->pending_mid_q, head) {
cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
mid_entry->mid_state,
le16_to_cpu(mid_entry->command),
@@ -182,11 +182,12 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
seq_printf(m, " <filename>\n");
#endif /* CIFS_DEBUG2 */
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ list_for_each_entry(server, &g_servers_list, head) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list,
+ tcon_head) {
seq_printf(m,
"0x%x 0x%llx 0x%x %d %d %d %pd",
tcon->tid,
@@ -202,7 +203,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\n");
#endif /* CIFS_DEBUG2 */
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
}
}
}
@@ -268,7 +269,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
c = 0;
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
+ list_for_each_entry(server, &g_servers_list, head) {
/* channel info will be printed as a part of sessions below */
if (CIFS_SERVER_IS_CHAN(server))
continue;
@@ -375,7 +376,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\n\n\tSessions: ");
i = 0;
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
i++;
if ((ses->serverDomain == NULL) ||
(ses->serverOS == NULL) ||
@@ -439,7 +440,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
else
seq_puts(m, "none\n");
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
++j;
seq_printf(m, "\n\t%d) ", j);
cifs_debug_tcon(m, tcon);
@@ -450,8 +451,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\n\n\tServer interfaces: %zu",
ses->iface_count);
j = 0;
- list_for_each_entry(iface, &ses->iface_list,
- iface_head) {
+ list_for_each_entry(iface, &ses->iface_list, head) {
seq_printf(m, "\n\t%d)", ++j);
cifs_dump_iface(m, iface);
if (is_ses_using_iface(ses, iface))
@@ -464,7 +464,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_puts(m, "\n\n\tMIDs: ");
spin_lock(&g_mid_lock);
- list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
+ list_for_each_entry(mid_entry, &server->pending_mid_q, head) {
seq_printf(m, "\n\tState: %d com: %d pid:"
" %d cbdata: %p mid %llu\n",
mid_entry->mid_state,
@@ -512,7 +512,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
g_current_xid = 0;
spin_unlock(&g_mid_lock);
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
+ list_for_each_entry(server, &g_servers_list, head) {
server->max_in_flight = 0;
#ifdef CONFIG_CIFS_STATS2
for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
@@ -523,8 +523,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
server->fastest_cmd[0] = 0;
}
#endif /* CONFIG_CIFS_STATS2 */
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
atomic_set(&tcon->num_smbs_sent, 0);
spin_lock(&tcon->stat_lock);
tcon->bytes_read = 0;
@@ -579,7 +579,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
i = 0;
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
+ list_for_each_entry(server, &g_servers_list, head) {
seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
#ifdef CONFIG_CIFS_STATS2
seq_puts(m, "\nTotal time spent processing by command. Time ");
@@ -598,8 +598,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
atomic_read(&server->smb2slowcmd[j]),
server->hostname, j);
#endif /* STATS2 */
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
i++;
seq_printf(m, "\n%d) %s", i, tcon->treeName);
if (tcon->need_reconnect)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 5bb51b8cd3bd..497b64acf899 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -391,7 +391,7 @@ cifs_alloc_inode(struct super_block *sb)
cinode->uniqueid = 0;
cinode->createtime = 0;
cinode->epoch = 0;
- spin_lock_init(&cinode->open_file_lock);
+ spin_lock_init(&cinode->open_files_lock);
generate_random_uuid(cinode->lease_key);
/*
@@ -399,8 +399,8 @@ cifs_alloc_inode(struct super_block *sb)
* by the VFS.
*/
/* cinode->netfs.inode.i_flags = S_NOATIME | S_NOCMTIME; */
- INIT_LIST_HEAD(&cinode->openFileList);
- INIT_LIST_HEAD(&cinode->llist);
+ INIT_LIST_HEAD(&cinode->open_files_list);
+ INIT_LIST_HEAD(&cinode->fid_locks_list);
INIT_LIST_HEAD(&cinode->deferred_closes);
spin_lock_init(&cinode->deferred_lock);
return &cinode->netfs.inode;
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index e2c6cbacb6d5..03837f5781db 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -603,8 +603,8 @@ inc_rfc1001_len(void *buf, int count)
}
struct cifs_server_info {
- struct list_head server_head;
- struct list_head smb_ses_list;
+ struct list_head head;
+ struct list_head ses_list;
__u64 conn_id; /* connection identifier (useful for debugging) */
int srv_count; /* reference counter */
/* 15 character server name + 0x20 16th byte indicating type = srv */
@@ -936,7 +936,7 @@ static inline void cifs_set_net_ns(struct cifs_server_info *srv, struct net *net
#endif
struct cifs_server_iface {
- struct list_head iface_head;
+ struct list_head head;
struct kref refcount;
size_t speed;
unsigned int rdma_capable : 1;
@@ -952,7 +952,7 @@ release_iface(struct kref *ref)
struct cifs_server_iface *iface = container_of(ref,
struct cifs_server_iface,
refcount);
- list_del_init(&iface->iface_head);
+ list_del_init(&iface->head);
kfree(iface);
}
@@ -1004,7 +1004,7 @@ struct cifs_chan {
* Session structure. One of these for each uid session with a particular host
*/
struct cifs_ses {
- struct list_head smb_ses_list;
+ struct list_head head;
struct list_head rlist; /* reconnect list */
struct list_head tcon_list;
struct cifs_tcon *tcon_ipc;
@@ -1126,7 +1126,7 @@ struct cifs_fattr {
};
struct cached_dirent {
- struct list_head entry;
+ struct list_head head;
char *name;
int namelen;
loff_t pos;
@@ -1166,13 +1166,13 @@ struct cached_fid {
* session
*/
struct cifs_tcon {
- struct list_head tcon_list;
+ struct list_head head;
int tc_count;
struct list_head rlist; /* reconnect list */
atomic_t num_local_opens; /* num of all opens including disconnected */
atomic_t num_remote_opens; /* num of all network opens on server */
- struct list_head openFileList;
- spinlock_t open_file_lock; /* protects list above */
+ struct list_head open_files_list;
+ spinlock_t open_files_lock; /* protects list above */
struct cifs_ses *ses; /* pointer to session associated with */
char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
char *nativeFileSystem;
@@ -1310,14 +1310,14 @@ extern struct cifs_tcon *cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb);
#define CIFS_OPLOCK_NO_CHANGE 0xfe
struct cifs_pending_open {
- struct list_head olist;
+ struct list_head head;
struct tcon_link *tlink;
__u8 lease_key[16];
__u32 oplock;
};
struct cifs_deferred_close {
- struct list_head dlist;
+ struct list_head head;
struct tcon_link *tlink;
__u16 netfid;
__u64 persistent_fid;
@@ -1325,11 +1325,11 @@ struct cifs_deferred_close {
};
/*
- * This info hangs off the cifs_file_info structure, pointed to by llist.
+ * This info hangs off the cifs_file_info structure.
* This is used to track byte stream locks on the file
*/
struct cifs_lock_info {
- struct list_head llist; /* pointer to next cifs_lock_info */
+ struct list_head head; /* pointer to next cifs_lock_info */
struct list_head blist; /* pointer to locks blocked on this */
wait_queue_head_t block_q;
__u64 offset;
@@ -1387,27 +1387,27 @@ struct cifs_fid {
};
struct cifs_fid_locks {
- struct list_head llist;
+ struct list_head head;
struct cifs_file_info *cfile; /* fid that owns locks */
struct list_head locks; /* locks held by fid above */
};
struct cifs_file_info {
- /* following two lists are protected by tcon->open_file_lock */
- struct list_head tlist; /* pointer to next fid owned by tcon */
- struct list_head flist; /* next fid (file instance) for this inode */
+ /* following two lists are protected by tcon->open_files_lock */
+ struct list_head tcon_head; /* pointer to next fid owned by tcon */
+ struct list_head fid_head; /* next fid (file instance) for this inode */
/* lock list below protected by cinode->lock_sem */
- struct cifs_fid_locks *llist; /* brlocks held by this fid */
- kuid_t uid; /* allows finding which FileInfo structure */
- __u32 pid; /* process id who opened file */
- struct cifs_fid fid; /* file id from remote */
+ struct cifs_fid_locks *fid_locks; /* brlocks held by this fid */
+ kuid_t uid; /* allows finding which FileInfo structure */
+ __u32 pid; /* process id who opened file */
+ struct cifs_fid fid; /* file id from remote */
struct list_head rlist; /* reconnect list */
/* BB add lock scope info here if needed */ ;
/* lock scope id (0 if none) */
struct dentry *dentry;
struct tcon_link *tlink;
unsigned int f_flags;
- bool invalidHandle:1; /* file closed via session abend */
+ bool invalidHandle:1; /* file closed via session abend */
bool swapfile:1;
bool oplock_break_cancelled:1;
unsigned int oplock_epoch; /* epoch from the lease break */
@@ -1435,7 +1435,7 @@ struct cifs_io_parms {
struct cifs_aio_ctx {
struct kref refcount;
- struct list_head list;
+ struct list_head rw_list;
struct mutex aio_mutex;
struct completion done;
struct iov_iter iter;
@@ -1458,7 +1458,7 @@ struct cifs_aio_ctx {
/* asynchronous read support */
struct cifs_readdata {
struct kref refcount;
- struct list_head list;
+ struct list_head head;
struct completion done;
struct cifs_file_info *cfile;
struct address_space *mapping;
@@ -1491,7 +1491,7 @@ struct cifs_readdata {
/* asynchronous write support */
struct cifs_writedata {
struct kref refcount;
- struct list_head list;
+ struct list_head head;
struct completion done;
enum writeback_sync_modes sync_mode;
struct work_struct work;
@@ -1546,7 +1546,7 @@ void cifs_file_info_put(struct cifs_file_info *cifs_file);
struct cifs_inode_info {
struct netfs_inode netfs; /* Netfslib context and vfs inode */
bool can_cache_brlcks;
- struct list_head llist; /* locks helb by this inode */
+ struct list_head fid_locks_list; /* locks helb by this inode */
/*
* NOTE: Some code paths call down_read(lock_sem) twice, so
* we must always use cifs_down_write() instead of down_write()
@@ -1554,8 +1554,8 @@ struct cifs_inode_info {
*/
struct rw_semaphore lock_sem; /* protect the fields above */
/* BB add in lists for dirty pages i.e. write caching info for oplock */
- struct list_head openFileList;
- spinlock_t open_file_lock; /* protects openFileList */
+ struct list_head open_files_list;
+ spinlock_t open_files_lock; /* protects open_files_list */
__u32 cifs_attrs; /* e.g. DOS archive bit, sparse, compressed, system */
unsigned int oplock; /* oplock/lease level we have */
unsigned int epoch; /* used to track lease state changes */
@@ -1676,7 +1676,7 @@ typedef int (mid_handle_t)(struct cifs_server_info *server,
/* one of these for every pending CIFS request to the server */
struct mid_q_entry {
- struct list_head qhead; /* mids waiting on reply from this server */
+ struct list_head head; /* mids waiting on reply from this server */
struct kref refcount;
struct cifs_server_info *server; /* server corresponding to this mid */
__u64 mid; /* multiplex id */
@@ -1912,14 +1912,14 @@ require use of the stronger protocol */
* updates to server->current_mid
* g_servers_lock protects:
* list operations on tcp and SMB session lists
- * tcon->open_file_lock protects the list of open files hanging off the tcon
- * inode->open_file_lock protects the openFileList hanging off the inode
+ * tcon->open_files_lock protects the list of open files hanging off the tcon
+ * inode->open_files_lock protects the open_files_list hanging off the inode
* cfile->file_info_lock protects counters and fields in cifs file struct
* f_owner.lock protects certain per file struct operations
* mapping->page_lock protects certain per page operations
*
- * Note that the cifs_tcon.open_file_lock should be taken before
- * not after the cifs_inode_info.open_file_lock
+ * Note that the cifs_tcon.open_files_lock should be taken before
+ * not after the cifs_inode_info.open_files_lock
*
* Semaphores
* ----------
@@ -1950,7 +1950,7 @@ extern struct list_head g_servers_list;
* protects some fields in the cifs_server_info struct such as dstaddr. Finally,
* changes to the tcon->tidStatus should be done while holding this lock.
* generally the locks should be taken in order g_servers_lock before
- * tcon->open_file_lock and that before file->file_info_lock since the
+ * tcon->open_files_lock and that before file->file_info_lock since the
* structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file
*/
extern spinlock_t g_servers_lock;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index bd987f4042ca..52bbbf7274af 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -84,13 +84,13 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
spin_unlock(&g_servers_lock);
/* list all files open on tree connection and mark them invalid */
- spin_lock(&tcon->open_file_lock);
- list_for_each_safe(tmp, tmp1, &tcon->openFileList) {
- open_file = list_entry(tmp, struct cifs_file_info, tlist);
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_safe(tmp, tmp1, &tcon->open_files_list) {
+ open_file = list_entry(tmp, struct cifs_file_info, tcon_head);
open_file->invalidHandle = true;
open_file->oplock_break_cancelled = true;
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
mutex_lock(&tcon->crfid.fid_mutex);
tcon->crfid.is_valid = false;
@@ -2080,7 +2080,7 @@ cifs_writedata_direct_alloc(struct page **pages, work_func_t complete)
if (wdata != NULL) {
wdata->pages = pages;
kref_init(&wdata->refcount);
- INIT_LIST_HEAD(&wdata->list);
+ INIT_LIST_HEAD(&wdata->head);
init_completion(&wdata->done);
INIT_WORK(&wdata->work, complete);
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0d0bbd2aa880..1f4fa32b7f89 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -212,7 +212,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
return;
}
- list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(ses, &pserver->ses_list, head) {
spin_lock(&ses->chan_lock);
for (i = 0; i < ses->chan_count; i++)
ses->chans[i].server->status = SERVER_STATUS_NEED_RECONNECT;
@@ -250,7 +250,7 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,
spin_lock(&g_servers_lock);
- list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) {
+ list_for_each_entry_safe(ses, nses, &pserver->ses_list, head) {
/* check if iface is still active */
if (!cifs_chan_is_iface_active(ses, server)) {
/*
@@ -279,7 +279,7 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,
ses->status = SES_STATUS_NEED_RECONNECT;
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
tcon->need_reconnect = true;
tcon->status = TCON_STATUS_NEED_RECONNECT;
}
@@ -324,19 +324,19 @@ cifs_abort_connection(struct cifs_server_info *server)
INIT_LIST_HEAD(&retry_list);
cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
spin_lock(&g_mid_lock);
- list_for_each_entry_safe(mid, nmid, &server->pending_mid_q, qhead) {
+ list_for_each_entry_safe(mid, nmid, &server->pending_mid_q, head) {
kref_get(&mid->refcount);
if (mid->mid_state == MID_REQUEST_SUBMITTED)
mid->mid_state = MID_RETRY_NEEDED;
- list_move(&mid->qhead, &retry_list);
+ list_move(&mid->head, &retry_list);
mid->mid_flags |= MID_DELETED;
}
spin_unlock(&g_mid_lock);
cifs_server_unlock(server);
cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
- list_for_each_entry_safe(mid, nmid, &retry_list, qhead) {
- list_del_init(&mid->qhead);
+ list_for_each_entry_safe(mid, nmid, &retry_list, head) {
+ list_del_init(&mid->head);
mid->callback(mid);
cifs_mid_q_entry_release(mid);
}
@@ -862,7 +862,7 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
spin_unlock(&g_mid_lock);
pr_warn_once("trying to dequeue a deleted mid\n");
} else {
- list_del_init(&mid->qhead);
+ list_del_init(&mid->head);
mid->mid_flags |= MID_DELETED;
spin_unlock(&g_mid_lock);
}
@@ -909,7 +909,7 @@ static void clean_demultiplex_info(struct cifs_server_info *server)
/* take it off the list, if it's not already */
spin_lock(&g_servers_lock);
- list_del_init(&server->server_head);
+ list_del_init(&server->head);
spin_unlock(&g_servers_lock);
cancel_delayed_work_sync(&server->echo);
@@ -950,20 +950,20 @@ static void clean_demultiplex_info(struct cifs_server_info *server)
INIT_LIST_HEAD(&dispose_list);
spin_lock(&g_mid_lock);
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
- mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
+ mid_entry = list_entry(tmp, struct mid_q_entry, head);
cifs_dbg(FYI, "Clearing mid %llu\n", mid_entry->mid);
kref_get(&mid_entry->refcount);
mid_entry->mid_state = MID_SHUTDOWN;
- list_move(&mid_entry->qhead, &dispose_list);
+ list_move(&mid_entry->head, &dispose_list);
mid_entry->mid_flags |= MID_DELETED;
}
spin_unlock(&g_mid_lock);
/* now walk dispose list and issue callbacks */
list_for_each_safe(tmp, tmp2, &dispose_list) {
- mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
+ mid_entry = list_entry(tmp, struct mid_q_entry, head);
cifs_dbg(FYI, "Callback mid %llu\n", mid_entry->mid);
- list_del_init(&mid_entry->qhead);
+ list_del_init(&mid_entry->head);
mid_entry->callback(mid_entry);
cifs_mid_q_entry_release(mid_entry);
}
@@ -1469,7 +1469,7 @@ cifs_find_server(struct smb3_fs_context *ctx)
struct cifs_server_info *server;
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
+ list_for_each_entry(server, &g_servers_list, head) {
#ifdef CONFIG_CIFS_DFS_UPCALL
/*
* DFS failover implementation in cifs_reconnect() requires unique tcp sessions for
@@ -1512,7 +1512,7 @@ cifs_put_server(struct cifs_server_info *server, int from_reconnect)
put_net(cifs_net_ns(server));
- list_del_init(&server->server_head);
+ list_del_init(&server->head);
spin_unlock(&g_servers_lock);
/* For secondary channels, we pick up ref-count on the primary server */
@@ -1611,8 +1611,8 @@ cifs_get_server(struct smb3_fs_context *ctx,
server->lstrp = jiffies;
server->compress_algorithm = cpu_to_le16(ctx->compression);
spin_lock_init(&server->req_lock);
- INIT_LIST_HEAD(&server->server_head);
- INIT_LIST_HEAD(&server->smb_ses_list);
+ INIT_LIST_HEAD(&server->head);
+ INIT_LIST_HEAD(&server->ses_list);
INIT_DELAYED_WORK(&server->echo, cifs_echo_request);
INIT_DELAYED_WORK(&server->resolve, cifs_resolve_server);
INIT_DELAYED_WORK(&server->reconnect, smb2_reconnect_server);
@@ -1697,7 +1697,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
server->ignore_signature = ctx->ignore_signature;
/* thread spawned, put it on the list */
spin_lock(&g_servers_lock);
- list_add(&server->server_head, &g_servers_list);
+ list_add(&server->head, &g_servers_list);
spin_unlock(&g_servers_lock);
/* queue echo request delayed work */
@@ -1862,7 +1862,7 @@ cifs_find_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
struct cifs_ses *ses;
spin_lock(&g_servers_lock);
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
if (ses->status == SES_STATUS_EXITING)
continue;
if (!match_session(ses, ctx))
@@ -1914,7 +1914,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
}
spin_lock(&g_servers_lock);
- list_del_init(&ses->smb_ses_list);
+ list_del_init(&ses->head);
spin_unlock(&g_servers_lock);
chan_count = ses->chan_count;
@@ -2220,7 +2220,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
* need to lock before changing something in the session.
*/
spin_lock(&g_servers_lock);
- list_add(&ses->smb_ses_list, &server->smb_ses_list);
+ list_add(&ses->head, &server->ses_list);
spin_unlock(&g_servers_lock);
free_xid(xid);
@@ -2260,7 +2260,7 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
struct cifs_tcon *tcon;
spin_lock(&g_servers_lock);
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (!match_tcon(tcon, ctx))
continue;
++tcon->tc_count;
@@ -2295,7 +2295,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
/* tc_count can never go negative */
WARN_ON(tcon->tc_count < 0);
- list_del_init(&tcon->tcon_list);
+ list_del_init(&tcon->head);
spin_unlock(&g_servers_lock);
/* cancel polling of interfaces */
@@ -2545,7 +2545,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
(SMB_INTERFACE_POLL_INTERVAL * HZ));
spin_lock(&g_servers_lock);
- list_add(&tcon->tcon_list, &ses->tcon_list);
+ list_add(&tcon->head, &ses->tcon_list);
spin_unlock(&g_servers_lock);
return tcon;
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index c864ca4432f0..14288096d555 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -1525,12 +1525,12 @@ static void refresh_mounts(struct cifs_ses **sessions)
INIT_LIST_HEAD(&tcons);
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
+ list_for_each_entry(server, &g_servers_list, head) {
if (!server->is_dfs_conn)
continue;
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (!tcon->ipc && !tcon->need_reconnect) {
tcon->tc_count++;
list_add_tail(&tcon->ulist, &tcons);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index c3561ac3c6d8..b4e171c6f4f6 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -259,7 +259,7 @@ cifs_has_mand_locks(struct cifs_inode_info *cinode)
bool has_locks = false;
down_read(&cinode->lock_sem);
- list_for_each_entry(cur, &cinode->llist, llist) {
+ list_for_each_entry(cur, &cinode->fid_locks_list, head) {
if (!list_empty(&cur->locks)) {
has_locks = true;
break;
@@ -302,7 +302,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
INIT_LIST_HEAD(&fdlocks->locks);
fdlocks->cfile = cfile;
- cfile->llist = fdlocks;
+ cfile->fid_locks = fdlocks;
cfile->count = 1;
cfile->pid = current->tgid;
@@ -330,28 +330,28 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
}
cifs_down_write(&cinode->lock_sem);
- list_add(&fdlocks->llist, &cinode->llist);
+ list_add(&fdlocks->head, &cinode->fid_locks_list);
up_write(&cinode->lock_sem);
- spin_lock(&tcon->open_file_lock);
+ spin_lock(&tcon->open_files_lock);
if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE && oplock)
oplock = fid->pending_open->oplock;
- list_del(&fid->pending_open->olist);
+ list_del(&fid->pending_open->head);
fid->purge_cache = false;
server->ops->set_fid(cfile, fid, oplock);
- list_add(&cfile->tlist, &tcon->openFileList);
+ list_add(&cfile->tcon_head, &tcon->open_files_list);
atomic_inc(&tcon->num_local_opens);
/* if readable file instance put first in list*/
- spin_lock(&cinode->open_file_lock);
+ spin_lock(&cinode->open_files_lock);
if (file->f_mode & FMODE_READ)
- list_add(&cfile->flist, &cinode->openFileList);
+ list_add(&cfile->fid_head, &cinode->open_files_list);
else
- list_add_tail(&cfile->flist, &cinode->openFileList);
- spin_unlock(&cinode->open_file_lock);
- spin_unlock(&tcon->open_file_lock);
+ list_add_tail(&cfile->fid_head, &cinode->open_files_list);
+ spin_unlock(&cinode->open_files_lock);
+ spin_unlock(&tcon->open_files_lock);
if (fid->purge_cache)
cifs_zap_mapping(inode);
@@ -381,13 +381,13 @@ static void cifs_file_info_put_final(struct cifs_file_info *cifs_file)
* is closed anyway.
*/
cifs_down_write(&cinode->lock_sem);
- list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) {
- list_del(&li->llist);
+ list_for_each_entry_safe(li, tmp, &cifs_file->fid_locks->locks, head) {
+ list_del(&li->head);
cifs_del_lock_waiters(li);
kfree(li);
}
- list_del(&cifs_file->llist->llist);
- kfree(cifs_file->llist);
+ list_del(&cifs_file->fid_locks->head);
+ kfree(cifs_file->fid_locks);
up_write(&cinode->lock_sem);
cifs_put_tlink(cifs_file->tlink);
@@ -420,8 +420,8 @@ void cifs_file_info_put(struct cifs_file_info *cifs_file)
* _cifs_file_info_put - release a reference of file priv data
*
* This may involve closing the filehandle @cifs_file out on the
- * server. Must be called without holding tcon->open_file_lock,
- * cinode->open_file_lock and cifs_file->file_info_lock.
+ * server. Must be called without holding tcon->open_files_lock,
+ * cinode->open_files_lock and cifs_file->file_info_lock.
*
* If @wait_for_oplock_handler is true and we are releasing the last
* reference, wait for any running oplock break handler of the file
@@ -445,13 +445,13 @@ void _cifs_file_info_put(struct cifs_file_info *cifs_file,
struct cifs_pending_open open;
bool oplock_break_cancelled;
- spin_lock(&tcon->open_file_lock);
- spin_lock(&cinode->open_file_lock);
+ spin_lock(&tcon->open_files_lock);
+ spin_lock(&cinode->open_files_lock);
spin_lock(&cifs_file->file_info_lock);
if (--cifs_file->count > 0) {
spin_unlock(&cifs_file->file_info_lock);
- spin_unlock(&cinode->open_file_lock);
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
+ spin_unlock(&tcon->open_files_lock);
return;
}
spin_unlock(&cifs_file->file_info_lock);
@@ -463,11 +463,11 @@ void _cifs_file_info_put(struct cifs_file_info *cifs_file,
cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open);
/* remove it from the lists */
- list_del(&cifs_file->flist);
- list_del(&cifs_file->tlist);
+ list_del(&cifs_file->fid_head);
+ list_del(&cifs_file->tcon_head);
atomic_dec(&tcon->num_local_opens);
- if (list_empty(&cinode->openFileList)) {
+ if (list_empty(&cinode->open_files_list)) {
cifs_dbg(FYI, "closing last open instance for inode %p\n",
d_inode(cifs_file->dentry));
/*
@@ -480,8 +480,8 @@ void _cifs_file_info_put(struct cifs_file_info *cifs_file,
cifs_set_oplock_level(cinode, 0);
}
- spin_unlock(&cinode->open_file_lock);
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
+ spin_unlock(&tcon->open_files_lock);
oplock_break_cancelled = wait_oplock_handler ?
cancel_work_sync(&cifs_file->oplock_break) : false;
@@ -940,14 +940,14 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
INIT_LIST_HEAD(&tmp_list);
/* list all files open on tree connection, reopen resilient handles */
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(open_file, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(open_file, &tcon->open_files_list, tcon_head) {
if (!open_file->invalidHandle)
continue;
cifs_file_info_get(open_file);
list_add_tail(&open_file->rlist, &tmp_list);
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
list_for_each_entry_safe(open_file, tmp, &tmp_list, rlist) {
if (cifs_reopen_file(open_file, false /* do not flush */))
@@ -1050,7 +1050,7 @@ cifs_find_fid_lock_conflict(struct cifs_fid_locks *fdlocks, __u64 offset,
struct cifs_file_info *cur_cfile = fdlocks->cfile;
struct cifs_server_info *server = tlink_tcon(cfile->tlink)->ses->server;
- list_for_each_entry(li, &fdlocks->locks, llist) {
+ list_for_each_entry(li, &fdlocks->locks, head) {
if (offset + length <= li->offset ||
offset >= li->offset + li->length)
continue;
@@ -1085,7 +1085,7 @@ cifs_find_lock_conflict(struct cifs_file_info *cfile, __u64 offset, __u64 length
struct cifs_fid_locks *cur;
struct cifs_inode_info *cinode = CIFS_I(d_inode(cfile->dentry));
- list_for_each_entry(cur, &cinode->llist, llist) {
+ list_for_each_entry(cur, &cinode->fid_locks_list, head) {
rc = cifs_find_fid_lock_conflict(cur, offset, length, type,
flags, cfile, conf_lock,
rw_check);
@@ -1140,7 +1140,7 @@ cifs_lock_add(struct cifs_file_info *cfile, struct cifs_lock_info *lock)
{
struct cifs_inode_info *cinode = CIFS_I(d_inode(cfile->dentry));
cifs_down_write(&cinode->lock_sem);
- list_add_tail(&lock->llist, &cfile->llist->locks);
+ list_add_tail(&lock->head, &cfile->fid_locks->locks);
up_write(&cinode->lock_sem);
}
@@ -1167,7 +1167,7 @@ cifs_lock_add_if(struct cifs_file_info *cfile, struct cifs_lock_info *lock,
lock->type, lock->flags, &conf_lock,
CIFS_LOCK_OP);
if (!exist && cinode->can_cache_brlcks) {
- list_add_tail(&lock->llist, &cfile->llist->locks);
+ list_add_tail(&lock->head, &cfile->fid_locks->locks);
up_write(&cinode->lock_sem);
return rc;
}
@@ -1291,7 +1291,7 @@ cifs_push_mandatory_locks(struct cifs_file_info *cfile)
for (i = 0; i < 2; i++) {
cur = buf;
num = 0;
- list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) {
+ list_for_each_entry_safe(li, tmp, &cfile->fid_locks->locks, head) {
if (li->type != types[i])
continue;
cur->Pid = cpu_to_le16(li->pid);
@@ -1332,7 +1332,7 @@ hash_lockowner(fl_owner_t owner)
}
struct lock_to_push {
- struct list_head llist;
+ struct list_head head;
__u64 offset;
__u64 length;
__u32 pid;
@@ -1377,7 +1377,7 @@ cifs_push_posix_locks(struct cifs_file_info *cfile)
rc = -ENOMEM;
goto err_out;
}
- list_add_tail(&lck->llist, &locks_to_send);
+ list_add_tail(&lck->head, &locks_to_send);
}
el = locks_to_send.next;
@@ -1396,7 +1396,7 @@ cifs_push_posix_locks(struct cifs_file_info *cfile)
type = CIFS_RDLCK;
else
type = CIFS_WRLCK;
- lck = list_entry(el, struct lock_to_push, llist);
+ lck = list_entry(el, struct lock_to_push, head);
lck->pid = hash_lockowner(flock->fl_owner);
lck->netfid = cfile->fid.netfid;
lck->length = length;
@@ -1405,7 +1405,7 @@ cifs_push_posix_locks(struct cifs_file_info *cfile)
}
spin_unlock(&flctx->flc_lock);
- list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) {
+ list_for_each_entry_safe(lck, tmp, &locks_to_send, head) {
int stored_rc;
stored_rc = CIFSSMBPosixLock(xid, tcon, lck->netfid, lck->pid,
@@ -1413,7 +1413,7 @@ cifs_push_posix_locks(struct cifs_file_info *cfile)
lck->type, 0);
if (stored_rc)
rc = stored_rc;
- list_del(&lck->llist);
+ list_del(&lck->head);
kfree(lck);
}
@@ -1421,8 +1421,8 @@ cifs_push_posix_locks(struct cifs_file_info *cfile)
free_xid(xid);
return rc;
err_out:
- list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) {
- list_del(&lck->llist);
+ list_for_each_entry_safe(lck, tmp, &locks_to_send, head) {
+ list_del(&lck->head);
kfree(lck);
}
goto out;
@@ -1583,9 +1583,9 @@ void
cifs_free_llist(struct list_head *llist)
{
struct cifs_lock_info *li, *tmp;
- list_for_each_entry_safe(li, tmp, llist, llist) {
+ list_for_each_entry_safe(li, tmp, llist, head) {
cifs_del_lock_waiters(li);
- list_del(&li->llist);
+ list_del(&li->head);
kfree(li);
}
}
@@ -1632,7 +1632,7 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
for (i = 0; i < 2; i++) {
cur = buf;
num = 0;
- list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) {
+ list_for_each_entry_safe(li, tmp, &cfile->fid_locks->locks, head) {
if (flock->fl_start > li->offset ||
(flock->fl_start + length) <
(li->offset + li->length))
@@ -1646,7 +1646,7 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* We can cache brlock requests - simply remove
* a lock from the file's list.
*/
- list_del(&li->llist);
+ list_del(&li->head);
cifs_del_lock_waiters(li);
kfree(li);
continue;
@@ -1661,7 +1661,7 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* the file's list if the unlock range request fails on
* the server.
*/
- list_move(&li->llist, &tmp_llist);
+ list_move(&li->head, &tmp_llist);
if (++num == max_num) {
stored_rc = cifs_lockv(xid, tcon,
cfile->fid.netfid,
@@ -1673,7 +1673,7 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* list to the head of the file's list.
*/
cifs_move_llist(&tmp_llist,
- &cfile->llist->locks);
+ &cfile->fid_locks->locks);
rc = stored_rc;
} else
/*
@@ -1691,7 +1691,7 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
types[i], num, 0, buf);
if (stored_rc) {
cifs_move_llist(&tmp_llist,
- &cfile->llist->locks);
+ &cfile->fid_locks->locks);
rc = stored_rc;
} else
cifs_free_llist(&tmp_llist);
@@ -2006,11 +2006,11 @@ struct cifs_file_info *find_readable_file(struct cifs_inode_info *cinode,
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
fsuid_only = false;
- spin_lock(&cinode->open_file_lock);
+ spin_lock(&cinode->open_files_lock);
/* we could simply get the first_list_entry since write-only entries
are always at the end of the list but since the first entry might
have a close pending, we go through the whole list */
- list_for_each_entry(open_file, &cinode->openFileList, flist) {
+ list_for_each_entry(open_file, &cinode->open_files_list, fid_head) {
if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
continue;
if (OPEN_FMODE(open_file->f_flags) & FMODE_READ) {
@@ -2018,7 +2018,7 @@ struct cifs_file_info *find_readable_file(struct cifs_inode_info *cinode,
/* found a good file */
/* lock it so it will not be closed on us */
cifs_file_info_get(open_file);
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
return open_file;
} /* else might as well continue, and look for
another, or simply have the caller reopen it
@@ -2026,7 +2026,7 @@ struct cifs_file_info *find_readable_file(struct cifs_inode_info *cinode,
} else /* write only file */
break; /* write only files are last so must be done */
}
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
return NULL;
}
@@ -2062,13 +2062,13 @@ cifs_get_writable_file(struct cifs_inode_info *cinode, int flags,
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
fsuid_only = false;
- spin_lock(&cinode->open_file_lock);
+ spin_lock(&cinode->open_files_lock);
refind_writable:
if (refind > MAX_REOPEN_ATT) {
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
return rc;
}
- list_for_each_entry(open_file, &cinode->openFileList, flist) {
+ list_for_each_entry(open_file, &cinode->open_files_list, fid_head) {
if (!any_available && open_file->pid != current->tgid)
continue;
if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
@@ -2079,7 +2079,7 @@ cifs_get_writable_file(struct cifs_inode_info *cinode, int flags,
if (!open_file->invalidHandle) {
/* found a good writable file */
cifs_file_info_get(open_file);
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
*ret_file = open_file;
return 0;
} else {
@@ -2099,7 +2099,7 @@ cifs_get_writable_file(struct cifs_inode_info *cinode, int flags,
cifs_file_info_get(inv_file);
}
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
if (inv_file) {
rc = cifs_reopen_file(inv_file, false);
@@ -2108,13 +2108,13 @@ cifs_get_writable_file(struct cifs_inode_info *cinode, int flags,
return 0;
}
- spin_lock(&cinode->open_file_lock);
- list_move_tail(&inv_file->flist, &cinode->openFileList);
- spin_unlock(&cinode->open_file_lock);
+ spin_lock(&cinode->open_files_lock);
+ list_move_tail(&inv_file->fid_head, &cinode->open_files_list);
+ spin_unlock(&cinode->open_files_lock);
cifs_file_info_put(inv_file);
++refind;
inv_file = NULL;
- spin_lock(&cinode->open_file_lock);
+ spin_lock(&cinode->open_files_lock);
goto refind_writable;
}
@@ -2144,12 +2144,12 @@ cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
*ret_file = NULL;
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) {
struct cifs_inode_info *cinode;
const char *full_path = build_path_from_dentry(cfile->dentry, page);
if (IS_ERR(full_path)) {
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
return PTR_ERR(full_path);
}
@@ -2157,12 +2157,12 @@ cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
continue;
cinode = CIFS_I(d_inode(cfile->dentry));
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
return cifs_get_writable_file(cinode, flags, ret_file);
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
return -ENOENT;
}
@@ -2176,12 +2176,12 @@ cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
*ret_file = NULL;
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) {
struct cifs_inode_info *cinode;
const char *full_path = build_path_from_dentry(cfile->dentry, page);
if (IS_ERR(full_path)) {
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
return PTR_ERR(full_path);
}
@@ -2189,13 +2189,13 @@ cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
continue;
cinode = CIFS_I(d_inode(cfile->dentry));
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
*ret_file = find_readable_file(cinode, 0);
return *ret_file ? 0 : -ENOENT;
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
free_dentry_path(page);
return -ENOENT;
}
@@ -2956,7 +2956,7 @@ cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
/* If the write was successfully sent, we are done */
if (!rc) {
- list_add_tail(&wdata->list, wdata_list);
+ list_add_tail(&wdata->head, wdata_list);
return 0;
}
@@ -3126,7 +3126,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
break;
}
- list_add_tail(&wdata->list, wdata_list);
+ list_add_tail(&wdata->head, wdata_list);
offset += cur_len;
len -= cur_len;
} while (len > 0);
@@ -3148,7 +3148,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
mutex_lock(&ctx->aio_mutex);
- if (list_empty(&ctx->list)) {
+ if (list_empty(&ctx->rw_list)) {
mutex_unlock(&ctx->aio_mutex);
return;
}
@@ -3160,7 +3160,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
* for any more replies.
*/
restart_loop:
- list_for_each_entry_safe(wdata, tmp, &ctx->list, list) {
+ list_for_each_entry_safe(wdata, tmp, &ctx->rw_list, head) {
if (!rc) {
if (!try_wait_for_completion(&wdata->done)) {
mutex_unlock(&ctx->aio_mutex);
@@ -3178,7 +3178,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
struct iov_iter tmp_from = ctx->iter;
INIT_LIST_HEAD(&tmp_list);
- list_del_init(&wdata->list);
+ list_del_init(&wdata->head);
if (ctx->direct_io)
rc = cifs_resend_wdata(
@@ -3196,11 +3196,11 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
cifs_uncached_writedata_release);
}
- list_splice(&tmp_list, &ctx->list);
+ list_splice(&tmp_list, &ctx->rw_list);
goto restart_loop;
}
}
- list_del_init(&wdata->list);
+ list_del_init(&wdata->head);
kref_put(&wdata->refcount, cifs_uncached_writedata_release);
}
@@ -3278,7 +3278,7 @@ static ssize_t __cifs_writev(
mutex_lock(&ctx->aio_mutex);
rc = cifs_write_from_iter(iocb->ki_pos, ctx->len, &saved_from,
- cfile, cifs_sb, &ctx->list, ctx);
+ cfile, cifs_sb, &ctx->rw_list, ctx);
/*
* If at least one write was successfully sent, then discard any rc
@@ -3286,7 +3286,7 @@ static ssize_t __cifs_writev(
* we'll end up returning whatever was written. If it fails, then
* we'll get a new rc value from that.
*/
- if (!list_empty(&ctx->list))
+ if (!list_empty(&ctx->rw_list))
rc = 0;
mutex_unlock(&ctx->aio_mutex);
@@ -3426,7 +3426,7 @@ cifs_readdata_direct_alloc(struct page **pages, work_func_t complete)
if (rdata != NULL) {
rdata->pages = pages;
kref_init(&rdata->refcount);
- INIT_LIST_HEAD(&rdata->list);
+ INIT_LIST_HEAD(&rdata->head);
init_completion(&rdata->done);
INIT_WORK(&rdata->work, complete);
}
@@ -3690,7 +3690,7 @@ static int cifs_resend_rdata(struct cifs_readdata *rdata,
/* If the read was successfully sent, we are done */
if (!rc) {
/* Add to aio pending list */
- list_add_tail(&rdata->list, rdata_list);
+ list_add_tail(&rdata->head, rdata_list);
return 0;
}
@@ -3842,7 +3842,7 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifs_file_info *open_file
break;
}
- list_add_tail(&rdata->list, rdata_list);
+ list_add_tail(&rdata->head, rdata_list);
offset += cur_len;
len -= cur_len;
} while (len > 0);
@@ -3862,7 +3862,7 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
mutex_lock(&ctx->aio_mutex);
- if (list_empty(&ctx->list)) {
+ if (list_empty(&ctx->rw_list)) {
mutex_unlock(&ctx->aio_mutex);
return;
}
@@ -3870,7 +3870,7 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
rc = ctx->rc;
/* the loop below should proceed in the order of increasing offsets */
again:
- list_for_each_entry_safe(rdata, tmp, &ctx->list, list) {
+ list_for_each_entry_safe(rdata, tmp, &ctx->rw_list, head) {
if (!rc) {
if (!try_wait_for_completion(&rdata->done)) {
mutex_unlock(&ctx->aio_mutex);
@@ -3882,7 +3882,7 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
struct list_head tmp_list;
unsigned int got_bytes = rdata->got_bytes;
- list_del_init(&rdata->list);
+ list_del_init(&rdata->head);
INIT_LIST_HEAD(&tmp_list);
/*
@@ -3920,7 +3920,7 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
cifs_uncached_readdata_release);
}
- list_splice(&tmp_list, &ctx->list);
+ list_splice(&tmp_list, &ctx->rw_list);
goto again;
} else if (rdata->result)
@@ -3934,7 +3934,7 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
ctx->total_len += rdata->got_bytes;
}
- list_del_init(&rdata->list);
+ list_del_init(&rdata->head);
kref_put(&rdata->refcount, cifs_uncached_readdata_release);
}
@@ -4020,10 +4020,10 @@ static ssize_t __cifs_readv(
/* grab a lock here due to read response handlers can access ctx */
mutex_lock(&ctx->aio_mutex);
- rc = cifs_send_async_read(offset, len, cfile, cifs_sb, &ctx->list, ctx);
+ rc = cifs_send_async_read(offset, len, cfile, cifs_sb, &ctx->rw_list, ctx);
/* if at least one read request send succeeded, then reset rc */
- if (!list_empty(&ctx->list))
+ if (!list_empty(&ctx->rw_list))
rc = 0;
mutex_unlock(&ctx->aio_mutex);
@@ -4639,14 +4639,14 @@ static int is_inode_writable(struct cifs_inode_info *cinode)
{
struct cifs_file_info *open_file;
- spin_lock(&cinode->open_file_lock);
- list_for_each_entry(open_file, &cinode->openFileList, flist) {
+ spin_lock(&cinode->open_files_lock);
+ list_for_each_entry(open_file, &cinode->open_files_list, fid_head) {
if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
return 1;
}
}
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
return 0;
}
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 326c2b4cc9e2..55f4e15f876a 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -230,8 +230,8 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
struct cifs_server_info *server_it = NULL;
spin_lock(&g_servers_lock);
- list_for_each_entry(server_it, &g_servers_list, server_head) {
- list_for_each_entry(ses_it, &server_it->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(server_it, &g_servers_list, head) {
+ list_for_each_entry(ses_it, &server_it->ses_list, head) {
if (ses_it->Suid == out.session_id) {
ses = ses_it;
/*
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index c37ad2bb3ac4..706e47893345 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -71,7 +71,7 @@ sesInfoAlloc(void)
atomic_inc(&g_ses_alloc_count);
ret_buf->status = SES_STATUS_NEW;
++ret_buf->ses_count;
- INIT_LIST_HEAD(&ret_buf->smb_ses_list);
+ INIT_LIST_HEAD(&ret_buf->head);
INIT_LIST_HEAD(&ret_buf->tcon_list);
mutex_init(&ret_buf->session_mutex);
spin_lock_init(&ret_buf->iface_lock);
@@ -100,8 +100,7 @@ sesInfoFree(struct cifs_ses *buf_to_free)
kfree(buf_to_free->domainName);
kfree_sensitive(buf_to_free->auth_key.response);
spin_lock(&buf_to_free->iface_lock);
- list_for_each_entry_safe(iface, niface, &buf_to_free->iface_list,
- iface_head)
+ list_for_each_entry_safe(iface, niface, &buf_to_free->iface_list, head)
kref_put(&iface->refcount, release_iface);
spin_unlock(&buf_to_free->iface_lock);
kfree_sensitive(buf_to_free);
@@ -126,9 +125,9 @@ tconInfoAlloc(void)
atomic_inc(&g_tcon_alloc_count);
ret_buf->status = TCON_STATUS_NEW;
++ret_buf->tc_count;
- INIT_LIST_HEAD(&ret_buf->openFileList);
- INIT_LIST_HEAD(&ret_buf->tcon_list);
- spin_lock_init(&ret_buf->open_file_lock);
+ INIT_LIST_HEAD(&ret_buf->open_files_list);
+ INIT_LIST_HEAD(&ret_buf->head);
+ spin_lock_init(&ret_buf->open_files_lock);
mutex_init(&ret_buf->crfid.fid_mutex);
spin_lock_init(&ret_buf->stat_lock);
atomic_set(&ret_buf->num_local_opens, 0);
@@ -466,14 +465,14 @@ is_valid_oplock_break(char *buffer, struct cifs_server_info *srv)
/* look up tcon based on tid & uid */
spin_lock(&g_servers_lock);
- list_for_each_entry(ses, &srv->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &srv->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (tcon->tid != buf->Tid)
continue;
cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks);
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(netfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(netfile, &tcon->open_files_list, tcon_head) {
if (pSMB->Fid != netfile->fid.netfid)
continue;
@@ -488,11 +487,11 @@ is_valid_oplock_break(char *buffer, struct cifs_server_info *srv)
netfile->oplock_break_cancelled = false;
cifs_queue_oplock_break(netfile);
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
spin_unlock(&g_servers_lock);
return true;
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "No matching file for oplock break\n");
return true;
@@ -598,14 +597,14 @@ void cifs_put_writer(struct cifs_inode_info *cinode)
* This function is called from the demultiplex thread when it
* receives an oplock break for @cfile.
*
- * Assumes the tcon->open_file_lock is held.
+ * Assumes the tcon->open_files_lock is held.
* Assumes cfile->file_info_lock is NOT held.
*/
void cifs_queue_oplock_break(struct cifs_file_info *cfile)
{
/*
* Bump the handle refcount now while we hold the
- * open_file_lock to enforce the validity of it for the oplock
+ * open_files_lock to enforce the validity of it for the oplock
* break handler. The matching put is done at the end of the
* handler.
*/
@@ -638,9 +637,9 @@ backup_cred(struct cifs_sb_info *cifs_sb)
void
cifs_del_pending_open(struct cifs_pending_open *open)
{
- spin_lock(&tlink_tcon(open->tlink)->open_file_lock);
- list_del(&open->olist);
- spin_unlock(&tlink_tcon(open->tlink)->open_file_lock);
+ spin_lock(&tlink_tcon(open->tlink)->open_files_lock);
+ list_del(&open->head);
+ spin_unlock(&tlink_tcon(open->tlink)->open_files_lock);
}
void
@@ -651,16 +650,16 @@ cifs_add_pending_open_locked(struct cifs_fid *fid, struct tcon_link *tlink,
open->oplock = CIFS_OPLOCK_NO_CHANGE;
open->tlink = tlink;
fid->pending_open = open;
- list_add_tail(&open->olist, &tlink_tcon(tlink)->pending_opens);
+ list_add_tail(&open->head, &tlink_tcon(tlink)->pending_opens);
}
void
cifs_add_pending_open(struct cifs_fid *fid, struct tcon_link *tlink,
struct cifs_pending_open *open)
{
- spin_lock(&tlink_tcon(tlink)->open_file_lock);
+ spin_lock(&tlink_tcon(tlink)->open_files_lock);
cifs_add_pending_open_locked(fid, tlink, open);
- spin_unlock(&tlink_tcon(open->tlink)->open_file_lock);
+ spin_unlock(&tlink_tcon(open->tlink)->open_files_lock);
}
/*
@@ -673,7 +672,7 @@ cifs_is_deferred_close(struct cifs_file_info *cfile, struct cifs_deferred_close
{
struct cifs_deferred_close *dclose;
- list_for_each_entry(dclose, &CIFS_I(d_inode(cfile->dentry))->deferred_closes, dlist) {
+ list_for_each_entry(dclose, &CIFS_I(d_inode(cfile->dentry))->deferred_closes, head) {
if ((dclose->netfid == cfile->fid.netfid) &&
(dclose->persistent_fid == cfile->fid.persistent_fid) &&
(dclose->volatile_fid == cfile->fid.volatile_fid)) {
@@ -703,7 +702,7 @@ cifs_add_deferred_close(struct cifs_file_info *cfile, struct cifs_deferred_close
dclose->netfid = cfile->fid.netfid;
dclose->persistent_fid = cfile->fid.persistent_fid;
dclose->volatile_fid = cfile->fid.volatile_fid;
- list_add_tail(&dclose->dlist, &CIFS_I(d_inode(cfile->dentry))->deferred_closes);
+ list_add_tail(&dclose->head, &CIFS_I(d_inode(cfile->dentry))->deferred_closes);
}
/*
@@ -718,7 +717,7 @@ cifs_del_deferred_close(struct cifs_file_info *cfile)
is_deferred = cifs_is_deferred_close(cfile, &dclose);
if (!is_deferred)
return;
- list_del(&dclose->dlist);
+ list_del(&dclose->head);
kfree(dclose);
}
@@ -733,8 +732,8 @@ cifs_close_deferred_file(struct cifs_inode_info *cinode)
return;
INIT_LIST_HEAD(&file_head);
- spin_lock(&cinode->open_file_lock);
- list_for_each_entry(cfile, &cinode->openFileList, flist) {
+ spin_lock(&cinode->open_files_lock);
+ list_for_each_entry(cfile, &cinode->open_files_list, fid_head) {
if (delayed_work_pending(&cfile->deferred)) {
if (cancel_delayed_work(&cfile->deferred)) {
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
@@ -745,7 +744,7 @@ cifs_close_deferred_file(struct cifs_inode_info *cinode)
}
}
}
- spin_unlock(&cinode->open_file_lock);
+ spin_unlock(&cinode->open_files_lock);
list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
_cifs_file_info_put(tmp_list->cfile, true, false);
@@ -762,8 +761,8 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon)
struct list_head file_head;
INIT_LIST_HEAD(&file_head);
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) {
if (delayed_work_pending(&cfile->deferred)) {
if (cancel_delayed_work(&cfile->deferred)) {
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
@@ -774,7 +773,7 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon)
}
}
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
_cifs_file_info_put(tmp_list->cfile, true, false);
@@ -793,8 +792,8 @@ cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
INIT_LIST_HEAD(&file_head);
page = alloc_dentry_path();
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list, fid_head) {
full_path = build_path_from_dentry(cfile->dentry, page);
if (strstr(full_path, path)) {
if (delayed_work_pending(&cfile->deferred)) {
@@ -808,7 +807,7 @@ cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
}
}
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
_cifs_file_info_put(tmp_list->cfile, true, false);
@@ -939,7 +938,7 @@ cifs_aio_ctx_alloc(void)
if (!ctx)
return NULL;
- INIT_LIST_HEAD(&ctx->list);
+ INIT_LIST_HEAD(&ctx->rw_list);
mutex_init(&ctx->aio_mutex);
init_completion(&ctx->done);
kref_init(&ctx->refcount);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index dbdabb83ea03..a64490c88bbd 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -846,7 +846,7 @@ static bool emit_cached_dirents(struct cached_dirents *cde,
struct cached_dirent *dirent;
int rc;
- list_for_each_entry(dirent, &cde->entries, entry) {
+ list_for_each_entry(dirent, &cde->entries, head) {
if (ctx->pos >= dirent->pos)
continue;
ctx->pos = dirent->pos;
@@ -914,7 +914,7 @@ static void add_cached_dirent(struct cached_dirents *cde,
memcpy(&de->fattr, fattr, sizeof(struct cifs_fattr));
- list_add_tail(&de->entry, &cde->entries);
+ list_add_tail(&de->head, &cde->entries);
}
static bool cifs_dir_emit(struct dir_context *ctx,
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index dd34b73eea97..57061394032e 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -199,7 +199,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
*/
spin_lock(&ses->iface_lock);
iface = list_first_entry(&ses->iface_list, struct cifs_server_iface,
- iface_head);
+ head);
spin_unlock(&ses->iface_lock);
while (left > 0) {
@@ -218,7 +218,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
}
list_for_each_entry_safe_from(iface, niface, &ses->iface_list,
- iface_head) {
+ head) {
/* skip ifaces that are unusable */
if (!iface->is_active ||
(is_ses_using_iface(ses, iface) &&
@@ -285,7 +285,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct cifs_server_info *server)
spin_lock(&ses->iface_lock);
/* then look for a new one */
- list_for_each_entry(iface, &ses->iface_list, iface_head) {
+ list_for_each_entry(iface, &ses->iface_list, head) {
if (!iface->is_active ||
(is_ses_using_iface(ses, iface) &&
!iface->rss_capable)) {
@@ -294,7 +294,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct cifs_server_info *server)
kref_get(&iface->refcount);
}
- if (!list_entry_is_head(iface, &ses->iface_list, iface_head)) {
+ if (!list_entry_is_head(iface, &ses->iface_list, head)) {
rc = 1;
iface = NULL;
cifs_dbg(FYI, "unable to find a suitable iface\n");
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 9d63099ad26a..9a7b85e79cc8 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -93,7 +93,7 @@ cifs_find_mid(struct cifs_server_info *server, char *buffer)
struct mid_q_entry *mid;
spin_lock(&g_mid_lock);
- list_for_each_entry(mid, &server->pending_mid_q, qhead) {
+ list_for_each_entry(mid, &server->pending_mid_q, head) {
if (compare_mid(mid->mid, buf) &&
mid->mid_state == MID_REQUEST_SUBMITTED &&
le16_to_cpu(mid->command) == buf->Command) {
@@ -195,7 +195,7 @@ cifs_get_next_mid(struct cifs_server_info *server)
cur_mid++;
num_mids = 0;
- list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
+ list_for_each_entry(mid_entry, &server->pending_mid_q, head) {
++num_mids;
if (mid_entry->mid == cur_mid &&
mid_entry->mid_state == MID_REQUEST_SUBMITTED) {
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index 79b28a52f67e..31c1bad2e713 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -133,7 +133,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
cur = buf;
cifs_down_write(&cinode->lock_sem);
- list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) {
+ list_for_each_entry_safe(li, tmp, &cfile->fid_locks->locks, head) {
if (flock->fl_start > li->offset ||
(flock->fl_start + length) <
(li->offset + li->length))
@@ -150,7 +150,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* We can cache brlock requests - simply remove a lock
* from the file's list.
*/
- list_del(&li->llist);
+ list_del(&li->head);
cifs_del_lock_waiters(li);
kfree(li);
continue;
@@ -162,7 +162,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* We need to save a lock here to let us add it again to the
* file's list if the unlock range request fails on the server.
*/
- list_move(&li->llist, &tmp_llist);
+ list_move(&li->head, &tmp_llist);
if (++num == max_num) {
stored_rc = smb2_lockv(xid, tcon,
cfile->fid.persistent_fid,
@@ -175,7 +175,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
* the file's list.
*/
cifs_move_llist(&tmp_llist,
- &cfile->llist->locks);
+ &cfile->fid_locks->locks);
rc = stored_rc;
} else
/*
@@ -193,7 +193,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,
cfile->fid.volatile_fid, current->tgid,
num, buf);
if (stored_rc) {
- cifs_move_llist(&tmp_llist, &cfile->llist->locks);
+ cifs_move_llist(&tmp_llist, &cfile->fid_locks->locks);
rc = stored_rc;
} else
cifs_free_llist(&tmp_llist);
@@ -215,7 +215,7 @@ smb2_push_mand_fdlocks(struct cifs_fid_locks *fdlocks, const unsigned int xid,
struct smb2_lock_element *cur = buf;
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
- list_for_each_entry(li, &fdlocks->locks, llist) {
+ list_for_each_entry(li, &fdlocks->locks, head) {
cur->Length = cpu_to_le64(li->length);
cur->Offset = cpu_to_le64(li->offset);
cur->Flags = cpu_to_le32(li->type |
@@ -275,7 +275,7 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile)
return -ENOMEM;
}
- list_for_each_entry(fdlocks, &cinode->llist, llist) {
+ list_for_each_entry(fdlocks, &cinode->fid_locks_list, head) {
stored_rc = smb2_push_mand_fdlocks(fdlocks, xid, buf, max_num);
if (stored_rc)
rc = stored_rc;
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 587362124842..6ce44c16adb1 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -154,7 +154,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)
/* decrypt frame now that it is completely read in */
spin_lock(&g_servers_lock);
- list_for_each_entry(iter, &server->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(iter, &server->ses_list, head) {
if (iter->Suid == le64_to_cpu(thdr->SessionId)) {
ses = iter;
break;
@@ -549,7 +549,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
lease_state = le32_to_cpu(rsp->NewLeaseState);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) {
cinode = CIFS_I(d_inode(cfile->dentry));
if (memcmp(cinode->lease_key, rsp->LeaseKey,
@@ -587,7 +587,7 @@ smb2_tcon_find_pending_open_lease(struct cifs_tcon *tcon,
struct cifs_pending_open *open;
struct cifs_pending_open *found = NULL;
- list_for_each_entry(open, &tcon->pending_opens, olist) {
+ list_for_each_entry(open, &tcon->pending_opens, head) {
if (memcmp(open->lease_key, rsp->LeaseKey,
SMB2_LEASE_KEY_SIZE))
continue;
@@ -619,14 +619,14 @@ smb2_is_valid_lease_break(char *buffer)
/* look up tcon based on tid & uid */
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
- spin_lock(&tcon->open_file_lock);
+ list_for_each_entry(server, &g_servers_list, head) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
+ spin_lock(&tcon->open_files_lock);
cifs_stats_inc(
&tcon->stats.cifs_stats.num_oplock_brks);
if (smb2_tcon_has_lease(tcon, rsp)) {
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
spin_unlock(&g_servers_lock);
return true;
}
@@ -639,14 +639,14 @@ smb2_is_valid_lease_break(char *buffer)
tlink = cifs_get_tlink(open->tlink);
memcpy(lease_key, open->lease_key,
SMB2_LEASE_KEY_SIZE);
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
spin_unlock(&g_servers_lock);
smb2_queue_pending_open_break(tlink,
lease_key,
rsp->NewLeaseState);
return true;
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
if (tcon->crfid.is_valid &&
!memcmp(rsp->LeaseKey,
@@ -700,11 +700,11 @@ smb2_is_valid_oplock_break(char *buffer, struct cifs_server_info *server)
/* look up tcon based on tid & uid */
spin_lock(&g_servers_lock);
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
- spin_lock(&tcon->open_file_lock);
- list_for_each_entry(cfile, &tcon->openFileList, tlist) {
+ spin_lock(&tcon->open_files_lock);
+ list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) {
if (rsp->PersistentFid !=
cfile->fid.persistent_fid ||
rsp->VolatileFid !=
@@ -732,11 +732,11 @@ smb2_is_valid_oplock_break(char *buffer, struct cifs_server_info *server)
cifs_queue_oplock_break(cfile);
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
spin_unlock(&g_servers_lock);
return true;
}
- spin_unlock(&tcon->open_file_lock);
+ spin_unlock(&tcon->open_files_lock);
}
}
spin_unlock(&g_servers_lock);
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 9d2064cf44d8..83856024fb79 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -347,13 +347,13 @@ __smb2_find_mid(struct cifs_server_info *server, char *buf, bool dequeue)
}
spin_lock(&g_mid_lock);
- list_for_each_entry(mid, &server->pending_mid_q, qhead) {
+ list_for_each_entry(mid, &server->pending_mid_q, head) {
if ((mid->mid == wire_mid) &&
(mid->mid_state == MID_REQUEST_SUBMITTED) &&
(mid->command == shdr->Command)) {
kref_get(&mid->refcount);
if (dequeue) {
- list_del_init(&mid->qhead);
+ list_del_init(&mid->head);
mid->mid_flags |= MID_DELETED;
}
spin_unlock(&g_mid_lock);
@@ -536,7 +536,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
* when the last user calls a kref_put on it
*/
list_for_each_entry_safe(iface, niface, &ses->iface_list,
- iface_head) {
+ head) {
iface->is_active = 0;
kref_put(&iface->refcount, release_iface);
}
@@ -595,8 +595,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
*/
spin_lock(&ses->iface_lock);
iface = niface = NULL;
- list_for_each_entry_safe(iface, niface, &ses->iface_list,
- iface_head) {
+ list_for_each_entry_safe(iface, niface, &ses->iface_list, head) {
ret = iface_cmp(iface, &tmp_iface);
if (!ret) {
/* just get a ref so that it doesn't get picked/freed */
@@ -631,11 +630,11 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
le32_to_cpu(p->Capability));
spin_lock(&ses->iface_lock);
- if (!list_entry_is_head(iface, &ses->iface_list, iface_head)) {
- list_add_tail(&info->iface_head, &iface->iface_head);
+ if (!list_entry_is_head(iface, &ses->iface_list, head)) {
+ list_add_tail(&info->head, &iface->head);
kref_put(&iface->refcount, release_iface);
} else
- list_add_tail(&info->iface_head, &ses->iface_list);
+ list_add_tail(&info->head, &ses->iface_list);
spin_unlock(&ses->iface_lock);
ses->iface_count++;
@@ -730,8 +729,8 @@ smb2_close_cached_fid(struct kref *ref)
* Delete all cached dirent names
*/
mutex_lock(&cfid->dirents.de_mutex);
- list_for_each_entry_safe(dirent, q, &cfid->dirents.entries, entry) {
- list_del(&dirent->entry);
+ list_for_each_entry_safe(dirent, q, &cfid->dirents.entries, head) {
+ list_del(&dirent->head);
kfree(dirent->name);
kfree(dirent);
}
@@ -2582,8 +2581,8 @@ smb2_is_network_name_deleted(char *buf, struct cifs_server_info *server)
return;
spin_lock(&g_servers_lock);
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (tcon->tid == le32_to_cpu(shdr->Id.SyncId.TreeId)) {
tcon->need_reconnect = true;
spin_unlock(&g_servers_lock);
@@ -2942,7 +2941,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
spin_lock(&g_servers_lock);
tcon = list_first_entry_or_null(&ses->tcon_list,
struct cifs_tcon,
- tcon_list);
+ head);
if (tcon)
tcon->tc_count++;
spin_unlock(&g_servers_lock);
@@ -4558,8 +4557,8 @@ smb2_get_enc_key(struct cifs_server_info *server, __u64 ses_id, int enc, u8 *key
u8 *ses_enc_key;
spin_lock(&g_servers_lock);
- list_for_each_entry(server, &g_servers_list, server_head) {
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(server, &g_servers_list, head) {
+ list_for_each_entry(ses, &server->ses_list, head) {
if (ses->Suid == ses_id) {
ses_enc_key = enc ? ses->smb3encryptionkey :
ses->smb3decryptionkey;
@@ -5088,7 +5087,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
} else {
mid->mid_state = MID_REQUEST_SUBMITTED;
mid->mid_flags &= ~(MID_DELETED);
- list_add_tail(&mid->qhead,
+ list_add_tail(&mid->head,
&dw->server->pending_mid_q);
spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index c514d405f9d0..a5e8c1ec3f92 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3804,11 +3804,11 @@ void smb2_reconnect_server(struct work_struct *work)
cifs_dbg(FYI, "Reconnecting tcons and channels\n");
spin_lock(&g_servers_lock);
- list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(ses, &pserver->ses_list, head) {
tcon_selected = false;
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (tcon->need_reconnect || tcon->need_reopen_files) {
tcon->tc_count++;
list_add_tail(&tcon->rlist, &tmp_list);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 5ac2dbffb939..2fa4f6d9fe7e 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -88,8 +88,8 @@ int smb2_get_sign_key(__u64 ses_id, struct cifs_server_info *server, u8 *key)
spin_lock(&g_servers_lock);
- list_for_each_entry(it, &g_servers_list, server_head) {
- list_for_each_entry(ses, &it->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(it, &g_servers_list, head) {
+ list_for_each_entry(ses, &it->ses_list, head) {
if (ses->Suid == ses_id)
goto found;
}
@@ -142,7 +142,7 @@ smb2_find_smb_ses_unlocked(struct cifs_server_info *server, __u64 ses_id)
{
struct cifs_ses *ses;
- list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+ list_for_each_entry(ses, &server->ses_list, head) {
if (ses->Suid != ses_id)
continue;
++ses->ses_count;
@@ -169,7 +169,7 @@ smb2_find_smb_sess_tcon_unlocked(struct cifs_ses *ses, __u32 tid)
{
struct cifs_tcon *tcon;
- list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+ list_for_each_entry(tcon, &ses->tcon_list, head) {
if (tcon->tid != tid)
continue;
++tcon->tc_count;
@@ -802,7 +802,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
if (*mid == NULL)
return -ENOMEM;
spin_lock(&g_mid_lock);
- list_add_tail(&(*mid)->qhead, &server->pending_mid_q);
+ list_add_tail(&(*mid)->head, &server->pending_mid_q);
spin_unlock(&g_mid_lock);
return 0;
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 74ddf1201ab1..be2da4444731 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -169,7 +169,7 @@ cifs_delete_mid(struct mid_q_entry *mid)
{
spin_lock(&g_mid_lock);
if (!(mid->mid_flags & MID_DELETED)) {
- list_del_init(&mid->qhead);
+ list_del_init(&mid->head);
mid->mid_flags |= MID_DELETED;
}
spin_unlock(&g_mid_lock);
@@ -749,7 +749,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
if (*ppmidQ == NULL)
return -ENOMEM;
spin_lock(&g_mid_lock);
- list_add_tail(&(*ppmidQ)->qhead, &ses->server->pending_mid_q);
+ list_add_tail(&(*ppmidQ)->head, &ses->server->pending_mid_q);
spin_unlock(&g_mid_lock);
return 0;
}
@@ -850,7 +850,7 @@ cifs_call_async(struct cifs_server_info *server, struct smb_rqst *rqst,
/* put it on the pending_mid_q */
spin_lock(&g_mid_lock);
- list_add_tail(&mid->qhead, &server->pending_mid_q);
+ list_add_tail(&mid->head, &server->pending_mid_q);
spin_unlock(&g_mid_lock);
/*
@@ -928,7 +928,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct cifs_server_info *server)
break;
default:
if (!(mid->mid_flags & MID_DELETED)) {
- list_del_init(&mid->qhead);
+ list_del_init(&mid->head);
mid->mid_flags |= MID_DELETED;
}
cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RFC PATCH 14/14] cifs: rename more list_heads, remove redundant prefixes
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
` (9 preceding siblings ...)
2022-07-24 15:11 ` [RFC PATCH 12/14] cifs: rename list_head fields Enzo Matsumiya
@ 2022-07-24 15:11 ` Enzo Matsumiya
10 siblings, 0 replies; 13+ messages in thread
From: Enzo Matsumiya @ 2022-07-24 15:11 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore
Rename more list_heads to better represent whether they're a list entry
or a "real" list.
Remove smb_rqst "rq_" field prefixes.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifsencrypt.c | 30 +++----
fs/cifs/cifsglob.h | 14 +--
fs/cifs/cifssmb.c | 36 ++++----
fs/cifs/connect.c | 8 +-
fs/cifs/dfs_cache.c | 158 ++++++++++++++++----------------
fs/cifs/dfs_cache.h | 40 ++++-----
fs/cifs/misc.c | 10 +--
fs/cifs/smb1ops.c | 2 +-
fs/cifs/smb2inode.c | 52 +++++------
fs/cifs/smb2ops.c | 184 ++++++++++++++++++-------------------
fs/cifs/smb2pdu.c | 194 ++++++++++++++++++++--------------------
fs/cifs/smb2transport.c | 28 +++---
fs/cifs/smbdirect.c | 18 ++--
fs/cifs/transport.c | 64 ++++++-------
14 files changed, 419 insertions(+), 419 deletions(-)
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 8a2b882de76d..f653d42ff936 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -30,8 +30,8 @@ int __cifs_calc_signature(struct smb_rqst *rqst,
{
int i;
int rc;
- struct kvec *iov = rqst->rq_iov;
- int n_vec = rqst->rq_nvec;
+ struct kvec *iov = rqst->iov;
+ int n_vec = rqst->nvec;
int is_smb2 = server->vals->header_preamble_size == 0;
/* iov[0] is actual data and not the rfc1002 length for SMB2+ */
@@ -63,23 +63,23 @@ int __cifs_calc_signature(struct smb_rqst *rqst,
}
/* now hash over the rq_pages array */
- for (i = 0; i < rqst->rq_npages; i++) {
+ for (i = 0; i < rqst->npages; i++) {
void *kaddr;
unsigned int len, offset;
rqst_page_get_length(rqst, i, &len, &offset);
- kaddr = (char *) kmap(rqst->rq_pages[i]) + offset;
+ kaddr = (char *) kmap(rqst->pages[i]) + offset;
rc = crypto_shash_update(shash, kaddr, len);
if (rc) {
cifs_dbg(VFS, "%s: Could not update with payload\n",
__func__);
- kunmap(rqst->rq_pages[i]);
+ kunmap(rqst->pages[i]);
return rc;
}
- kunmap(rqst->rq_pages[i]);
+ kunmap(rqst->pages[i]);
}
rc = crypto_shash_final(shash, signature);
@@ -101,7 +101,7 @@ static int cifs_calc_signature(struct smb_rqst *rqst,
{
int rc;
- if (!rqst->rq_iov || !signature || !server)
+ if (!rqst->iov || !signature || !server)
return -EINVAL;
rc = cifs_alloc_hash("md5", &server->secmech.md5,
@@ -132,10 +132,10 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,
{
int rc = 0;
char smb_signature[20];
- struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
+ struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->iov[0].iov_base;
- if (rqst->rq_iov[0].iov_len != 4 ||
- rqst->rq_iov[0].iov_base + 4 != rqst->rq_iov[1].iov_base)
+ if (rqst->iov[0].iov_len != 4 ||
+ rqst->iov[0].iov_base + 4 != rqst->iov[1].iov_base)
return -EIO;
if ((cifs_pdu == NULL) || (server == NULL))
@@ -173,8 +173,8 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,
int cifs_sign_smbv(struct kvec *iov, int n_vec, struct cifs_server_info *server,
__u32 *pexpected_response_sequence)
{
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = n_vec };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = n_vec };
return cifs_sign_rqst(&rqst, server, pexpected_response_sequence);
}
@@ -201,10 +201,10 @@ int cifs_verify_signature(struct smb_rqst *rqst,
unsigned int rc;
char server_response_sig[8];
char what_we_think_sig_should_be[20];
- struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
+ struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->iov[0].iov_base;
- if (rqst->rq_iov[0].iov_len != 4 ||
- rqst->rq_iov[0].iov_base + 4 != rqst->rq_iov[1].iov_base)
+ if (rqst->iov[0].iov_len != 4 ||
+ rqst->iov[0].iov_base + 4 != rqst->iov[1].iov_base)
return -EIO;
if (cifs_pdu == NULL || server == NULL)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 5ead24f9965b..0bb343c86fdf 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -208,13 +208,13 @@ struct cifs_cred {
* to start at the beginning of the first page.
*/
struct smb_rqst {
- struct kvec *rq_iov; /* array of kvecs */
- unsigned int rq_nvec; /* number of kvecs in array */
- struct page **rq_pages; /* pointer to array of page ptrs */
- unsigned int rq_offset; /* the offset to the 1st page */
- unsigned int rq_npages; /* number pages in array */
- unsigned int rq_pagesz; /* page size to use */
- unsigned int rq_tailsz; /* length of last page */
+ struct kvec *iov; /* array of kvecs */
+ unsigned int nvec; /* number of kvecs in array */
+ struct page **pages; /* pointer to array of page ptrs */
+ unsigned int offset; /* the offset to the 1st page */
+ unsigned int npages; /* number pages in array */
+ unsigned int pagesz; /* page size to use */
+ unsigned int tailsz; /* length of last page */
};
struct mid_q_entry;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index dcad67d8f165..7ee1838de8f3 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -695,8 +695,8 @@ CIFSSMBEcho(struct cifs_server_info *server)
ECHO_REQ *smb;
int rc = 0;
struct kvec iov[2];
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = 2 };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = 2 };
cifs_dbg(FYI, "In echo request\n");
@@ -1564,13 +1564,13 @@ cifs_readv_callback(struct mid_q_entry *mid)
struct cifs_readdata *rdata = mid->callback_data;
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
struct cifs_server_info *server = tcon->ses->server;
- struct smb_rqst rqst = { .rq_iov = rdata->iov,
- .rq_nvec = 2,
- .rq_pages = rdata->pages,
- .rq_offset = rdata->page_offset,
- .rq_npages = rdata->nr_pages,
- .rq_pagesz = rdata->pagesz,
- .rq_tailsz = rdata->tailsz };
+ struct smb_rqst rqst = { .iov = rdata->iov,
+ .nvec = 2,
+ .pages = rdata->pages,
+ .offset = rdata->page_offset,
+ .npages = rdata->nr_pages,
+ .pagesz = rdata->pagesz,
+ .tailsz = rdata->tailsz };
struct cifs_credits credits = { .value = 1, .instance = 0 };
cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%u\n",
@@ -1620,8 +1620,8 @@ cifs_async_readv(struct cifs_readdata *rdata)
READ_REQ *smb = NULL;
int wct;
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
- struct smb_rqst rqst = { .rq_iov = rdata->iov,
- .rq_nvec = 2 };
+ struct smb_rqst rqst = { .iov = rdata->iov,
+ .nvec = 2 };
cifs_dbg(FYI, "%s: offset=%llu bytes=%u\n",
__func__, rdata->offset, rdata->bytes);
@@ -2184,13 +2184,13 @@ cifs_async_writev(struct cifs_writedata *wdata,
iov[1].iov_len = get_rfc1002_length(smb) + 1;
iov[1].iov_base = (char *)smb + 4;
- rqst.rq_iov = iov;
- rqst.rq_nvec = 2;
- rqst.rq_pages = wdata->pages;
- rqst.rq_offset = wdata->page_offset;
- rqst.rq_npages = wdata->nr_pages;
- rqst.rq_pagesz = wdata->pagesz;
- rqst.rq_tailsz = wdata->tailsz;
+ rqst.iov = iov;
+ rqst.nvec = 2;
+ rqst.pages = wdata->pages;
+ rqst.offset = wdata->page_offset;
+ rqst.npages = wdata->nr_pages;
+ rqst.pagesz = wdata->pagesz;
+ rqst.tailsz = wdata->tailsz;
cifs_dbg(FYI, "async write at %llu %u bytes\n",
wdata->offset, wdata->bytes);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 18b343389a9d..b4688c11ec06 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -551,7 +551,7 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
} while (server->status == SERVER_STATUS_NEED_RECONNECT);
if (target_hint)
- dfs_cache_noreq_update_tgthint(refpath, target_hint);
+ dfs_cache_noreq_update_tgt_hint(refpath, target_hint);
dfs_cache_free_tgts(&tl);
@@ -3580,7 +3580,7 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path,
if (!rc) {
if (cifs_is_referral_server(mnt_ctx->tcon, &ref))
set_root_ses(mnt_ctx);
- rc = dfs_cache_update_tgthint(mnt_ctx->xid, mnt_ctx->root_ses, cifs_sb->local_nls,
+ rc = dfs_cache_update_tgt_hint(mnt_ctx->xid, mnt_ctx->root_ses, cifs_sb->local_nls,
cifs_remap(cifs_sb), ref_path, tit);
}
@@ -4496,7 +4496,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
rc = ops->tree_connect(xid, tcon->ses, tree, tcon, cifs_sb->local_nls);
if (rc)
continue;
- rc = dfs_cache_noreq_update_tgthint(server->current_fullpath + 1, tit);
+ rc = dfs_cache_noreq_update_tgt_hint(server->current_fullpath + 1, tit);
if (!rc)
rc = cifs_update_super_prepath(cifs_sb, prefix);
} else {
@@ -4506,7 +4506,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
if (!rc) {
rc = -EREMOTE;
- list_replace_init(&ntl.tl_list, &tl->tl_list);
+ list_replace_init(&ntl.list, &tl->list);
} else
dfs_cache_free_tgts(&ntl);
}
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index eb5539b32d74..4d2cf8719a6b 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -32,11 +32,11 @@
struct cache_dfs_tgt {
char *name;
int path_consumed;
- struct list_head list;
+ struct list_head head;
};
struct cache_entry {
- struct hlist_node hlist;
+ struct hlist_node node;
const char *path;
int hdr_flags; /* RESP_GET_DFS_REFERRAL.ReferralHeaderFlags */
int ttl; /* DFS_REREFERRAL_V3.TimeToLive */
@@ -44,14 +44,14 @@ struct cache_entry {
int ref_flags; /* DFS_REREFERRAL_V3.ReferralEntryFlags */
struct timespec64 etime;
int path_consumed; /* RESP_GET_DFS_REFERRAL.PathConsumed */
- int numtgts;
- struct list_head tlist;
- struct cache_dfs_tgt *tgthint;
+ int num_tgts;
+ struct list_head tgt_list;
+ struct cache_dfs_tgt *tgt_hint;
};
/* List of referral server sessions per dfs mount */
struct mount_group {
- struct list_head list;
+ struct list_head head;
uuid_t id;
struct cifs_ses *sessions[CACHE_MAX_ENTRIES];
int num_sessions;
@@ -118,7 +118,7 @@ static void mount_group_release(struct kref *kref)
struct mount_group *mg = container_of(kref, struct mount_group, refcount);
mutex_lock(&mount_group_list_lock);
- list_del(&mg->list);
+ list_del(&mg->head);
mutex_unlock(&mount_group_list_lock);
__mount_group_release(mg);
}
@@ -127,7 +127,7 @@ static struct mount_group *find_mount_group_locked(const uuid_t *id)
{
struct mount_group *mg;
- list_for_each_entry(mg, &mount_group_list, list) {
+ list_for_each_entry(mg, &mount_group_list, head) {
if (uuid_equal(&mg->id, id))
return mg;
}
@@ -149,7 +149,7 @@ static struct mount_group *__get_mount_group_locked(const uuid_t *id)
uuid_copy(&mg->id, id);
mg->num_sessions = 0;
spin_lock_init(&mg->lock);
- list_add(&mg->list, &mount_group_list);
+ list_add(&mg->head, &mount_group_list);
return mg;
}
@@ -170,8 +170,8 @@ static void free_mount_group_list(void)
{
struct mount_group *mg, *tmp_mg;
- list_for_each_entry_safe(mg, tmp_mg, &mount_group_list, list) {
- list_del_init(&mg->list);
+ list_for_each_entry_safe(mg, tmp_mg, &mount_group_list, head) {
+ list_del_init(&mg->head);
__mount_group_release(mg);
}
}
@@ -229,8 +229,8 @@ static inline void free_tgts(struct cache_entry *ce)
{
struct cache_dfs_tgt *t, *n;
- list_for_each_entry_safe(t, n, &ce->tlist, list) {
- list_del(&t->list);
+ list_for_each_entry_safe(t, n, &ce->tgt_list, head) {
+ list_del(&t->head);
kfree(t->name);
kfree(t);
}
@@ -238,7 +238,7 @@ static inline void free_tgts(struct cache_entry *ce)
static inline void flush_cache_ent(struct cache_entry *ce)
{
- hlist_del_init(&ce->hlist);
+ hlist_del_init(&ce->node);
kfree(ce->path);
free_tgts(ce);
atomic_dec(&cache_count);
@@ -254,8 +254,8 @@ static void flush_cache_ents(void)
struct hlist_node *n;
struct cache_entry *ce;
- hlist_for_each_entry_safe(ce, n, l, hlist) {
- if (!hlist_unhashed(&ce->hlist))
+ hlist_for_each_entry_safe(ce, n, l, node) {
+ if (!hlist_unhashed(&ce->node))
flush_cache_ent(ce);
}
}
@@ -276,8 +276,8 @@ static int dfscache_proc_show(struct seq_file *m, void *v)
for (i = 0; i < CACHE_HTABLE_SIZE; i++) {
struct hlist_head *l = &cache_htable[i];
- hlist_for_each_entry(ce, l, hlist) {
- if (hlist_unhashed(&ce->hlist))
+ hlist_for_each_entry(ce, l, node) {
+ if (hlist_unhashed(&ce->node))
continue;
seq_printf(m,
@@ -287,10 +287,10 @@ static int dfscache_proc_show(struct seq_file *m, void *v)
IS_DFS_INTERLINK(ce->hdr_flags) ? "yes" : "no",
ce->path_consumed, cache_entry_expired(ce) ? "yes" : "no");
- list_for_each_entry(t, &ce->tlist, list) {
+ list_for_each_entry(t, &ce->tgt_list, head) {
seq_printf(m, " %s%s\n",
t->name,
- ce->tgthint == t ? " (target hint)" : "");
+ ce->tgt_hint == t ? " (target hint)" : "");
}
}
}
@@ -340,9 +340,9 @@ static inline void dump_tgts(const struct cache_entry *ce)
struct cache_dfs_tgt *t;
cifs_dbg(FYI, "target list:\n");
- list_for_each_entry(t, &ce->tlist, list) {
+ list_for_each_entry(t, &ce->tgt_list, head) {
cifs_dbg(FYI, " %s%s\n", t->name,
- ce->tgthint == t ? " (target hint)" : "");
+ ce->tgt_hint == t ? " (target hint)" : "");
}
}
@@ -448,7 +448,7 @@ static int cache_entry_hash(const void *data, int size, unsigned int *hash)
/* Return target hint of a DFS cache entry */
static inline char *get_tgt_name(const struct cache_entry *ce)
{
- struct cache_dfs_tgt *t = ce->tgthint;
+ struct cache_dfs_tgt *t = ce->tgt_hint;
return t ? t->name : ERR_PTR(-ENOENT);
}
@@ -480,7 +480,7 @@ static struct cache_dfs_tgt *alloc_target(const char *name, int path_consumed)
return ERR_PTR(-ENOMEM);
}
t->path_consumed = path_consumed;
- INIT_LIST_HEAD(&t->list);
+ INIT_LIST_HEAD(&t->head);
return t;
}
@@ -489,7 +489,7 @@ static struct cache_dfs_tgt *alloc_target(const char *name, int path_consumed)
* target hint.
*/
static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
- struct cache_entry *ce, const char *tgthint)
+ struct cache_entry *ce, const char *tgt_hint)
{
int i;
@@ -508,17 +508,17 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
free_tgts(ce);
return PTR_ERR(t);
}
- if (tgthint && !strcasecmp(t->name, tgthint)) {
- list_add(&t->list, &ce->tlist);
- tgthint = NULL;
+ if (tgt_hint && !strcasecmp(t->name, tgt_hint)) {
+ list_add(&t->head, &ce->tgt_list);
+ tgt_hint = NULL;
} else {
- list_add_tail(&t->list, &ce->tlist);
+ list_add_tail(&t->head, &ce->tgt_list);
}
- ce->numtgts++;
+ ce->num_tgts++;
}
- ce->tgthint = list_first_entry_or_null(&ce->tlist,
- struct cache_dfs_tgt, list);
+ ce->tgt_hint = list_first_entry_or_null(&ce->tgt_list,
+ struct cache_dfs_tgt, head);
return 0;
}
@@ -536,8 +536,8 @@ static struct cache_entry *alloc_cache_entry(struct dfs_info3_param *refs, int n
ce->path = refs[0].path_name;
refs[0].path_name = NULL;
- INIT_HLIST_NODE(&ce->hlist);
- INIT_LIST_HEAD(&ce->tlist);
+ INIT_HLIST_NODE(&ce->node);
+ INIT_LIST_HEAD(&ce->tgt_list);
rc = copy_ref_data(refs, numrefs, ce, NULL);
if (rc) {
@@ -559,8 +559,8 @@ static void remove_oldest_entry_locked(void)
for (i = 0; i < CACHE_HTABLE_SIZE; i++) {
struct hlist_head *l = &cache_htable[i];
- hlist_for_each_entry(ce, l, hlist) {
- if (hlist_unhashed(&ce->hlist))
+ hlist_for_each_entry(ce, l, node) {
+ if (hlist_unhashed(&ce->node))
continue;
if (!to_del || timespec64_compare(&ce->etime,
&to_del->etime) < 0)
@@ -610,7 +610,7 @@ static int add_cache_entry_locked(struct dfs_info3_param *refs, int numrefs)
}
spin_unlock(&cache_ttl_lock);
- hlist_add_head(&ce->hlist, &cache_htable[hash]);
+ hlist_add_head(&ce->node, &cache_htable[hash]);
dump_ce(ce);
atomic_inc(&cache_count);
@@ -648,7 +648,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int h
{
struct cache_entry *ce;
- hlist_for_each_entry(ce, &cache_htable[hash], hlist) {
+ hlist_for_each_entry(ce, &cache_htable[hash], node) {
if (dfs_path_equal(ce->path, strlen(ce->path), path, len)) {
dump_ce(ce);
return ce;
@@ -737,15 +737,15 @@ static int update_cache_entry_locked(struct cache_entry *ce, const struct dfs_in
WARN_ON(!rwsem_is_locked(&htable_rw_lock));
- if (ce->tgthint) {
- s = ce->tgthint->name;
+ if (ce->tgt_hint) {
+ s = ce->tgt_hint->name;
th = kstrdup(s, GFP_ATOMIC);
if (!th)
return -ENOMEM;
}
free_tgts(ce);
- ce->numtgts = 0;
+ ce->num_tgts = 0;
rc = copy_ref_data(refs, numrefs, ce, th);
@@ -878,42 +878,42 @@ static int setup_referral(const char *path, struct cache_entry *ce,
static int get_targets(struct cache_entry *ce, struct dfs_cache_tgt_list *tl)
{
int rc;
- struct list_head *head = &tl->tl_list;
+ struct list_head *tgt_list = &tl->list;
struct cache_dfs_tgt *t;
struct dfs_cache_tgt_iterator *it, *nit;
memset(tl, 0, sizeof(*tl));
- INIT_LIST_HEAD(head);
+ INIT_LIST_HEAD(tgt_list);
- list_for_each_entry(t, &ce->tlist, list) {
+ list_for_each_entry(t, &ce->tgt_list, head) {
it = kzalloc(sizeof(*it), GFP_ATOMIC);
if (!it) {
rc = -ENOMEM;
goto err_free_it;
}
- it->it_name = kstrdup(t->name, GFP_ATOMIC);
- if (!it->it_name) {
+ it->name = kstrdup(t->name, GFP_ATOMIC);
+ if (!it->name) {
kfree(it);
rc = -ENOMEM;
goto err_free_it;
}
- it->it_path_consumed = t->path_consumed;
+ it->path_consumed = t->path_consumed;
- if (ce->tgthint == t)
- list_add(&it->it_list, head);
+ if (ce->tgt_hint == t)
+ list_add(&it->head, tgt_list);
else
- list_add_tail(&it->it_list, head);
+ list_add_tail(&it->head, tgt_list);
}
- tl->tl_numtgts = ce->numtgts;
+ tl->num_tgts = ce->num_tgts;
return 0;
err_free_it:
- list_for_each_entry_safe(it, nit, head, it_list) {
- list_del(&it->it_list);
- kfree(it->it_name);
+ list_for_each_entry_safe(it, nit, tgt_list, head) {
+ list_del(&it->head);
+ kfree(it->name);
kfree(it);
}
return rc;
@@ -1025,7 +1025,7 @@ int dfs_cache_noreq_find(const char *path, struct dfs_info3_param *ref,
}
/**
- * dfs_cache_update_tgthint - update target hint of a DFS cache entry
+ * dfs_cache_update_tgt_hint - update target hint of a DFS cache entry
*
* If it doesn't find the cache entry, then it will get a DFS referral for @path
* and create a new entry.
@@ -1042,7 +1042,7 @@ int dfs_cache_noreq_find(const char *path, struct dfs_info3_param *ref,
*
* Return zero if the target hint was updated successfully, otherwise non-zero.
*/
-int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
+int dfs_cache_update_tgt_hint(const unsigned int xid, struct cifs_ses *ses,
const struct nls_table *cp, int remap, const char *path,
const struct dfs_cache_tgt_iterator *it)
{
@@ -1069,16 +1069,16 @@ int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
goto out_unlock;
}
- t = ce->tgthint;
+ t = ce->tgt_hint;
- if (likely(!strcasecmp(it->it_name, t->name)))
+ if (likely(!strcasecmp(it->name, t->name)))
goto out_unlock;
- list_for_each_entry(t, &ce->tlist, list) {
- if (!strcasecmp(t->name, it->it_name)) {
- ce->tgthint = t;
+ list_for_each_entry(t, &ce->tgt_list, head) {
+ if (!strcasecmp(t->name, it->name)) {
+ ce->tgt_hint = t;
cifs_dbg(FYI, "%s: new target hint: %s\n", __func__,
- it->it_name);
+ it->name);
break;
}
}
@@ -1091,7 +1091,7 @@ int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
}
/**
- * dfs_cache_noreq_update_tgthint - update target hint of a DFS cache entry
+ * dfs_cache_noreq_update_tgt_hint - update target hint of a DFS cache entry
* without sending any requests to the currently connected server.
*
* NOTE: This function will neither update a cache entry in case it was
@@ -1104,7 +1104,7 @@ int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
*
* Return zero if the target hint was updated successfully, otherwise non-zero.
*/
-int dfs_cache_noreq_update_tgthint(const char *path, const struct dfs_cache_tgt_iterator *it)
+int dfs_cache_noreq_update_tgt_hint(const char *path, const struct dfs_cache_tgt_iterator *it)
{
int rc;
struct cache_entry *ce;
@@ -1124,16 +1124,16 @@ int dfs_cache_noreq_update_tgthint(const char *path, const struct dfs_cache_tgt_
}
rc = 0;
- t = ce->tgthint;
+ t = ce->tgt_hint;
- if (unlikely(!strcasecmp(it->it_name, t->name)))
+ if (unlikely(!strcasecmp(it->name, t->name)))
goto out_unlock;
- list_for_each_entry(t, &ce->tlist, list) {
- if (!strcasecmp(t->name, it->it_name)) {
- ce->tgthint = t;
+ list_for_each_entry(t, &ce->tgt_list, head) {
+ if (!strcasecmp(t->name, it->name)) {
+ ce->tgt_hint = t;
cifs_dbg(FYI, "%s: new target hint: %s\n", __func__,
- it->it_name);
+ it->name);
break;
}
}
@@ -1172,9 +1172,9 @@ int dfs_cache_get_tgt_referral(const char *path, const struct dfs_cache_tgt_iter
goto out_unlock;
}
- cifs_dbg(FYI, "%s: target name: %s\n", __func__, it->it_name);
+ cifs_dbg(FYI, "%s: target name: %s\n", __func__, it->name);
- rc = setup_referral(path, ce, ref, it->it_name);
+ rc = setup_referral(path, ce, ref, it->name);
out_unlock:
up_read(&htable_rw_lock);
@@ -1273,19 +1273,19 @@ int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it,
size_t target_pplen, dfsref_pplen;
size_t len, c;
- if (!it || !path || !share || !prefix || strlen(path) < it->it_path_consumed)
+ if (!it || !path || !share || !prefix || strlen(path) < it->path_consumed)
return -EINVAL;
- sep = it->it_name[0];
+ sep = it->name[0];
if (sep != '\\' && sep != '/')
return -EINVAL;
- target_ppath = parse_target_share(it->it_name, &target_share);
+ target_ppath = parse_target_share(it->name, &target_share);
if (IS_ERR(target_ppath))
return PTR_ERR(target_ppath);
/* point to prefix in DFS referral path */
- dfsref_ppath = path + it->it_path_consumed;
+ dfsref_ppath = path + it->path_consumed;
dfsref_ppath += strspn(dfsref_ppath, "/\\");
target_pplen = strlen(target_ppath);
@@ -1578,10 +1578,10 @@ static void refresh_cache(struct cifs_ses **sessions)
for (i = 0; i < CACHE_HTABLE_SIZE; i++) {
struct hlist_head *l = &cache_htable[i];
- hlist_for_each_entry(ce, l, hlist) {
+ hlist_for_each_entry(ce, l, node) {
if (count == ARRAY_SIZE(ref_paths))
goto out_unlock;
- if (hlist_unhashed(&ce->hlist) || !cache_entry_expired(ce) ||
+ if (hlist_unhashed(&ce->node) || !cache_entry_expired(ce) ||
IS_ERR(find_ipc_from_server_path(sessions, ce->path)))
continue;
ref_paths[count++] = kstrdup(ce->path, GFP_ATOMIC);
@@ -1642,7 +1642,7 @@ static void refresh_cache_worker(struct work_struct *work)
/* Get refereces of mount groups */
mutex_lock(&mount_group_list_lock);
- list_for_each_entry(mg, &mount_group_list, list) {
+ list_for_each_entry(mg, &mount_group_list, head) {
kref_get(&mg->refcount);
list_add(&mg->refresh_list, &mglist);
}
diff --git a/fs/cifs/dfs_cache.h b/fs/cifs/dfs_cache.h
index 52070d1df189..9243d87ec198 100644
--- a/fs/cifs/dfs_cache.h
+++ b/fs/cifs/dfs_cache.h
@@ -13,17 +13,17 @@
#include <linux/uuid.h>
#include "cifsglob.h"
-#define DFS_CACHE_TGT_LIST_INIT(var) { .tl_numtgts = 0, .tl_list = LIST_HEAD_INIT((var).tl_list), }
+#define DFS_CACHE_TGT_LIST_INIT(var) { .num_tgts = 0, .list = LIST_HEAD_INIT((var).list), }
struct dfs_cache_tgt_list {
- int tl_numtgts;
- struct list_head tl_list;
+ int num_tgts;
+ struct list_head list;
};
struct dfs_cache_tgt_iterator {
- char *it_name;
- int it_path_consumed;
- struct list_head it_list;
+ char *name;
+ int path_consumed;
+ struct list_head head;
};
int dfs_cache_init(void);
@@ -35,10 +35,10 @@ int dfs_cache_find(const unsigned int xid, struct cifs_ses *ses, const struct nl
struct dfs_cache_tgt_list *tgt_list);
int dfs_cache_noreq_find(const char *path, struct dfs_info3_param *ref,
struct dfs_cache_tgt_list *tgt_list);
-int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
+int dfs_cache_update_tgt_hint(const unsigned int xid, struct cifs_ses *ses,
const struct nls_table *cp, int remap, const char *path,
const struct dfs_cache_tgt_iterator *it);
-int dfs_cache_noreq_update_tgthint(const char *path, const struct dfs_cache_tgt_iterator *it);
+int dfs_cache_noreq_update_tgt_hint(const char *path, const struct dfs_cache_tgt_iterator *it);
int dfs_cache_get_tgt_referral(const char *path, const struct dfs_cache_tgt_iterator *it,
struct dfs_info3_param *ref);
int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share,
@@ -52,10 +52,10 @@ static inline struct dfs_cache_tgt_iterator *
dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl,
struct dfs_cache_tgt_iterator *it)
{
- if (!tl || list_empty(&tl->tl_list) || !it ||
- list_is_last(&it->it_list, &tl->tl_list))
+ if (!tl || list_empty(&tl->list) || !it ||
+ list_is_last(&it->head, &tl->list))
return NULL;
- return list_next_entry(it, it_list);
+ return list_next_entry(it, head);
}
static inline struct dfs_cache_tgt_iterator *
@@ -63,35 +63,35 @@ dfs_cache_get_tgt_iterator(struct dfs_cache_tgt_list *tl)
{
if (!tl)
return NULL;
- return list_first_entry_or_null(&tl->tl_list,
+ return list_first_entry_or_null(&tl->list,
struct dfs_cache_tgt_iterator,
- it_list);
+ head);
}
static inline void dfs_cache_free_tgts(struct dfs_cache_tgt_list *tl)
{
struct dfs_cache_tgt_iterator *it, *nit;
- if (!tl || list_empty(&tl->tl_list))
+ if (!tl || list_empty(&tl->list))
return;
- list_for_each_entry_safe(it, nit, &tl->tl_list, it_list) {
- list_del(&it->it_list);
- kfree(it->it_name);
+ list_for_each_entry_safe(it, nit, &tl->list, head) {
+ list_del(&it->head);
+ kfree(it->name);
kfree(it);
}
- tl->tl_numtgts = 0;
+ tl->num_tgts = 0;
}
static inline const char *
dfs_cache_get_tgt_name(const struct dfs_cache_tgt_iterator *it)
{
- return it ? it->it_name : NULL;
+ return it ? it->name : NULL;
}
static inline int
dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
{
- return tl ? tl->tl_numtgts : 0;
+ return tl ? tl->num_tgts : 0;
}
#endif /* _CIFS_DFS_CACHE_H */
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 0f7315b00d34..67ce599401e2 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1130,13 +1130,13 @@ cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc)
void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,
unsigned int *len, unsigned int *offset)
{
- *len = rqst->rq_pagesz;
- *offset = (page == 0) ? rqst->rq_offset : 0;
+ *len = rqst->pagesz;
+ *offset = (page == 0) ? rqst->offset : 0;
- if (rqst->rq_npages == 1 || page == rqst->rq_npages-1)
- *len = rqst->rq_tailsz;
+ if (rqst->npages == 1 || page == rqst->npages-1)
+ *len = rqst->tailsz;
else if (page == 0)
- *len = rqst->rq_pagesz - rqst->rq_offset;
+ *len = rqst->pagesz - rqst->offset;
}
void extract_unc_hostname(const char *unc, const char **h, size_t *len)
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index b51454d95f71..704c7632ee00 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -30,7 +30,7 @@ send_nt_cancel(struct cifs_server_info *server, struct smb_rqst *rqst,
struct mid_q_entry *mid)
{
int rc = 0;
- struct smb_hdr *in_buf = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
+ struct smb_hdr *in_buf = (struct smb_hdr *)rqst->iov[0].iov_base;
/* -4 for RFC1001 length and +2 for BCC field */
in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2);
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index adbaac71b433..817dbf9abef3 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -27,9 +27,9 @@
static void
free_set_inf_compound(struct smb_rqst *rqst)
{
- if (rqst[1].rq_iov)
+ if (rqst[1].iov)
SMB2_set_info_free(&rqst[1]);
- if (rqst[2].rq_iov)
+ if (rqst[2].iov)
SMB2_close_free(&rqst[2]);
}
@@ -108,8 +108,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
vars->oparms.mode = mode;
vars->oparms.cifs_sb = cifs_sb;
- rqst[num_rqst].rq_iov = &vars->open_iov[0];
- rqst[num_rqst].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[num_rqst].iov = &vars->open_iov[0];
+ rqst[num_rqst].nvec = SMB2_CREATE_IOV_SIZE;
rc = SMB2_open_init(tcon, server,
&rqst[num_rqst], &oplock, &vars->oparms,
utf16_path);
@@ -125,8 +125,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
/* Operation */
switch (command) {
case SMB2_OP_QUERY_INFO:
- rqst[num_rqst].rq_iov = &vars->qi_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->qi_iov[0];
+ rqst[num_rqst].nvec = 1;
if (cfile)
rc = SMB2_query_info_init(tcon, server,
@@ -159,8 +159,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
full_path);
break;
case SMB2_OP_POSIX_QUERY_INFO:
- rqst[num_rqst].rq_iov = &vars->qi_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->qi_iov[0];
+ rqst[num_rqst].nvec = 1;
if (cfile)
rc = SMB2_query_info_init(tcon, server,
@@ -203,8 +203,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_mkdir_enter(xid, ses->id, tcon->tid, full_path);
break;
case SMB2_OP_RMDIR:
- rqst[num_rqst].rq_iov = &vars->si_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->si_iov[0];
+ rqst[num_rqst].nvec = 1;
size[0] = 1; /* sizeof __u8 See MS-FSCC section 2.4.11 */
data[0] = &delete_pending[0];
@@ -221,8 +221,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_rmdir_enter(xid, ses->id, tcon->tid, full_path);
break;
case SMB2_OP_SET_EOF:
- rqst[num_rqst].rq_iov = &vars->si_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->si_iov[0];
+ rqst[num_rqst].nvec = 1;
size[0] = 8; /* sizeof __le64 */
data[0] = ptr;
@@ -239,8 +239,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_set_eof_enter(xid, ses->id, tcon->tid, full_path);
break;
case SMB2_OP_SET_INFO:
- rqst[num_rqst].rq_iov = &vars->si_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->si_iov[0];
+ rqst[num_rqst].nvec = 1;
size[0] = sizeof(FILE_BASIC_INFO);
@@ -273,8 +273,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
full_path);
break;
case SMB2_OP_RENAME:
- rqst[num_rqst].rq_iov = &vars->si_iov[0];
- rqst[num_rqst].rq_nvec = 2;
+ rqst[num_rqst].iov = &vars->si_iov[0];
+ rqst[num_rqst].nvec = 2;
len = (2 * UniStrnlen((wchar_t *)ptr, PATH_MAX));
@@ -312,8 +312,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_rename_enter(xid, ses->id, tcon->tid, full_path);
break;
case SMB2_OP_HARDLINK:
- rqst[num_rqst].rq_iov = &vars->si_iov[0];
- rqst[num_rqst].rq_nvec = 2;
+ rqst[num_rqst].iov = &vars->si_iov[0];
+ rqst[num_rqst].nvec = 2;
len = (2 * UniStrnlen((wchar_t *)ptr, PATH_MAX));
@@ -350,8 +350,8 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
goto after_close;
/* Close */
flags |= CIFS_CP_CREATE_CLOSE_OP;
- rqst[num_rqst].rq_iov = &vars->close_iov[0];
- rqst[num_rqst].rq_nvec = 1;
+ rqst[num_rqst].iov = &vars->close_iov[0];
+ rqst[num_rqst].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[num_rqst], COMPOUND_FID,
COMPOUND_FID, false);
@@ -393,9 +393,9 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
&rsp_iov[1], sizeof(struct smb2_file_all_info),
ptr);
}
- if (rqst[1].rq_iov)
+ if (rqst[1].iov)
SMB2_query_info_free(&rqst[1]);
- if (rqst[2].rq_iov)
+ if (rqst[2].iov)
SMB2_close_free(&rqst[2]);
if (rc)
trace_smb3_query_info_compound_err(xid, ses->id,
@@ -413,9 +413,9 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
le32_to_cpu(qi_rsp->OutputBufferLength),
&rsp_iov[1], sizeof(struct smb311_posix_qinfo) /* add SIDs */, ptr);
}
- if (rqst[1].rq_iov)
+ if (rqst[1].iov)
SMB2_query_info_free(&rqst[1]);
- if (rqst[2].rq_iov)
+ if (rqst[2].iov)
SMB2_close_free(&rqst[2]);
if (rc)
trace_smb3_posix_query_info_compound_err(xid, ses->id, tcon->tid, rc);
@@ -427,7 +427,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_delete_err(xid, ses->id, tcon->tid, rc);
else
trace_smb3_delete_done(xid, ses->id, tcon->tid);
- if (rqst[1].rq_iov)
+ if (rqst[1].iov)
SMB2_close_free(&rqst[1]);
break;
case SMB2_OP_MKDIR:
@@ -435,7 +435,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
trace_smb3_mkdir_err(xid, ses->id, tcon->tid, rc);
else
trace_smb3_mkdir_done(xid, ses->id, tcon->tid);
- if (rqst[1].rq_iov)
+ if (rqst[1].iov)
SMB2_close_free(&rqst[1]);
break;
case SMB2_OP_HARDLINK:
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 884bf9061715..4b2bdc4a50bb 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -847,8 +847,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon;
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE);
@@ -864,8 +864,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
smb2_set_next_command(tcon, &rqst[0]);
memset(&qi_iov, 0, sizeof(qi_iov));
- rqst[1].rq_iov = qi_iov;
- rqst[1].rq_nvec = 1;
+ rqst[1].iov = qi_iov;
+ rqst[1].nvec = 1;
rc = SMB2_query_info_init(tcon, server,
&rqst[1], COMPOUND_FID,
@@ -1351,8 +1351,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms));
oparms.tcon = tcon;
@@ -1371,8 +1371,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
/* Set Info */
memset(&si_iov, 0, sizeof(si_iov));
- rqst[1].rq_iov = si_iov;
- rqst[1].rq_nvec = 1;
+ rqst[1].iov = si_iov;
+ rqst[1].nvec = 1;
len = sizeof(*ea) + ea_name_len + ea_value_len + 1;
ea = kzalloc(len, GFP_KERNEL);
@@ -1400,8 +1400,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
/* Close */
memset(&close_iov, 0, sizeof(close_iov));
- rqst[2].rq_iov = close_iov;
- rqst[2].rq_nvec = 1;
+ rqst[2].iov = close_iov;
+ rqst[2].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
smb2_set_related(&rqst[2]);
@@ -1704,8 +1704,8 @@ smb2_ioctl_query_info(const unsigned int xid,
}
/* Open */
- rqst[0].rq_iov = &vars->open_iov[0];
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = &vars->open_iov[0];
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms));
oparms.tcon = tcon;
@@ -1748,8 +1748,8 @@ smb2_ioctl_query_info(const unsigned int xid,
rc = -EPERM;
goto free_open_req;
}
- rqst[1].rq_iov = &vars->io_iov[0];
- rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
+ rqst[1].iov = &vars->io_iov[0];
+ rqst[1].nvec = SMB2_IOCTL_IOV_SIZE;
rc = SMB2_ioctl_init(tcon, server, &rqst[1], COMPOUND_FID, COMPOUND_FID,
qi.info_type, true, buffer, qi.output_buffer_length,
@@ -1766,8 +1766,8 @@ smb2_ioctl_query_info(const unsigned int xid,
rc = -EINVAL;
goto free_open_req;
}
- rqst[1].rq_iov = &vars->si_iov[0];
- rqst[1].rq_nvec = 1;
+ rqst[1].iov = &vars->si_iov[0];
+ rqst[1].nvec = 1;
/* MS-FSCC 2.4.13 FileEndOfFileInformation */
size[0] = 8;
@@ -1778,8 +1778,8 @@ smb2_ioctl_query_info(const unsigned int xid,
SMB2_O_INFO_FILE, 0, data, size);
free_req1_func = SMB2_set_info_free;
} else if (qi.flags == PASSTHRU_QUERY_INFO) {
- rqst[1].rq_iov = &vars->qi_iov[0];
- rqst[1].rq_nvec = 1;
+ rqst[1].iov = &vars->qi_iov[0];
+ rqst[1].nvec = 1;
rc = SMB2_query_info_init(tcon, server,
&rqst[1], COMPOUND_FID,
@@ -1800,8 +1800,8 @@ smb2_ioctl_query_info(const unsigned int xid,
smb2_set_related(&rqst[1]);
/* Close */
- rqst[2].rq_iov = &vars->close_iov[0];
- rqst[2].rq_nvec = 1;
+ rqst[2].iov = &vars->close_iov[0];
+ rqst[2].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
@@ -2403,8 +2403,8 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA;
@@ -2424,8 +2424,8 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
search_info->last_entry_index = 2;
memset(&qd_iov, 0, sizeof(qd_iov));
- rqst[1].rq_iov = qd_iov;
- rqst[1].rq_nvec = SMB2_QUERY_DIRECTORY_IOV_SIZE;
+ rqst[1].iov = qd_iov;
+ rqst[1].nvec = SMB2_QUERY_DIRECTORY_IOV_SIZE;
rc = SMB2_query_directory_init(xid, tcon, server,
&rqst[1],
@@ -2613,7 +2613,7 @@ smb2_set_related(struct smb_rqst *rqst)
{
struct smb2_hdr *shdr;
- shdr = (struct smb2_hdr *)(rqst->rq_iov[0].iov_base);
+ shdr = (struct smb2_hdr *)(rqst->iov[0].iov_base);
if (shdr == NULL) {
cifs_dbg(FYI, "shdr NULL in smb2_set_related\n");
return;
@@ -2632,7 +2632,7 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst)
unsigned long len = smb_rqst_len(server, rqst);
int i, num_padding;
- shdr = (struct smb2_hdr *)(rqst->rq_iov[0].iov_base);
+ shdr = (struct smb2_hdr *)(rqst->iov[0].iov_base);
if (shdr == NULL) {
cifs_dbg(FYI, "shdr NULL in smb2_set_next_command\n");
return;
@@ -2650,9 +2650,9 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst)
* If we do not have encryption then we can just add an extra
* iov for the padding.
*/
- rqst->rq_iov[rqst->rq_nvec].iov_base = smb2_padding;
- rqst->rq_iov[rqst->rq_nvec].iov_len = num_padding;
- rqst->rq_nvec++;
+ rqst->iov[rqst->nvec].iov_base = smb2_padding;
+ rqst->iov[rqst->nvec].iov_len = num_padding;
+ rqst->nvec++;
len += num_padding;
} else {
/*
@@ -2662,18 +2662,18 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst)
* We have to flatten this into a single buffer and add
* the padding to it.
*/
- for (i = 1; i < rqst->rq_nvec; i++) {
- memcpy(rqst->rq_iov[0].iov_base +
- rqst->rq_iov[0].iov_len,
- rqst->rq_iov[i].iov_base,
- rqst->rq_iov[i].iov_len);
- rqst->rq_iov[0].iov_len += rqst->rq_iov[i].iov_len;
+ for (i = 1; i < rqst->nvec; i++) {
+ memcpy(rqst->iov[0].iov_base +
+ rqst->iov[0].iov_len,
+ rqst->iov[i].iov_base,
+ rqst->iov[i].iov_len);
+ rqst->iov[0].iov_len += rqst->iov[i].iov_len;
}
- memset(rqst->rq_iov[0].iov_base + rqst->rq_iov[0].iov_len,
+ memset(rqst->iov[0].iov_base + rqst->iov[0].iov_len,
0, num_padding);
- rqst->rq_iov[0].iov_len += num_padding;
+ rqst->iov[0].iov_len += num_padding;
len += num_padding;
- rqst->rq_nvec = 1;
+ rqst->nvec = 1;
}
finished:
@@ -2724,8 +2724,8 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
open_cached_dir(xid, tcon, path, cifs_sb, &cfid); /* cfid null if open dir failed */
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon;
oparms.desired_access = desired_access;
@@ -2741,8 +2741,8 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
smb2_set_next_command(tcon, &rqst[0]);
memset(&qi_iov, 0, sizeof(qi_iov));
- rqst[1].rq_iov = qi_iov;
- rqst[1].rq_nvec = 1;
+ rqst[1].iov = qi_iov;
+ rqst[1].nvec = 1;
if (cfid) {
rc = SMB2_query_info_init(tcon, server,
@@ -2769,8 +2769,8 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
}
memset(&close_iov, 0, sizeof(close_iov));
- rqst[2].rq_iov = close_iov;
- rqst[2].rq_nvec = 1;
+ rqst[2].iov = close_iov;
+ rqst[2].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
@@ -3160,8 +3160,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms));
oparms.tcon = tcon;
@@ -3180,8 +3180,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
/* IOCTL */
memset(&io_iov, 0, sizeof(io_iov));
- rqst[1].rq_iov = io_iov;
- rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
+ rqst[1].iov = io_iov;
+ rqst[1].nvec = SMB2_IOCTL_IOV_SIZE;
rc = SMB2_ioctl_init(tcon, server,
&rqst[1], fid.persistent_fid,
@@ -3199,8 +3199,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
/* Close */
memset(&close_iov, 0, sizeof(close_iov));
- rqst[2].rq_iov = close_iov;
- rqst[2].rq_nvec = 1;
+ rqst[2].iov = close_iov;
+ rqst[2].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
@@ -3341,8 +3341,8 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
* to see if there is a handle already open that we can use
*/
memset(&open_iov, 0, sizeof(open_iov));
- rqst[0].rq_iov = open_iov;
- rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst[0].iov = open_iov;
+ rqst[0].nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms));
oparms.tcon = tcon;
@@ -3361,8 +3361,8 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
/* IOCTL */
memset(&io_iov, 0, sizeof(io_iov));
- rqst[1].rq_iov = io_iov;
- rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
+ rqst[1].iov = io_iov;
+ rqst[1].nvec = SMB2_IOCTL_IOV_SIZE;
rc = SMB2_ioctl_init(tcon, server,
&rqst[1], COMPOUND_FID,
@@ -3380,8 +3380,8 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
/* Close */
memset(&close_iov, 0, sizeof(close_iov));
- rqst[2].rq_iov = close_iov;
- rqst[2].rq_nvec = 1;
+ rqst[2].iov = close_iov;
+ rqst[2].nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
@@ -4471,7 +4471,7 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, unsigned int orig_len,
struct smb_rqst *old_rq, __le16 cipher_type)
{
struct smb2_hdr *shdr =
- (struct smb2_hdr *)old_rq->rq_iov[0].iov_base;
+ (struct smb2_hdr *)old_rq->iov[0].iov_base;
memset(tr_hdr, 0, sizeof(struct smb2_transform_hdr));
tr_hdr->ProtocolId = SMB2_TRANSFORM_PROTO_NUM;
@@ -4504,9 +4504,9 @@ static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
/* Assumes the first rqst has a transform header as the first iov.
* I.e.
- * rqst[0].rq_iov[0] is transform header
- * rqst[0].rq_iov[1+] data to be encrypted/decrypted
- * rqst[1+].rq_iov[0+] data to be encrypted/decrypted
+ * rqst[0].iov[0] is transform header
+ * rqst[0].iov[1+] data to be encrypted/decrypted
+ * rqst[1+].iov[0+] data to be encrypted/decrypted
*/
static struct scatterlist *
init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
@@ -4520,7 +4520,7 @@ init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
sg_len = 1;
for (i = 0; i < num_rqst; i++)
- sg_len += rqst[i].rq_nvec + rqst[i].rq_npages;
+ sg_len += rqst[i].nvec + rqst[i].npages;
sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL);
if (!sg)
@@ -4528,22 +4528,22 @@ init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
sg_init_table(sg, sg_len);
for (i = 0; i < num_rqst; i++) {
- for (j = 0; j < rqst[i].rq_nvec; j++) {
+ for (j = 0; j < rqst[i].nvec; j++) {
/*
* The first rqst has a transform header where the
* first 20 bytes are not part of the encrypted blob
*/
skip = (i == 0) && (j == 0) ? 20 : 0;
smb2_sg_set_buf(&sg[idx++],
- rqst[i].rq_iov[j].iov_base + skip,
- rqst[i].rq_iov[j].iov_len - skip);
+ rqst[i].iov[j].iov_base + skip,
+ rqst[i].iov[j].iov_len - skip);
}
- for (j = 0; j < rqst[i].rq_npages; j++) {
+ for (j = 0; j < rqst[i].npages; j++) {
unsigned int len, offset;
rqst_page_get_length(&rqst[i], j, &len, &offset);
- sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset);
+ sg_set_page(&sg[idx++], rqst[i].pages[j], len, offset);
}
}
smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE);
@@ -4584,7 +4584,7 @@ crypt_message(struct cifs_server_info *server, int num_rqst,
struct smb_rqst *rqst, int enc)
{
struct smb2_transform_hdr *tr_hdr =
- (struct smb2_transform_hdr *)rqst[0].rq_iov[0].iov_base;
+ (struct smb2_transform_hdr *)rqst[0].iov[0].iov_base;
unsigned int assoc_data_len = sizeof(struct smb2_transform_hdr) - 20;
int rc = 0;
struct scatterlist *sg;
@@ -4690,10 +4690,10 @@ smb3_free_compound_rqst(int num_rqst, struct smb_rqst *rqst)
int i, j;
for (i = 0; i < num_rqst; i++) {
- if (rqst[i].rq_pages) {
- for (j = rqst[i].rq_npages - 1; j >= 0; j--)
- put_page(rqst[i].rq_pages[j]);
- kfree(rqst[i].rq_pages);
+ if (rqst[i].pages) {
+ for (j = rqst[i].npages - 1; j >= 0; j--)
+ put_page(rqst[i].pages[j]);
+ kfree(rqst[i].pages);
}
}
}
@@ -4708,34 +4708,34 @@ smb3_free_compound_rqst(int num_rqst, struct smb_rqst *rqst)
* only contains a single iov for the transform header which we then can pass
* to crypt_message().
*
- * new_rq[0].rq_iov[0] : smb2_transform_hdr pre-allocated by the caller
- * new_rq[1+].rq_iov[*] == old_rq[0+].rq_iov[*] : SMB2/3 requests
+ * new_rq[0].iov[0] : smb2_transform_hdr pre-allocated by the caller
+ * new_rq[1+].iov[*] == old_rq[0+].iov[*] : SMB2/3 requests
*/
static int
smb3_init_transform_rq(struct cifs_server_info *server, int num_rqst,
struct smb_rqst *new_rq, struct smb_rqst *old_rq)
{
struct page **pages;
- struct smb2_transform_hdr *tr_hdr = new_rq[0].rq_iov[0].iov_base;
+ struct smb2_transform_hdr *tr_hdr = new_rq[0].iov[0].iov_base;
unsigned int npages;
unsigned int orig_len = 0;
int i, j;
int rc = -ENOMEM;
for (i = 1; i < num_rqst; i++) {
- npages = old_rq[i - 1].rq_npages;
+ npages = old_rq[i - 1].npages;
pages = kmalloc_array(npages, sizeof(struct page *),
GFP_KERNEL);
if (!pages)
goto err_free;
- new_rq[i].rq_pages = pages;
- new_rq[i].rq_npages = npages;
- new_rq[i].rq_offset = old_rq[i - 1].rq_offset;
- new_rq[i].rq_pagesz = old_rq[i - 1].rq_pagesz;
- new_rq[i].rq_tailsz = old_rq[i - 1].rq_tailsz;
- new_rq[i].rq_iov = old_rq[i - 1].rq_iov;
- new_rq[i].rq_nvec = old_rq[i - 1].rq_nvec;
+ new_rq[i].pages = pages;
+ new_rq[i].npages = npages;
+ new_rq[i].offset = old_rq[i - 1].offset;
+ new_rq[i].pagesz = old_rq[i - 1].pagesz;
+ new_rq[i].tailsz = old_rq[i - 1].tailsz;
+ new_rq[i].iov = old_rq[i - 1].iov;
+ new_rq[i].nvec = old_rq[i - 1].nvec;
orig_len += smb_rqst_len(server, &old_rq[i - 1]);
@@ -4752,12 +4752,12 @@ smb3_init_transform_rq(struct cifs_server_info *server, int num_rqst,
rqst_page_get_length(&new_rq[i], j, &len, &offset);
- dst = (char *) kmap(new_rq[i].rq_pages[j]) + offset;
- src = (char *) kmap(old_rq[i - 1].rq_pages[j]) + offset;
+ dst = (char *) kmap(new_rq[i].pages[j]) + offset;
+ src = (char *) kmap(old_rq[i - 1].pages[j]) + offset;
memcpy(dst, src, len);
- kunmap(new_rq[i].rq_pages[j]);
- kunmap(old_rq[i - 1].rq_pages[j]);
+ kunmap(new_rq[i].pages[j]);
+ kunmap(old_rq[i - 1].pages[j]);
}
}
@@ -4799,12 +4799,12 @@ decrypt_raw_data(struct cifs_server_info *server, char *buf,
iov[1].iov_base = buf + sizeof(struct smb2_transform_hdr);
iov[1].iov_len = buf_data_size;
- rqst.rq_iov = iov;
- rqst.rq_nvec = 2;
- rqst.rq_pages = pages;
- rqst.rq_npages = npages;
- rqst.rq_pagesz = PAGE_SIZE;
- rqst.rq_tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE;
+ rqst.iov = iov;
+ rqst.nvec = 2;
+ rqst.pages = pages;
+ rqst.npages = npages;
+ rqst.pagesz = PAGE_SIZE;
+ rqst.tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE;
rc = crypt_message(server, 1, &rqst, 0);
cifs_dbg(FYI, "Decrypt message returned %d\n", rc);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 405c42f09484..85c454774a3f 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -947,8 +947,8 @@ SMB2_negotiate(const unsigned int xid,
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buftype, flags, &rsp_iov);
@@ -1360,8 +1360,8 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
req->SecurityBufferLength = cpu_to_le16(sess_data->iov[1].iov_len);
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = sess_data->iov;
- rqst.rq_nvec = 2;
+ rqst.iov = sess_data->iov;
+ rqst.nvec = 2;
/* BB add code to build os and lm fields */
rc = cifs_send_recv(sess_data->xid, sess_data->ses,
@@ -1785,8 +1785,8 @@ SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, ses->server,
&rqst, &resp_buf_type, flags, &rsp_iov);
@@ -1888,8 +1888,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
req->hdr.Flags |= SMB2_FLAGS_SIGNED;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 2;
+ rqst.iov = iov;
+ rqst.nvec = 2;
/* Need 64 for max size write so ask for more in case not there yet */
req->hdr.CreditRequest = cpu_to_le16(64);
@@ -1995,8 +1995,8 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, ses->server,
&rqst, &resp_buf_type, flags, &rsp_iov);
@@ -2718,8 +2718,8 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = n_iov;
+ rqst.iov = iov;
+ rqst.nvec = n_iov;
/* no need to inc num_remote_opens because we close it just below */
trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->id, CREATE_NOT_FILE,
@@ -2775,7 +2775,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
int copy_size;
int uni_path_len;
unsigned int total_len;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
__le16 *copy_path;
int rc;
@@ -2938,7 +2938,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
}
add_query_id_context(iov, &n_iov);
- rqst->rq_nvec = n_iov;
+ rqst->nvec = n_iov;
return 0;
}
@@ -2950,11 +2950,11 @@ SMB2_open_free(struct smb_rqst *rqst)
{
int i;
- if (rqst && rqst->rq_iov) {
- cifs_small_buf_release(rqst->rq_iov[0].iov_base);
- for (i = 1; i < rqst->rq_nvec; i++)
- if (rqst->rq_iov[i].iov_base != smb2_padding)
- kfree(rqst->rq_iov[i].iov_base);
+ if (rqst && rqst->iov) {
+ cifs_small_buf_release(rqst->iov[0].iov_base);
+ for (i = 1; i < rqst->nvec; i++)
+ if (rqst->iov[i].iov_base != smb2_padding)
+ kfree(rqst->iov[i].iov_base);
}
}
@@ -2984,8 +2984,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = SMB2_CREATE_IOV_SIZE;
+ rqst.iov = iov;
+ rqst.nvec = SMB2_CREATE_IOV_SIZE;
rc = SMB2_open_init(tcon, server,
&rqst, oplock, oparms, path);
@@ -3059,7 +3059,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
__u32 max_response_size)
{
struct smb2_ioctl_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int total_len;
int rc;
char *in_data_buf;
@@ -3099,12 +3099,12 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
/* do not set InputOffset if no input data */
req->InputOffset =
cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer));
- rqst->rq_nvec = 2;
+ rqst->nvec = 2;
iov[0].iov_len = total_len - 1;
iov[1].iov_base = in_data_buf;
iov[1].iov_len = indatalen;
} else {
- rqst->rq_nvec = 1;
+ rqst->nvec = 1;
iov[0].iov_len = total_len;
}
@@ -3146,11 +3146,11 @@ void
SMB2_ioctl_free(struct smb_rqst *rqst)
{
int i;
- if (rqst && rqst->rq_iov) {
- cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
- for (i = 1; i < rqst->rq_nvec; i++)
- if (rqst->rq_iov[i].iov_base != smb2_padding)
- kfree(rqst->rq_iov[i].iov_base);
+ if (rqst && rqst->iov) {
+ cifs_small_buf_release(rqst->iov[0].iov_base); /* request */
+ for (i = 1; i < rqst->nvec; i++)
+ if (rqst->iov[i].iov_base != smb2_padding)
+ kfree(rqst->iov[i].iov_base);
}
}
@@ -3199,8 +3199,8 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = SMB2_IOCTL_IOV_SIZE;
+ rqst.iov = iov;
+ rqst.nvec = SMB2_IOCTL_IOV_SIZE;
rc = SMB2_ioctl_init(tcon, server,
&rqst, persistent_fid, volatile_fid, opcode,
@@ -3312,7 +3312,7 @@ SMB2_close_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
u64 persistent_fid, u64 volatile_fid, bool query_attrs)
{
struct smb2_close_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int total_len;
int rc;
@@ -3336,8 +3336,8 @@ SMB2_close_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
void
SMB2_close_free(struct smb_rqst *rqst)
{
- if (rqst && rqst->rq_iov)
- cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ if (rqst && rqst->iov)
+ cifs_small_buf_release(rqst->iov[0].iov_base); /* request */
}
int
@@ -3366,8 +3366,8 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
/* check if need to ask server to return timestamps in close response */
if (pbuf)
@@ -3488,7 +3488,7 @@ SMB2_query_info_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
size_t output_len, size_t input_len, void *input)
{
struct smb2_query_info_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int total_len;
int rc;
@@ -3520,8 +3520,8 @@ SMB2_query_info_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
void
SMB2_query_info_free(struct smb_rqst *rqst)
{
- if (rqst && rqst->rq_iov)
- cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ if (rqst && rqst->iov)
+ cifs_small_buf_release(rqst->iov[0].iov_base); /* request */
}
static int
@@ -3554,8 +3554,8 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = SMB2_query_info_init(tcon, server,
&rqst, persistent_fid, volatile_fid,
@@ -3676,7 +3676,7 @@ SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst,
u32 completion_filter, bool watch_tree)
{
struct smb2_change_notify_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int total_len;
int rc;
@@ -3725,8 +3725,8 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = SMB2_notify_init(xid, &rqst, tcon, server,
persistent_fid, volatile_fid,
@@ -3748,8 +3748,8 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,
ses->id, (u8)watch_tree, completion_filter);
cnotify_exit:
- if (rqst.rq_iov)
- cifs_small_buf_release(rqst.rq_iov[0].iov_base); /* request */
+ if (rqst.iov)
+ cifs_small_buf_release(rqst.iov[0].iov_base); /* request */
free_rsp_buf(resp_buftype, rsp_iov.iov_base);
return rc;
}
@@ -3905,8 +3905,8 @@ SMB2_echo(struct cifs_server_info *server)
struct smb2_echo_req *req;
int rc = 0;
struct kvec iov[1];
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = 1 };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = 1 };
unsigned int total_len;
cifs_dbg(FYI, "In echo request for conn_id %lld\n", server->conn_id);
@@ -3943,8 +3943,8 @@ SMB2_echo(struct cifs_server_info *server)
void
SMB2_flush_free(struct smb_rqst *rqst)
{
- if (rqst && rqst->rq_iov)
- cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ if (rqst && rqst->iov)
+ cifs_small_buf_release(rqst->iov[0].iov_base); /* request */
}
int
@@ -3953,7 +3953,7 @@ SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
u64 persistent_fid, u64 volatile_fid)
{
struct smb2_flush_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int total_len;
int rc;
@@ -3993,8 +3993,8 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = SMB2_flush_init(xid, &rqst, tcon, server,
persistent_fid, volatile_fid);
@@ -4127,13 +4127,13 @@ smb2_readv_callback(struct mid_q_entry *mid)
struct smb2_hdr *shdr =
(struct smb2_hdr *)rdata->iov[0].iov_base;
struct cifs_credits credits = { .value = 0, .instance = 0 };
- struct smb_rqst rqst = { .rq_iov = &rdata->iov[1],
- .rq_nvec = 1,
- .rq_pages = rdata->pages,
- .rq_offset = rdata->page_offset,
- .rq_npages = rdata->nr_pages,
- .rq_pagesz = rdata->pagesz,
- .rq_tailsz = rdata->tailsz };
+ struct smb_rqst rqst = { .iov = &rdata->iov[1],
+ .nvec = 1,
+ .pages = rdata->pages,
+ .offset = rdata->page_offset,
+ .npages = rdata->nr_pages,
+ .pagesz = rdata->pagesz,
+ .tailsz = rdata->tailsz };
WARN_ONCE(rdata->server != mid->server,
"rdata server %p != mid server %p",
@@ -4213,8 +4213,8 @@ smb2_async_readv(struct cifs_readdata *rdata)
char *buf;
struct smb2_hdr *shdr;
struct cifs_io_parms io_parms;
- struct smb_rqst rqst = { .rq_iov = rdata->iov,
- .rq_nvec = 1 };
+ struct smb_rqst rqst = { .iov = rdata->iov,
+ .nvec = 1 };
struct cifs_server_info *server;
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
unsigned int total_len;
@@ -4306,8 +4306,8 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, io_parms->server,
&rqst, &resp_buftype, flags, &rsp_iov);
@@ -4529,17 +4529,17 @@ smb2_async_writev(struct cifs_writedata *wdata,
iov[0].iov_len = total_len - 1;
iov[0].iov_base = (char *)req;
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
- rqst.rq_pages = wdata->pages;
- rqst.rq_offset = wdata->page_offset;
- rqst.rq_npages = wdata->nr_pages;
- rqst.rq_pagesz = wdata->pagesz;
- rqst.rq_tailsz = wdata->tailsz;
+ rqst.iov = iov;
+ rqst.nvec = 1;
+ rqst.pages = wdata->pages;
+ rqst.offset = wdata->page_offset;
+ rqst.npages = wdata->nr_pages;
+ rqst.pagesz = wdata->pagesz;
+ rqst.tailsz = wdata->tailsz;
#ifdef CONFIG_CIFS_SMB_DIRECT
if (wdata->mr) {
iov[0].iov_len += sizeof(struct smbd_buffer_descriptor_v1);
- rqst.rq_npages = 0;
+ rqst.npages = 0;
}
#endif
cifs_dbg(FYI, "async write at %llu %u bytes\n",
@@ -4644,8 +4644,8 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
iov[0].iov_len = total_len - 1;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = n_vec + 1;
+ rqst.iov = iov;
+ rqst.nvec = n_vec + 1;
rc = cifs_send_recv(xid, io_parms->tcon->ses, server,
&rqst,
@@ -4835,7 +4835,7 @@ int SMB2_query_directory_init(const unsigned int xid,
MAX_SMB2_CREATE_RESPONSE_SIZE -
MAX_SMB2_CLOSE_RESPONSE_SIZE;
unsigned int total_len;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
int len, rc;
rc = smb2_plain_req_init(SMB2_QUERY_DIRECTORY, tcon, server,
@@ -4893,8 +4893,8 @@ int SMB2_query_directory_init(const unsigned int xid,
void SMB2_query_directory_free(struct smb_rqst *rqst)
{
- if (rqst && rqst->rq_iov) {
- cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ if (rqst && rqst->iov) {
+ cifs_small_buf_release(rqst->iov[0].iov_base); /* request */
}
}
@@ -4993,8 +4993,8 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
memset(&rqst, 0, sizeof(struct smb_rqst));
memset(&iov, 0, sizeof(iov));
- rqst.rq_iov = iov;
- rqst.rq_nvec = SMB2_QUERY_DIRECTORY_IOV_SIZE;
+ rqst.iov = iov;
+ rqst.nvec = SMB2_QUERY_DIRECTORY_IOV_SIZE;
rc = SMB2_query_directory_init(xid, tcon, server,
&rqst, persistent_fid,
@@ -5048,7 +5048,7 @@ SMB2_set_info_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
void **data, unsigned int *size)
{
struct smb2_set_info_req *req;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
unsigned int i, total_len;
int rc;
@@ -5075,7 +5075,7 @@ SMB2_set_info_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
/* 1 for Buffer */
iov[0].iov_len = total_len - 1;
- for (i = 1; i < rqst->rq_nvec; i++) {
+ for (i = 1; i < rqst->nvec; i++) {
le32_add_cpu(&req->BufferLength, size[i]);
iov[i].iov_base = (char *)data[i];
iov[i].iov_len = size[i];
@@ -5087,8 +5087,8 @@ SMB2_set_info_init(struct cifs_tcon *tcon, struct cifs_server_info *server,
void
SMB2_set_info_free(struct smb_rqst *rqst)
{
- if (rqst && rqst->rq_iov)
- cifs_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ if (rqst && rqst->iov)
+ cifs_buf_release(rqst->iov[0].iov_base); /* request */
}
static int
@@ -5121,8 +5121,8 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
return -ENOMEM;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = num;
+ rqst.iov = iov;
+ rqst.nvec = num;
rc = SMB2_set_info_init(tcon, server,
&rqst, persistent_fid, volatile_fid, pid,
@@ -5227,8 +5227,8 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buf_type, flags, &rsp_iov);
@@ -5334,8 +5334,8 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon,
flags |= CIFS_TRANSFORM_REQ;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = &iov;
- rqst.rq_nvec = 1;
+ rqst.iov = &iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buftype, flags, &rsp_iov);
@@ -5385,8 +5385,8 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
flags |= CIFS_TRANSFORM_REQ;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = &iov;
- rqst.rq_nvec = 1;
+ rqst.iov = &iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buftype, flags, &rsp_iov);
@@ -5452,8 +5452,8 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
flags |= CIFS_TRANSFORM_REQ;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = &iov;
- rqst.rq_nvec = 1;
+ rqst.iov = &iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buftype, flags, &rsp_iov);
@@ -5537,8 +5537,8 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
cifs_stats_inc(&tcon->stats.cifs.locks);
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 2;
+ rqst.iov = iov;
+ rqst.nvec = 2;
rc = cifs_send_recv(xid, tcon->ses, server,
&rqst, &resp_buf_type, flags,
@@ -5610,8 +5610,8 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
+ rqst.iov = iov;
+ rqst.nvec = 1;
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buf_type, flags, &rsp_iov);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 2b6ffd255d75..53ef472342ec 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -216,7 +216,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
int rc;
unsigned char smb2_signature[SMB2_HMACSHA256_SIZE];
unsigned char *sigptr = smb2_signature;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0].iov_base;
struct cifs_ses *ses;
struct shash_desc *shash;
@@ -269,7 +269,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
* __cifs_calc_signature().
*/
drqst = *rqst;
- if (drqst.rq_nvec >= 2 && iov[0].iov_len == 4) {
+ if (drqst.nvec >= 2 && iov[0].iov_len == 4) {
rc = crypto_shash_update(shash, iov[0].iov_base,
iov[0].iov_len);
if (rc) {
@@ -278,8 +278,8 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
__func__);
goto out;
}
- drqst.rq_iov++;
- drqst.rq_nvec--;
+ drqst.iov++;
+ drqst.nvec--;
}
rc = __cifs_calc_signature(&drqst, server, sigptr, shash);
@@ -548,7 +548,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
int rc;
unsigned char smb3_signature[SMB2_CMACAES_SIZE];
unsigned char *sigptr = smb3_signature;
- struct kvec *iov = rqst->rq_iov;
+ struct kvec *iov = rqst->iov;
struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0].iov_base;
struct shash_desc *shash;
struct crypto_shash *hash;
@@ -599,7 +599,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
* __cifs_calc_signature().
*/
drqst = *rqst;
- if (drqst.rq_nvec >= 2 && iov[0].iov_len == 4) {
+ if (drqst.nvec >= 2 && iov[0].iov_len == 4) {
rc = crypto_shash_update(shash, iov[0].iov_base,
iov[0].iov_len);
if (rc) {
@@ -607,8 +607,8 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,
__func__);
goto out;
}
- drqst.rq_iov++;
- drqst.rq_nvec--;
+ drqst.iov++;
+ drqst.nvec--;
}
rc = __cifs_calc_signature(&drqst, server, sigptr, shash);
@@ -631,7 +631,7 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server)
bool is_binding;
bool is_signed;
- shdr = (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
+ shdr = (struct smb2_hdr *)rqst->iov[0].iov_base;
ssr = (struct smb2_sess_setup_req *)shdr;
is_binding = shdr->Command == SMB2_SESSION_SETUP &&
@@ -663,7 +663,7 @@ smb2_verify_signature(struct smb_rqst *rqst, struct cifs_server_info *server)
unsigned int rc;
char server_response_sig[SMB2_SIGNATURE_SIZE];
struct smb2_hdr *shdr =
- (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
+ (struct smb2_hdr *)rqst->iov[0].iov_base;
if ((shdr->Command == SMB2_NEGOTIATE) ||
(shdr->Command == SMB2_SESSION_SETUP) ||
@@ -814,8 +814,8 @@ smb2_check_receive(struct mid_q_entry *mid, struct cifs_server_info *server,
{
unsigned int len = mid->resp_buf_size;
struct kvec iov[1];
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = 1 };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = 1 };
iov[0].iov_base = (char *)mid->resp_buf;
iov[0].iov_len = len;
@@ -840,7 +840,7 @@ smb2_setup_request(struct cifs_ses *ses, struct cifs_server_info *server,
{
int rc;
struct smb2_hdr *shdr =
- (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
+ (struct smb2_hdr *)rqst->iov[0].iov_base;
struct mid_q_entry *mid;
smb2_seq_num_into_buf(server, shdr);
@@ -866,7 +866,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
{
int rc;
struct smb2_hdr *shdr =
- (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
+ (struct smb2_hdr *)rqst->iov[0].iov_base;
struct mid_q_entry *mid;
spin_lock(&g_servers_lock);
diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
index f897af5d5fef..67852fa831c5 100644
--- a/fs/cifs/smbdirect.c
+++ b/fs/cifs/smbdirect.c
@@ -2025,17 +2025,17 @@ int smbd_send(struct cifs_server_info *server,
rqst_idx = 0;
next_rqst:
rqst = &rqst_array[rqst_idx];
- iov = rqst->rq_iov;
+ iov = rqst->iov;
cifs_dbg(FYI, "Sending smb (RDMA): idx=%d smb_len=%lu\n",
rqst_idx, smb_rqst_len(server, rqst));
- for (i = 0; i < rqst->rq_nvec; i++)
+ for (i = 0; i < rqst->nvec; i++)
dump_smb(iov[i].iov_base, iov[i].iov_len);
- log_write(INFO, "rqst_idx=%d nvec=%d rqst->rq_npages=%d rq_pagesz=%d rq_tailsz=%d buflen=%lu\n",
- rqst_idx, rqst->rq_nvec, rqst->rq_npages, rqst->rq_pagesz,
- rqst->rq_tailsz, smb_rqst_len(server, rqst));
+ log_write(INFO, "rqst_idx=%d nvec=%d rqst->npages=%d rq_pagesz=%d rq_tailsz=%d buflen=%lu\n",
+ rqst_idx, rqst->nvec, rqst->npages, rqst->pagesz,
+ rqst->tailsz, smb_rqst_len(server, rqst));
start = i = 0;
buflen = 0;
@@ -2080,14 +2080,14 @@ int smbd_send(struct cifs_server_info *server,
goto done;
}
i++;
- if (i == rqst->rq_nvec)
+ if (i == rqst->nvec)
break;
}
start = i;
buflen = 0;
} else {
i++;
- if (i == rqst->rq_nvec) {
+ if (i == rqst->nvec) {
/* send out all remaining vecs */
remaining_data_length -= buflen;
log_write(INFO, "sending iov[] from start=%d i=%d nvecs=%d remaining_data_length=%d\n",
@@ -2104,7 +2104,7 @@ int smbd_send(struct cifs_server_info *server,
}
/* now sending pages if there are any */
- for (i = 0; i < rqst->rq_npages; i++) {
+ for (i = 0; i < rqst->npages; i++) {
unsigned int offset;
rqst_page_get_length(rqst, i, &buflen, &offset);
@@ -2120,7 +2120,7 @@ int smbd_send(struct cifs_server_info *server,
i, j * max_iov_size + offset, size,
remaining_data_length);
rc = smbd_post_send_page(
- info, rqst->rq_pages[i],
+ info, rqst->pages[i],
j*max_iov_size + offset,
size, remaining_data_length);
if (rc)
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 0849f96ee580..a2d83952626e 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -264,12 +264,12 @@ smb_rqst_len(struct cifs_server_info *server, struct smb_rqst *rqst)
unsigned long buflen = 0;
if (server->vals->header_preamble_size == 0 &&
- rqst->rq_nvec >= 2 && rqst->rq_iov[0].iov_len == 4) {
- iov = &rqst->rq_iov[1];
- nvec = rqst->rq_nvec - 1;
+ rqst->nvec >= 2 && rqst->iov[0].iov_len == 4) {
+ iov = &rqst->iov[1];
+ nvec = rqst->nvec - 1;
} else {
- iov = rqst->rq_iov;
- nvec = rqst->rq_nvec;
+ iov = rqst->iov;
+ nvec = rqst->nvec;
}
/* total up iov array first */
@@ -282,17 +282,17 @@ smb_rqst_len(struct cifs_server_info *server, struct smb_rqst *rqst)
* multiple pages ends at page boundary, rq_tailsz needs to be set to
* PAGE_SIZE.
*/
- if (rqst->rq_npages) {
- if (rqst->rq_npages == 1)
- buflen += rqst->rq_tailsz;
+ if (rqst->npages) {
+ if (rqst->npages == 1)
+ buflen += rqst->tailsz;
else {
/*
* If there is more than one page, calculate the
* buffer length based on rq_offset and rq_tailsz
*/
- buflen += rqst->rq_pagesz * (rqst->rq_npages - 1) -
- rqst->rq_offset;
- buflen += rqst->rq_tailsz;
+ buflen += rqst->pagesz * (rqst->npages - 1) -
+ rqst->offset;
+ buflen += rqst->tailsz;
}
}
@@ -365,8 +365,8 @@ __smb_send_rqst(struct cifs_server_info *server, int num_rqst,
cifs_dbg(FYI, "Sending smb: smb_len=%u\n", send_length);
for (j = 0; j < num_rqst; j++) {
- iov = rqst[j].rq_iov;
- n_vec = rqst[j].rq_nvec;
+ iov = rqst[j].iov;
+ n_vec = rqst[j].nvec;
size = 0;
for (i = 0; i < n_vec; i++) {
@@ -383,10 +383,10 @@ __smb_send_rqst(struct cifs_server_info *server, int num_rqst,
total_len += sent;
/* now walk the page array and send each page in it */
- for (i = 0; i < rqst[j].rq_npages; i++) {
+ for (i = 0; i < rqst[j].npages; i++) {
struct bio_vec bvec;
- bvec.bv_page = rqst[j].rq_pages[i];
+ bvec.bv_page = rqst[j].pages[i];
rqst_page_get_length(&rqst[j], i, &bvec.bv_len,
&bvec.bv_offset);
@@ -473,8 +473,8 @@ smb_send_rqst(struct cifs_server_info *server, int num_rqst,
iov.iov_base = tr_hdr;
iov.iov_len = sizeof(*tr_hdr);
- cur_rqst[0].rq_iov = &iov;
- cur_rqst[0].rq_nvec = 1;
+ cur_rqst[0].iov = &iov;
+ cur_rqst[0].nvec = 1;
rc = server->ops->init_transform_rq(server, num_rqst + 1,
&cur_rqst[0], rqst);
@@ -493,8 +493,8 @@ smb_send(struct cifs_server_info *server, struct smb_hdr *smb_buffer,
unsigned int smb_buf_length)
{
struct kvec iov[2];
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = 2 };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = 2 };
iov[0].iov_base = smb_buffer;
iov[0].iov_len = 4;
@@ -771,11 +771,11 @@ struct mid_q_entry *
cifs_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
{
int rc;
- struct smb_hdr *hdr = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
+ struct smb_hdr *hdr = (struct smb_hdr *)rqst->iov[0].iov_base;
struct mid_q_entry *mid;
- if (rqst->rq_iov[0].iov_len != 4 ||
- rqst->rq_iov[0].iov_base + 4 != rqst->rq_iov[1].iov_base)
+ if (rqst->iov[0].iov_len != 4 ||
+ rqst->iov[0].iov_base + 4 != rqst->iov[1].iov_base)
return ERR_PTR(-EIO);
/* enable signing if server requires it */
@@ -961,8 +961,8 @@ cifs_check_receive(struct mid_q_entry *mid, struct cifs_server_info *server,
if (server->sign) {
struct kvec iov[2];
int rc = 0;
- struct smb_rqst rqst = { .rq_iov = iov,
- .rq_nvec = 2 };
+ struct smb_rqst rqst = { .iov = iov,
+ .nvec = 2 };
iov[0].iov_base = mid->resp_buf;
iov[0].iov_len = 4;
@@ -985,11 +985,11 @@ cifs_setup_request(struct cifs_ses *ses, struct cifs_server_info *ignored,
struct smb_rqst *rqst)
{
int rc;
- struct smb_hdr *hdr = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
+ struct smb_hdr *hdr = (struct smb_hdr *)rqst->iov[0].iov_base;
struct mid_q_entry *mid;
- if (rqst->rq_iov[0].iov_len != 4 ||
- rqst->rq_iov[0].iov_base + 4 != rqst->rq_iov[1].iov_base)
+ if (rqst->iov[0].iov_len != 4 ||
+ rqst->iov[0].iov_base + 4 != rqst->iov[1].iov_base)
return ERR_PTR(-EIO);
rc = allocate_mid(ses, hdr, &mid);
@@ -1191,7 +1191,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
spin_unlock(&g_servers_lock);
cifs_server_lock(server);
- smb311_update_preauth_hash(ses, server, rqst[0].rq_iov, rqst[0].rq_nvec);
+ smb311_update_preauth_hash(ses, server, rqst[0].iov, rqst[0].nvec);
cifs_server_unlock(server);
spin_lock(&g_servers_lock);
@@ -1327,8 +1327,8 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
new_iov[1].iov_len -= 4;
memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = new_iov;
- rqst.rq_nvec = n_vec + 1;
+ rqst.iov = new_iov;
+ rqst.nvec = n_vec + 1;
rc = cifs_send_recv(xid, ses, ses->server,
&rqst, resp_buf_type, flags, resp_iov);
@@ -1346,7 +1346,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
struct mid_q_entry *midQ;
unsigned int len = be32_to_cpu(in_buf->smb_buf_length);
struct kvec iov = { .iov_base = in_buf, .iov_len = len };
- struct smb_rqst rqst = { .rq_iov = &iov, .rq_nvec = 1 };
+ struct smb_rqst rqst = { .iov = &iov, .nvec = 1 };
struct cifs_credits credits = { .value = 1, .instance = 0 };
struct cifs_server_info *server;
@@ -1489,7 +1489,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_ses *ses;
unsigned int len = be32_to_cpu(in_buf->smb_buf_length);
struct kvec iov = { .iov_base = in_buf, .iov_len = len };
- struct smb_rqst rqst = { .rq_iov = &iov, .rq_nvec = 1 };
+ struct smb_rqst rqst = { .iov = &iov, .nvec = 1 };
unsigned int instance;
struct cifs_server_info *server;
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [RFC PATCH 07/14] cifs: typedef server status enum
2022-07-24 15:11 ` [RFC PATCH 07/14] cifs: typedef server status enum Enzo Matsumiya
@ 2022-07-25 5:31 ` Christoph Hellwig
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2022-07-25 5:31 UTC (permalink / raw)
To: Enzo Matsumiya; +Cc: linux-cifs, smfrench, pc, ronniesahlberg, nspmangalore
On Sun, Jul 24, 2022 at 12:11:30PM -0300, Enzo Matsumiya wrote:
> typedef "enum statusEnum" to "cifs_server_status_t".
> Rename the status values from CamelCase to snake_case.
Please don't use pointless typedefs for enum. They add no value
at all.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-07-25 5:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 02/14] cifs: rename xid/mid globals Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 03/14] cifs: rename global counters Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 06/14] cifs: convert server info vars to snake_case Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 07/14] cifs: typedef server status enum Enzo Matsumiya
2022-07-25 5:31 ` Christoph Hellwig
2022-07-24 15:11 ` [RFC PATCH 08/14] cifs: typedef ses " Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 09/14] cifs: typedef tcon " Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 10/14] cifs: typedef securityEnum Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 11/14] cifs: rename cifsFYI to debug_level Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 12/14] cifs: rename list_head fields Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 14/14] cifs: rename more list_heads, remove redundant prefixes Enzo Matsumiya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox