From patchwork Tue Apr 30 14:09:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13649308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70F7EC4345F for ; Tue, 30 Apr 2024 14:10:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5003D6B0099; Tue, 30 Apr 2024 10:10:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4134F6B00B6; Tue, 30 Apr 2024 10:10:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B3966B00C2; Tue, 30 Apr 2024 10:10:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0C14B6B0099 for ; Tue, 30 Apr 2024 10:10:07 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BEA8BA0829 for ; Tue, 30 Apr 2024 14:10:06 +0000 (UTC) X-FDA: 82066382412.18.D0FA538 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 17A0080014 for ; Tue, 30 Apr 2024 14:10:04 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=idY70WuG; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714486205; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rx29y3wht5apPqGuZYnZRRxzhBh5LDn/UDQzoEUVDzQ=; b=753B71tNX5csZggDaV3c84Sb/KdqN8+YBL/9V/BAsr77b+kkhD2yOSJLv3A5K0VwG76p8Q OgNaY4pFR+fzMw/mPqZHVGYo8DhlujxG8CovwgdETJoUGMmuTehxuysrzI3xjneaFr8viM w9db8ynLUane7xIFphpKP88cPb64jNs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714486205; a=rsa-sha256; cv=none; b=Oz3TDEDoeejD8s3piTkwaK4YUVgsElBg+YtcKOa7slDuM0dgFPc07je2VNyk7uVPMYCEIj MxIPQzEBtlUxbehpcCyzhAKgNkuVi2YiExWWGWXcr+/RBGyagUKZh06xUpon7DH795nI53 oQ+F4HtoOCqaH2b58HWZa+SLoZpBQzc= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=idY70WuG; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714486204; h=from:from:reply-to:subject:subject: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=rx29y3wht5apPqGuZYnZRRxzhBh5LDn/UDQzoEUVDzQ=; b=idY70WuGDLfOWwrGWh0JOFNJwfK9rbN4gP1ft2pyYULy/h3eLqvFkqZZ1Ead9KBmZV9fEY t7QUzu9odMZcxjJbyVSgc0JAN5TsggG1061tTO5OZnmQmmL+RnQW1VuRjHLlrwmD/wIXjE SvQ+YveCv6tSfSGL3xc4ds2hv/T+068= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-0ZBkhGgIPE2HLkFmUPugHQ-1; Tue, 30 Apr 2024 10:10:01 -0400 X-MC-Unique: 0ZBkhGgIPE2HLkFmUPugHQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D3851C03152; Tue, 30 Apr 2024 14:10:00 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C7831C0666B; Tue, 30 Apr 2024 14:09:58 +0000 (UTC) From: David Howells To: Steve French Cc: David Howells , Jeff Layton , Matthew Wilcox , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Christian Brauner , netfs@lists.linux.dev, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Steve French , Shyam Prasad N , Rohith Surabattula Subject: [PATCH v7 10/16] cifs: Make add_credits_and_wake_if() clear deducted credits Date: Tue, 30 Apr 2024 15:09:22 +0100 Message-ID: <20240430140930.262762-11-dhowells@redhat.com> In-Reply-To: <20240430140930.262762-1-dhowells@redhat.com> References: <20240430140930.262762-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 17A0080014 X-Stat-Signature: 48gdi5pssz7tuusrou9xmg8kzqjhqh3z X-Rspam-User: X-HE-Tag: 1714486204-492841 X-HE-Meta: U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Lby8N1Et8Pp9XzDUfsa7gcSuGJSc/8/ISFenQRBXpCk/pYJCu+CJkxs1i+tXOWV5TMOOp14Q3+5SEJATchVo/jfTH2UOkRK5Zkta8vt0uc7Rem0WZfpn/TXXnj2iM1UvRHGbZGVHUaBLnw7zK1MnfxP/vgyHmmxGOI0pA2+E6DWtbrvB2Pazct41GUNTNFTbPeZhFXHB+H4RYMrinkT9rAJr1F8FBI/sXI/bNPTkGFYwx7y4ZF6Xc7HMwSlE4ksG/kjTFCJ+FOWKIUtlf8IpKQ5wVJF8v3lzwg9Yi9REfyN0MBkPm7WbfTOyW/4P1TBiO86yxqz6tSt0aheSmEJ4lN0DWg3MMhEVsOxtg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Make add_credits_and_wake_if() clear the amount of credits in the cifs_credits struct after it has returned them to the overall counter. This allows add_credits_and_wake_if() to be called multiple times during the error handling and cleanup without accidentally returning the credits again and again. Note that the wake_up() in add_credits_and_wake_if() may also be superfluous as ->add_credits() also does a wake on the request_q. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/cifsglob.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 29c9ee2dd304..611f59c6d2c0 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -881,11 +881,12 @@ add_credits(struct TCP_Server_Info *server, const struct cifs_credits *credits, static inline void add_credits_and_wake_if(struct TCP_Server_Info *server, - const struct cifs_credits *credits, const int optype) + struct cifs_credits *credits, const int optype) { if (credits->value) { server->ops->add_credits(server, credits, optype); wake_up(&server->request_q); + credits->value = 0; } }