From patchwork Mon Jul 25 22:36:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=yPAaIXNj; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zbTebH0M; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFML42NKz9sB4 for ; Tue, 26 Jul 2022 08:38:54 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237557AbiGYWiw (ORCPT ); Mon, 25 Jul 2022 18:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237471AbiGYWiL (ORCPT ); Mon, 25 Jul 2022 18:38:11 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C25F26555 for ; Mon, 25 Jul 2022 15:37:18 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2BB0E1F8AE; Mon, 25 Jul 2022 22:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OEIEzEZBJW+aB9sqJHK3NmqrMMnoSNw9AFBOl4ijsLs=; b=yPAaIXNj2TQUc4eX+aQSL/fNETtD9huRVngbWPezU+0ClSFAq/zbeP8jI3A1pwABAGGTx7 3wjhycgCXkuRZLk2dSa3s6Jh84tmduMhOZocVp2za8GZTCl7T4fwZw9dhi76IlE0TE5ajP lleiwa64vWamOKc53NDoZBX/1o9P198= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OEIEzEZBJW+aB9sqJHK3NmqrMMnoSNw9AFBOl4ijsLs=; b=zbTebH0Ml61hswXQ+zx6ePzymcTPiOPX9/QyzMM9GeyTbdI3inWDlXQ4IzZo5fWA3IORcM ZZVBSqvYOMhm7EDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A068613ABB; Mon, 25 Jul 2022 22:37:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oJwBGRwb32LrRgAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:16 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 01/10] cifs: rename xid/mid globals Date: Mon, 25 Jul 2022 19:36:58 -0300 Message-Id: <20220725223707.14477-2-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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. */ From patchwork Mon Jul 25 22:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=gWcDNwxa; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=bMRv45mI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFMN0mQJz9sB4 for ; Tue, 26 Jul 2022 08:38:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237568AbiGYWiy (ORCPT ); Mon, 25 Jul 2022 18:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237490AbiGYWiM (ORCPT ); Mon, 25 Jul 2022 18:38:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17942656C for ; Mon, 25 Jul 2022 15:37:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7E2081F8B0; Mon, 25 Jul 2022 22:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6tCwV//znBbsqXb2i3RHe9yoe7AotvDK9CfvlqjidyE=; b=gWcDNwxav6cLFUBClOxKewhWzbBGWS6O2oVLFWddzkcH3p6hJNPf4iqiGxz1llgftfkdR8 yKL0mFwsNGpKB/mDPCeC3aIHlTfQ3ZQ5LX+PAxXLMxNWDm7/mgdaGl2Hhx0E66eV7DFUPf QH6WnAOKbUiWOof0corRGfp09NXfznM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6tCwV//znBbsqXb2i3RHe9yoe7AotvDK9CfvlqjidyE=; b=bMRv45mINXZ4c04HchA6uuRxLGPUpO8cz8pxH6VRoR7sErAM9rI+g2ZbJz2HhStPXhHFLo 4t0BAGDlr37HKJDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 00F5713ABB; Mon, 25 Jul 2022 22:37:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LfGDLR8b32LwRgAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:19 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 02/10] cifs: rename global counters Date: Mon, 25 Jul 2022 19:36:59 -0300 Message-Id: <20220725223707.14477-3-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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 From patchwork Mon Jul 25 22:37:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=QDj0pj3T; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=AYwds022; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFMm0PfBz9sFw for ; Tue, 26 Jul 2022 08:39:16 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237525AbiGYWjN (ORCPT ); Mon, 25 Jul 2022 18:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237381AbiGYWiQ (ORCPT ); Mon, 25 Jul 2022 18:38:16 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B43C26AE3 for ; Mon, 25 Jul 2022 15:37:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5F5CB3371E; Mon, 25 Jul 2022 22:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788652; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dUcksyW6KX9DHhvFx56b1YxkPMLbPrdRp10hZO6JiVU=; b=QDj0pj3TdX5Rh/T6ahOKE6rAtQPXc0xmo9AjeSfFFfOIfDmncpNpnOQG2o2RDCykeGA5Lh IXmuV8rOnAIgXeKmW5kEVd0k15TBIHX/zPs94h8PpqEWJyh63le5XyJsjMWMe/tujslKZN u5fj8CLBg8L37qAk7EwXbpUnYoYnv1U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788652; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dUcksyW6KX9DHhvFx56b1YxkPMLbPrdRp10hZO6JiVU=; b=AYwds0225ju6FmwgsI7RGg5hUe6ljIqJe0pJgiN1nT6+RwjqWH11FpO3ir33mk/fuiyShx 0TtaXBVREegZ8kBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 960C513ABB; Mon, 25 Jul 2022 22:37:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vjcvFisb32IGRwAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:31 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 05/10] cifs: convert server info vars to snake_case Date: Mon, 25 Jul 2022 19:37:02 -0300 Message-Id: <20220725223707.14477-6-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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; } From patchwork Mon Jul 25 22:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=pGE3sQZa; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=FYILGZ1y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFNP6wtmz9sFw for ; Tue, 26 Jul 2022 08:39:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237400AbiGYWjp (ORCPT ); Mon, 25 Jul 2022 18:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbiGYWiv (ORCPT ); Mon, 25 Jul 2022 18:38:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C53125E85 for ; Mon, 25 Jul 2022 15:37:46 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E5E1833720; Mon, 25 Jul 2022 22:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788655; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/AgmEBwMB0YI0m6pMmhNmtUN3FAVVIbWbQ6ld01vKtM=; b=pGE3sQZasxp5KZgCPCkr8V6prldNdYOdOk1LVX09FyP9N5YYDKjlrXiw4TrJ4P6tdH4itH zIXPiqnw8KPKF37rjM63T1lLOhEx6ADQXPM3WfTb752pceDr2wni6kBCjkgaYeyuKIWtaV qxROJvqm3XeI02YLfoqBbVFxSzAd8W4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788655; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/AgmEBwMB0YI0m6pMmhNmtUN3FAVVIbWbQ6ld01vKtM=; b=FYILGZ1y/vpVldx4+NTyjGQj+tGFGYe2CSnitdJ+p1e3oXR+UjP0bFSxUXk7urPAw6VI3b TRp29Vy1DU9JocBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2E05B13ABB; Mon, 25 Jul 2022 22:37:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id urLHOC4b32IORwAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:34 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 06/10] cifs: change status and security types enums to constants Date: Mon, 25 Jul 2022 19:37:03 -0300 Message-Id: <20220725223707.14477-7-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Change server, tcon, and session status, and security types enums to constants integers. Since some of the status values were common between server, tcon, and session, define a "generic" status code instead of having specific enums for each data structure. Signed-off-by: Enzo Matsumiya --- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifs_swn.c | 8 +-- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsfs.c | 14 ++-- fs/cifs/cifsglob.h | 82 +++++++++-------------- fs/cifs/cifsproto.h | 6 +- fs/cifs/cifssmb.c | 26 ++++---- fs/cifs/connect.c | 144 ++++++++++++++++++++-------------------- fs/cifs/fs_context.c | 8 +-- fs/cifs/fs_context.h | 2 +- fs/cifs/misc.c | 4 +- fs/cifs/sess.c | 32 ++++----- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 8 +-- fs/cifs/smb2pdu.c | 44 ++++++------ fs/cifs/smb2proto.h | 4 +- fs/cifs/smb2transport.c | 12 ++-- fs/cifs/transport.c | 24 +++---- 18 files changed, 203 insertions(+), 223 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/cifs_swn.c b/fs/cifs/cifs_swn.c index 1e4c7cc5287f..b85da1e0648d 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; + int 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/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 7d8020b90220..a5d6f0def82a 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 == CIFS_STATUS_NEED_NEGOTIATE) { spin_unlock(&g_servers_lock); return rc; } diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6db4b008dbb1..59e2966b3594 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)); } @@ -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 == CIFS_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 = CIFS_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 12b6aafa5fa6..c02be7cafa62 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -25,6 +25,7 @@ #include #include "../smbfs_common/smb2pdu.h" #include "smb2pdu.h" +#include "cifspdu.h" #define SMB_PATH_MAX 260 #define CIFS_PORT 445 @@ -107,46 +108,27 @@ #define CIFS_MAX_WORKSTATION_LEN (__NEW_UTS_LEN + 1) /* reasonable max for client */ /* - * CIFS vfs client Status information (based on what we know.) + * Status information */ +#define CIFS_STATUS_NEW 0x0 /* server, ses, tcon */ +#define CIFS_STATUS_GOOD 0x1 /* server, ses, tcon */ +#define CIFS_STATUS_EXITING 0x2 /* server, ses, tcon */ +#define CIFS_STATUS_NEED_RECONNECT 0x3 /* server, ses, tcon */ +#define CIFS_STATUS_NEED_NEGOTIATE 0x4 /* server */ +#define CIFS_STATUS_NEED_TCON 0x5 /* tcon */ +#define CIFS_STATUS_IN_NEGOTIATE 0x6 /* server */ +#define CIFS_STATUS_IN_SETUP 0x7 /* ses */ +#define CIFS_STATUS_IN_TCON 0x8 /* tcon */ +#define CIFS_STATUS_NEED_FILES_INVALIDATE 0x9 /* ses */ +#define CIFS_STATUS_IN_FILES_INVALIDATE 0xa /* ses */ -/* associated with each connection */ -enum statusEnum { - CifsNew = 0, - CifsGood, - CifsExiting, - CifsNeedReconnect, - CifsNeedNegotiate, - CifsInNegotiate, -}; - -/* associated with each smb session */ -enum ses_status_enum { - SES_NEW = 0, - SES_GOOD, - SES_EXITING, - SES_NEED_RECON, - SES_IN_SETUP -}; - -/* 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 -}; - -enum securityEnum { - Unspecified = 0, /* not specified */ - NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */ - RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */ - Kerberos, /* Kerberos via SPNEGO */ -}; +/* + * Security types + */ +#define CIFS_SECTYPE_UNSPEC 0x0 /* not specified */ +#define CIFS_SECTYPE_NTLMV2 0x1 /* Legacy NTLM auth with NTLMv2 hash */ +#define CIFS_SECTYPE_RAW_NTLMSSP 0x2 /* NTLMSSP without SPNEGO, NTLMv2 hash */ +#define CIFS_SECTYPE_KERBEROS 0x3 /* Kerberos via SPNEGO */ struct session_key { unsigned int len; @@ -506,8 +488,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); + int (*select_sectype)(struct cifs_server_info *, + int); int (*next_header)(char *); /* ioctl passthrough for query_info */ int (*ioctl_query_info)(const unsigned int xid, @@ -612,7 +594,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 */ + int status; /* what we think the status is */ char *hostname; /* hostname portion of UNC string */ struct socket *ssocket; struct sockaddr_storage dstaddr; @@ -1011,7 +993,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 */ + int 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 */ @@ -1028,7 +1010,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? */ + int sectype; /* what security flavor was specified? */ bool sign; /* is signing required? */ bool domainAuto:1; __u16 session_flags; @@ -1179,7 +1161,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; + int status; atomic_t num_smbs_sent; union { struct { @@ -1948,7 +1930,7 @@ extern struct list_head g_servers_list; * 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 cifs_server_info struct such as dstaddr. Finally, - * changes to the tcon->tidStatus should be done while holding this lock. + * changes to the tcon->status 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 * structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file @@ -2041,14 +2023,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(int 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..5b08e74d7307 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -168,8 +168,7 @@ 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 int select_sectype(struct cifs_server_info *server, int 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 +593,7 @@ 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); +int cifs_select_sectype(struct cifs_server_info *, int); 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 326db1db353e..4bdd1f8b4634 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -75,11 +75,11 @@ 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 != CIFS_STATUS_GOOD) || (tcon->status != CIFS_STATUS_NEED_RECONNECT)) { spin_unlock(&g_servers_lock); return; } - tcon->status = TID_IN_FILES_INVALIDATE; + tcon->status = CIFS_STATUS_IN_FILES_INVALIDATE; spin_unlock(&g_servers_lock); /* list all files open on tree connection and mark them invalid */ @@ -99,8 +99,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 == CIFS_STATUS_IN_FILES_INVALIDATE) + tcon->status = CIFS_STATUS_NEED_TCON; spin_unlock(&g_servers_lock); /* @@ -135,7 +135,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 == CIFS_STATUS_EXITING) { if (smb_command != SMB_COM_WRITE_ANDX && smb_command != SMB_COM_OPEN_ANDX && smb_command != SMB_COM_TREE_DISCONNECT) { @@ -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 == CIFS_STATUS_NEED_RECONNECT) { rc = wait_event_interruptible_timeout(server->response_q, - (server->status != CifsNeedReconnect), + (server->status != CIFS_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 != CIFS_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 == CIFS_STATUS_NEED_RECONNECT) { spin_unlock(&g_servers_lock); rc = -EHOSTDOWN; goto out; @@ -504,13 +504,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(int 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 4ab1933fca76..fc777c6b7a3e 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 = CIFS_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 = CIFS_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 CIFS_STATUS_NEED_RECONNECT. * @mark_smb_session: whether even sessions need to be marked */ void @@ -277,11 +277,11 @@ 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 = CIFS_STATUS_NEED_RECONNECT; list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { tcon->need_reconnect = true; - tcon->status = TID_NEED_RECON; + tcon->status = CIFS_STATUS_NEED_RECONNECT; } if (ses->tcon_ipc) ses->tcon_ipc->need_reconnect = true; @@ -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 == CIFS_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 = CIFS_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 != CIFS_STATUS_EXITING) + server->status = CIFS_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 == CIFS_STATUS_NEED_RECONNECT); spin_lock(&g_servers_lock); - if (server->status == CifsNeedNegotiate) + if (server->status == CIFS_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 CIFS_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 != CIFS_STATUS_EXITING) + server->status = CIFS_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 == CIFS_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 == CIFS_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 == CIFS_STATUS_NEED_RECONNECT || + server->status == CIFS_STATUS_EXITING || + server->status == CIFS_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 == CIFS_STATUS_GOOD || + server->status == CIFS_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 == CIFS_STATUS_EXITING) { spin_unlock(&g_servers_lock); return -ESHUTDOWN; } - if (server->status == CifsNeedReconnect) { + if (server->status == CIFS_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. + * CIFS_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 = CIFS_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 != CIFS_STATUS_EXITING) { if (try_to_freeze()) continue; @@ -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; /* @@ -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 = CIFS_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 = CIFS_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 = CIFS_STATUS_NEED_NEGOTIATE; spin_unlock(&g_servers_lock); if ((ctx->max_credits < 20) || (ctx->max_credits > 60000)) @@ -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; @@ -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 == CIFS_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 == CIFS_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 == CIFS_STATUS_GOOD) + ses->status = CIFS_STATUS_EXITING; spin_unlock(&g_servers_lock); cifs_free_ipc(ses); - if (ses->ses_status == SES_EXITING && server->ops->logoff) { + if (ses->status == CIFS_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)) { @@ -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 == CIFS_STATUS_EXITING) return 0; if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE)) return 0; @@ -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 == CIFS_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 != CIFS_STATUS_NEED_NEGOTIATE) { spin_unlock(&g_servers_lock); return 0; } - server->status = CifsInNegotiate; + server->status = CIFS_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 == CIFS_STATUS_IN_NEGOTIATE) + server->status = CIFS_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 == CIFS_STATUS_IN_NEGOTIATE) + server->status = CIFS_STATUS_NEED_NEGOTIATE; spin_unlock(&g_servers_lock); } @@ -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 != CIFS_STATUS_GOOD && + ses->status != CIFS_STATUS_NEW && + ses->status != CIFS_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 = CIFS_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 == CIFS_STATUS_IN_SETUP) + ses->status = CIFS_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 == CIFS_STATUS_IN_SETUP) + ses->status = CIFS_STATUS_GOOD; spin_lock(&ses->chan_lock); cifs_chan_clear_in_reconnect(ses, server); cifs_chan_clear_need_reconnect(ses, server); @@ -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); @@ -4559,13 +4559,13 @@ 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 || - (tcon->status != TID_NEW && - tcon->status != TID_NEED_TCON)) { + if (tcon->ses->status != CIFS_STATUS_GOOD || + (tcon->status != CIFS_STATUS_NEW && + tcon->status != CIFS_STATUS_NEED_TCON)) { spin_unlock(&g_servers_lock); return 0; } - tcon->status = TID_IN_TCON; + tcon->status = CIFS_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 == CIFS_STATUS_IN_TCON) + tcon->status = CIFS_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 == CIFS_STATUS_IN_TCON) + tcon->status = CIFS_STATUS_GOOD; spin_unlock(&g_servers_lock); tcon->need_reconnect = false; } @@ -4627,25 +4627,25 @@ 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 || - (tcon->status != TID_NEW && - tcon->status != TID_NEED_TCON)) { + if (tcon->ses->status != CIFS_STATUS_GOOD || + (tcon->status != CIFS_STATUS_NEW && + tcon->status != CIFS_STATUS_NEED_TCON)) { spin_unlock(&g_servers_lock); return 0; } - tcon->status = TID_IN_TCON; + tcon->status = CIFS_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 == CIFS_STATUS_IN_TCON) + tcon->status = CIFS_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 == CIFS_STATUS_IN_TCON) + tcon->status = CIFS_STATUS_GOOD; spin_unlock(&g_servers_lock); tcon->need_reconnect = false; } diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index 8dc0d923ef6a..e9de045b97a6 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..b9cf73bdbe81 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 */ + int 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/misc.c b/fs/cifs/misc.c index a31780cf6d21..0773b5a2ddb7 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 = CIFS_STATUS_NEW; ++ret_buf->ses_count; INIT_LIST_HEAD(&ret_buf->smb_ses_list); INIT_LIST_HEAD(&ret_buf->tcon_list); @@ -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 = CIFS_STATUS_NEW; ++ret_buf->tc_count; INIT_LIST_HEAD(&ret_buf->openFileList); INIT_LIST_HEAD(&ret_buf->tcon_list); diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 2584b150a648..31c81bf96b13 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) +int +cifs_select_sectype(struct cifs_server_info *server, int 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/smb1ops.c b/fs/cifs/smb1ops.c index 8b2a504c92f1..e184f1806e26 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 == CIFS_STATUS_GOOD) return true; return false; diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 41d1237bb24c..f10a8eab3ffb 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 == CIFS_STATUS_NEED_RECONNECT + || server->status == CIFS_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 == CIFS_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 == CIFS_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..72978655d2c3 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 == CIFS_STATUS_EXITING) { /* * only tree disconnect, open, and write, * (and ulogoff which does not have tcon) @@ -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 == CIFS_STATUS_EXITING) || (!tcon->ses->server) || !server) return -EIO; @@ -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 == CIFS_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 != CIFS_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 != CIFS_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 == CIFS_STATUS_NEED_RECONNECT) { spin_unlock(&g_servers_lock); rc = -EHOSTDOWN; goto out; @@ -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) +int +smb2_select_sectype(struct cifs_server_info *server, int 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)); @@ -3873,7 +3873,7 @@ void smb2_reconnect_server(struct work_struct *work) goto done; } - tcon->status = TID_GOOD; + tcon->status = CIFS_STATUS_GOOD; tcon->retry = false; tcon->need_reconnect = false; diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 8ae83ce0083d..e164e1ff2ee2 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 int smb2_select_sectype(struct cifs_server_info *, + int); extern void smb2_parse_contexts(struct cifs_server_info *server, struct smb2_create_rsp *rsp, unsigned int *epoch, char *lease_key, diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c index 4417953ecbb2..816c764a5bd4 100644 --- a/fs/cifs/smb2transport.c +++ b/fs/cifs/smb2transport.c @@ -763,24 +763,24 @@ 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 == CIFS_STATUS_EXITING) { spin_unlock(&g_servers_lock); return -ENOENT; } - if (server->status == CifsNeedReconnect) { + if (server->status == CIFS_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 == CIFS_STATUS_NEED_NEGOTIATE && shdr->Command != SMB2_NEGOTIATE) { spin_unlock(&g_servers_lock); return -EAGAIN; } - if (ses->ses_status == SES_NEW) { + if (ses->status == CIFS_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 == CIFS_STATUS_EXITING) { if (shdr->Command != SMB2_LOGOFF) { 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 == CIFS_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..81022ef20d62 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 == CIFS_STATUS_EXITING) { spin_unlock(&g_servers_lock); return -ENOENT; } @@ -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 == CIFS_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 == CIFS_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); @@ -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 == CIFS_STATUS_EXITING) { spin_unlock(&g_servers_lock); return -ENOENT; } @@ -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 == CIFS_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 == CIFS_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 @@ -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 == CIFS_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 == CIFS_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 != CIFS_STATUS_GOOD) && + (server->status != CIFS_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 == CIFS_STATUS_GOOD) || + (server->status == CIFS_STATUS_NEW))) { spin_unlock(&g_servers_lock); if (in_buf->Command == SMB_COM_TRANSACTION2) { From patchwork Mon Jul 25 22:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=1qX1enfV; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7Mv343Wp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFNQ29svz9sFx for ; Tue, 26 Jul 2022 08:39:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237374AbiGYWjs (ORCPT ); Mon, 25 Jul 2022 18:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237069AbiGYWix (ORCPT ); Mon, 25 Jul 2022 18:38:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBEF825E9B for ; Mon, 25 Jul 2022 15:37:48 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6DB6D33723; Mon, 25 Jul 2022 22:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DP4QZkOhtU8XxHwvbh9ePKo7uaBAAce3lxZP2/pRT2A=; b=1qX1enfV72bEzHXWWAXXv+LH+McVPKs+7eNPMkEh3gVZCGf2KIkHUkcXW+bs0F5n4pe/aF yCy/p4m2PqUf7jo0TbMKmRb9HH6WkREaBKmHvmSXrokuqixrj98vs/3VilZVQ0cFRwdeRy 7Mf4PE+4EifZyzv9iUgIBp/l7jcjaQ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DP4QZkOhtU8XxHwvbh9ePKo7uaBAAce3lxZP2/pRT2A=; b=7Mv343Wp5xR9iAz1/Sf5H8gDh8p3ZbtxS8f+sL3at+9WLXAyZ+30/qSn+TEyX3gHguwA+j v+dywfvqQv2QGLAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DD47F13ABB; Mon, 25 Jul 2022 22:37:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 72bFJjIb32ISRwAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:38 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 07/10] cifs: rename cifsFYI to debug_level Date: Mon, 25 Jul 2022 19:37:04 -0300 Message-Id: <20220725223707.14477-8-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Rename "cifsFYI" to "debug_level" to add more meaning to it. Signed-off-by: Enzo Matsumiya --- 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 59e2966b3594..8017198c4a35 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 81022ef20d62..98a40615c871 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", From patchwork Mon Jul 25 22:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Rslc7af5; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=WS6Ykuqy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFNT3nHbz9sB4 for ; Tue, 26 Jul 2022 08:39:53 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237493AbiGYWjv (ORCPT ); Mon, 25 Jul 2022 18:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237574AbiGYWiz (ORCPT ); Mon, 25 Jul 2022 18:38:55 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E9C026AFB for ; Mon, 25 Jul 2022 15:37:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2543C1F88B; Mon, 25 Jul 2022 22:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788663; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xSBYP/sMpzYim3sO0WEXVVdO36SdgCem460yJY/eVTo=; b=Rslc7af5XxSAzZWZFw9LDP7pIjdx4g3MWM0zRpgsM3Zr1IclxI2OciJ8koHkLG/Ff1R/mu uZwl55bwr7t8cop5O7/0gshy/8bo60ox71htz/rJfqYpqpIXaQxpySkryLMjTQ5iuZv96U mVnP2IF3oNY3XvK/1vHo1EXBl8YFf+s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788663; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xSBYP/sMpzYim3sO0WEXVVdO36SdgCem460yJY/eVTo=; b=WS6YkuqypQQzUElnXvK8LypY+VcLpFn+pl7N36/F/RZwH2rYiwDmpA8u9uuaPA4SZ9Slim e86leSL8JHNeOKAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3211413ABB; Mon, 25 Jul 2022 22:37:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vewiOjUb32IYRwAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:41 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 08/10] cifs: rename list_head fields Date: Mon, 25 Jul 2022 19:37:05 -0300 Message-Id: <20220725223707.14477-9-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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, " \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 8017198c4a35..71f0c0d58591 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 c02be7cafa62..d3dcc8e42772 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -585,8 +585,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 */ @@ -918,7 +918,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; @@ -934,7 +934,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); } @@ -986,7 +986,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; @@ -1108,7 +1108,7 @@ struct cifs_fattr { }; struct cached_dirent { - struct list_head entry; + struct list_head head; char *name; int namelen; loff_t pos; @@ -1148,13 +1148,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; @@ -1292,14 +1292,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; @@ -1307,11 +1307,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; @@ -1369,27 +1369,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 */ @@ -1417,7 +1417,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; @@ -1440,7 +1440,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; @@ -1473,7 +1473,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; @@ -1528,7 +1528,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() @@ -1536,8 +1536,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 */ @@ -1658,7 +1658,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 */ @@ -1894,14 +1894,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 * ---------- @@ -1932,7 +1932,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->status 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 4bdd1f8b4634..5a7fa93586d1 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -83,13 +83,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; @@ -2079,7 +2079,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 fc777c6b7a3e..53cec7d6ac5b 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 = CIFS_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 = CIFS_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 = CIFS_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 == CIFS_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 0773b5a2ddb7..e7f9893680e4 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 = CIFS_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 = CIFS_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 31c81bf96b13..62160ef18a02 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 e184f1806e26..cbec68d6bc0d 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 f10a8eab3ffb..ab256573a704 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 72978655d2c3..f48013c60ef2 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 816c764a5bd4..883796ab371b 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 98a40615c871..5139124ea1c3 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", From patchwork Mon Jul 25 22:37:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enzo Matsumiya X-Patchwork-Id: 1660525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=pk+PuRb6; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=L/MQeFgj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LsFP06bS9z9sB4 for ; Tue, 26 Jul 2022 08:40:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237675AbiGYWkT (ORCPT ); Mon, 25 Jul 2022 18:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237598AbiGYWjJ (ORCPT ); Mon, 25 Jul 2022 18:39:09 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 035EE27146 for ; Mon, 25 Jul 2022 15:37:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 14EAD3372F; Mon, 25 Jul 2022 22:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658788671; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oOoRom6Jn/gJAAqGRppkkx6XlBwmTa0tIs4P/Wanf7Q=; b=pk+PuRb6jYP3BY7u+k8I9ZFTfMN1y1kRmo6sJMDORbXAyFtbei8XZeVwYLrMn5Y/vKwSDD PRO9KEv8dEpZwEPUBi7bp9ui19MUK5InbSN2Q4u03NgHCz4s7kTdjBOpTHr3ZwYi0MEKD0 4g3ajQ3eU+WkY2KSwp0stGbMbg6esnk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658788671; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oOoRom6Jn/gJAAqGRppkkx6XlBwmTa0tIs4P/Wanf7Q=; b=L/MQeFgjZd5ihpJB3TX2S6v1yz00/f0QAZ63ZaxH2VYtHfN1gfAfLbTDeh7jRUz5bzeHc3 cJeRjsa1Oo3NLMBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1BFD313ABB; Mon, 25 Jul 2022 22:37:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id z2+YND0b32ImRwAAMHmgww (envelope-from ); Mon, 25 Jul 2022 22:37:49 +0000 From: Enzo Matsumiya To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com, nspmangalore@gmail.com Subject: [RFC PATCH v2 10/10] cifs: rename more list_heads, remove redundant prefixes Date: Mon, 25 Jul 2022 19:37:07 -0300 Message-Id: <20220725223707.14477-11-ematsumiya@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220725223707.14477-1-ematsumiya@suse.de> References: <20220725223707.14477-1-ematsumiya@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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 5bb890962afe..d300d913ac86 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 435fd48f1561..45744d4f7289 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -190,13 +190,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 d3ac8b3b6b53..37a07d18b60c 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -694,8 +694,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"); @@ -1563,13 +1563,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", @@ -1619,8 +1619,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); @@ -2183,13 +2183,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 633e1bb4ffd2..450daeaa1714 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 == CIFS_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 #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 295e5cd4aaf6..47eb0c193b67 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 aa151a5ef8ab..8c3e1c8be8f5 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 97f29b691a23..a3e3c0909d0f 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 73a606117160..731e93d2cd3f 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 2d9eee830732..9a21f9b110dd 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 4a3b2aa8c24d..a87eae6ac299 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;