From patchwork Thu Mar 28 16:58:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13609179 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 2F078CD1283 for ; Thu, 28 Mar 2024 17:00:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3BDC6B00D4; Thu, 28 Mar 2024 13:00:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AEB806B00D5; Thu, 28 Mar 2024 13:00:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B38E6B00D6; Thu, 28 Mar 2024 13:00:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7B2B36B00D4 for ; Thu, 28 Mar 2024 13:00:16 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 48F691A022B for ; Thu, 28 Mar 2024 17:00:16 +0000 (UTC) X-FDA: 81947060832.25.0E336B7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 626931C000B for ; Thu, 28 Mar 2024 17:00:14 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZrkXxdgD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1711645214; 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=CntTp3Jyu1WRS7BeCEXY9WjviKzEFkeTql7WaUHGCEY=; b=Q0gEDorBHqqScuKwMCWy9n1OaTT5UOy5KpKuymXrDxhYyfVgbRm9CbIfRZvpJXjNxviQsP uFb8VVtL/DV6Qa9zSA7S0YzWirbIMQkTWHsR07CYA/04L5SIljRVOO2Z2U0w+qBk0dVVQH dXzW8BSh87SvPwTBEZs/NlwWNsJD/C0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZrkXxdgD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711645214; a=rsa-sha256; cv=none; b=EhNLmzviwl2JNmQUfjTJ6e2JWn/Cx/3WlvO7ZZOLtFtq68hczoHLhwRu0DyDMSYZP5FrSZ lXO9N6AIZhIk9y7Qrjhz4GkMiWZJ51aPUpus2hr80KVJbdNBONDlWgG+re2TOdZ2MdeQ8I wSEAZQtslDE2OiCbY7vagy57uWkqevM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711645213; 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=CntTp3Jyu1WRS7BeCEXY9WjviKzEFkeTql7WaUHGCEY=; b=ZrkXxdgDwNGfSE37YOwudII2+JPvp0rZPONs3i/QD/mVZpmTB2dGOwBNW1NlMD1ZGWIorO GCWnBfBEui3bjFWGcHQn/1tXnfx94zqTujuW6XTfZOzl3ReNPUe9z+kawYwz0dKcVHpQwy 0Eq868dUKsp+JxftJ0LG4RNc0mgkDUg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-WeYapp8YNLeeFBVwym_fhQ-1; Thu, 28 Mar 2024 13:00:06 -0400 X-MC-Unique: WeYapp8YNLeeFBVwym_fhQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 68888101A56C; Thu, 28 Mar 2024 17:00:05 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8565E1121306; Thu, 28 Mar 2024 17:00:03 +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, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French , Shyam Prasad N , Rohith Surabattula Subject: [PATCH v6 09/15] cifs: Make add_credits_and_wake_if() clear deducted credits Date: Thu, 28 Mar 2024 16:58:00 +0000 Message-ID: <20240328165845.2782259-10-dhowells@redhat.com> In-Reply-To: <20240328165845.2782259-1-dhowells@redhat.com> References: <20240328165845.2782259-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspam-User: X-Stat-Signature: yzrgih33ji6gnnh6bia4sfwop6ehkz4n X-Rspamd-Server: rspam07 X-Rspamd-Queue-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MOm8Kns0TuRED9pKC45anDh6xmitjdnMCxXDFHUAz8wmJ1B7T3Nl+3fwopoDMjeUYVjDVVJbwse9zfkO1dOXJ6MvesqOOiKGEghiQVnA6mTWfQA2DFXdSjTZVeRh+YtsYurO/tJBxlXf+TSz+cWcZdc3J/CFO9i5WyW5ya9/yq4k9c/EU1E1i4w8kWDJ6fJXYJ+v6Ri8cBEMbTlo+d8UxIiHR1yWtK2+JPTSuH1uRl05OKL6k9hzeXAtpyOnP+ASlMAWTmhQUQ5ZSi7j61UDGPTaOLRo7c0FawWDcwkucdwGZN678xuTVOVBdeAQOhHlrrsKj3sP7bXeTN/gLWfCsdh6iMjtOOM3Xi6h1VqPP6LxQSHmTUbAe7d7Ti8IEh7DqfSZT9nH83eCZRw== 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 057a7933b175..704f526a9e81 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; } }