Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2066441lqa; Tue, 30 Apr 2024 07:23:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVInFmtvTg2d+Wu+kZHG7qfA1AGYrcH+nt9J6YF/ALX0s3ba6j4V0LnreCQbTXglUd5g1JyX0BuU/+wxfNULUotOWYcs+cIDZIOl9aPkw== X-Google-Smtp-Source: AGHT+IFt1Yvrr0gQ8TrE6sYqU/GBCCHIpddEu52+Q/i4t8xbU6f5jAhlj9MIJsZwsIcnf7Xfj7Ms X-Received: by 2002:ad4:5ec9:0:b0:6a0:d671:942 with SMTP id jm9-20020ad45ec9000000b006a0d6710942mr5880300qvb.4.1714486991252; Tue, 30 Apr 2024 07:23:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714486991; cv=pass; d=google.com; s=arc-20160816; b=v88iaoF56V5zTLaMvIkxjeL13Y2cBoVvyY9EpdodsDojaK8nRwnOUIHVzbWS7oEWXo vVKXT5lzLrCMxPDfhstpWEQGTbm3N2dWYKLYot6FN7Z9As3ctznAekZoKpp+LjB9Vfhi kbM4hi3oLb1aX08OJ6ROtSorq0MHldW7a++4Rg0viN4UowT9DrYYzjPiUx2EjdxNC74B s6QjpHOia/d2F1t/vM4F7YY1QqOSXMZQ+62x0cJgSPnlu/4T1lMg75sj0au2IZiuy1dc 9jUjo5rqfQktlBCQx6gXPPflHBIEunsAHMEJtnqxKBhuLv7JuTydrqtfg4nV7KOYHcLa IIeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rx29y3wht5apPqGuZYnZRRxzhBh5LDn/UDQzoEUVDzQ=; fh=YE7ofT3RvMl8X7BAHep3VPXZdXRMpsNOuSwI9MYxxVI=; b=jmQ+AVbCO80WHFHmbdlsRoQzFs7KvwObkFKb3HObSgJVNMd7IXYJL+zKKlcNSUtGur nBPvVQHXbMA1WIFBHcprkFOH+2TlBr3PLKM4Ei2mD141Fw+t3GqS9nFr9E11HT/0ML34 1HW7FZg6MdIcoOmzin/xtB6uzRwzMyYFkh6Weip+B2ggs8wK1l97SEaI0K8UNqtKxlB9 FKjxmde21cHEmuMT6lUvPdhUqcdltKuPbkqgbh4MwQpfrajSweKM+u+oJWtZ1xHf9HuC JQ+IbxdLv4omzGi1BAFPB3OGOYgvE3NimX2wUnqYeQ6uoXpOCd0krZDJ/s+sBmyzeL0A 8M5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UTjDsnLV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p12-20020ad45f4c000000b006a0d2b51578si3820083qvg.615.2024.04.30.07.23.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UTjDsnLV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F0E581C20B6A for ; Tue, 30 Apr 2024 14:23:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B0C4199EB1; Tue, 30 Apr 2024 14:10:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UTjDsnLV" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68308194C81 for ; Tue, 30 Apr 2024 14:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714486208; cv=none; b=HxfAu8QlFlwjrrPDpMbcNAIu/C064Lvi0PpalCvQQCoHN3f96UhlK00bGQ9kE0RyMB//ENqqaI73tSs+4uzS3y/OJbHvcIVOwW7qDI6CWezi6U5EM/dFnFUuKQBfZEA+mm//Sc5tXCcZlqE7nBUyvOUQ6V+aMl6m+pC8ayinSJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714486208; c=relaxed/simple; bh=wK/mkDwnXcFoN6Kk8jF+KKpRm6Qw7OPNAXKO72bPoec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NkylxWohEJ0Q5jinm4CS7U9s2qarfgKsgKpqX8JKxueZWthR05E6R8OAtGgPjwrTLVTYahQcgUvwXDQ1HTb1uC+KMcGWIEvdLV4zeg4avowuvBe9lj5Fu30uy4IqxV4/LtizLkwnBAmIuXBlnBBgcKllPTvvJofWXYu0C8jCUVE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UTjDsnLV; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714486206; 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=UTjDsnLVsKC8UhtejkYK/uIQja1q1P7d09XqLGzSOj78nQMz5E5UEv/MzjSSNgVOk88yg5 qev1M4HkfCWeg+391SnCX86AX82Bn4SB6XpQEtWqLDl/n2QaObDDUNb4Tq4XE4TBq55Zmc X/YtPyMPVFfsOOsaIX7jue39ktFI36w= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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; } }