Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp591981lqh; Thu, 28 Mar 2024 10:17:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXaDtPxoQkFNolTu+ECDQJOIaI39cHPU1gFD8Sd4ahzHQ3OUEkh4g4OkhDWFaeW9s9qlifmhxy5BTXpCGXY58FVHItsxEUFL+EPwKMAwQ== X-Google-Smtp-Source: AGHT+IHuYppYCDh1ucx+xTZdXR6ZcASs/PyKkPHiecLuNuK1j099WIw0Poyle8egvm9qaqBigvNV X-Received: by 2002:a17:902:cecc:b0:1e0:a22a:623e with SMTP id d12-20020a170902cecc00b001e0a22a623emr114652plg.21.1711646234182; Thu, 28 Mar 2024 10:17:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711646234; cv=pass; d=google.com; s=arc-20160816; b=Ouk6QvC6VF1mRFdPF95xgatb9eCtlsBF1XRY17iQUvlXVZe+/EmCwGe6c5LRBJjTZm 8+/e0ivzbI6BjDXAQeIIBUMs+j7XOjbH9JKm4XX1jvLd1K6LHt4/VwGrt6m4TIjgmomA +0/4MTjYNiX7QNI3E23ux6BaAAeFM8SB7QnhvqJXmlq7x+VxzvdvC34nQ2DiNtJGXpDR amhnxPSqsbkbxD2+1y8urSIw74SW5XtjzFxy5P6nJyC5rCp+UAI329f4SqA47UWbnVqK CZWc1pOFZ+r2d2H1nn3wZfAteXxSa40Qjr6vu/q0rwxZmdmF8CMepyx71SKl21ruDPYV hfvw== 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=CntTp3Jyu1WRS7BeCEXY9WjviKzEFkeTql7WaUHGCEY=; fh=qGO61KcqD8nwg5doI1799cWr3E7eI1fHmScYq/qreMg=; b=pt5kgNJlTn9U4Q6L/qTa+U1R0ZxvVSrwsWGkjBcW0GNq+83bzQKTTE9rEMdZVwR1mb JEEa7Yqr1b2dfhn1P9XHtKr2HfgnEe906emIZkM/8LExT+V2UVg/gt+4INFP0+Hog9mv Nfvv+25jUK7uW/isHBei9+nJ26GlgDkU+i7+M3ecjrT8vyoMN6T4Secs3vwVKK6ZP2G5 QmDDuUWkMzTmjrjVBPeC8rO0Xsz706V+6nUbi3fURxpvjd/c5Q8R9ySNU8uf8fPKFsRt zCuqETOBSZrXYZQ/2uoOWQIUWfFpTWwGEtEeBCGIMeJg8FUAM+yD4bZ0Mf7GKTv3LH6z uWUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZrkXxdgD; 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-123326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y23-20020a17090264d700b001e0617335b2si1728957pli.12.2024.03.28.10.17.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZrkXxdgD; 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-123326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123326-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8EDDAB26C51 for ; Thu, 28 Mar 2024 17:03:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C43DE65190; Thu, 28 Mar 2024 17:00:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZrkXxdgD" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 87E9A5B678 for ; Thu, 28 Mar 2024 17:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711645216; cv=none; b=DntERKyoE5cvgSTtnPCj18716QW3seOPXQHK1//87ap1+F2JzNrwSl/fUnz5rMiYi7p+03+pA76TuLLkn8k0Zb3DkkPSMxX9z83fjsxu8vOiYZpDQ2h8hNaK7Y/AKc25DTQ0O1jpz57rCdT2tvt9gOYDUvTuV3Ea5sSXCzqjOsg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711645216; c=relaxed/simple; bh=a7ZDTPEmZI5vb0iw+H7BOuZ7gMj6e/DdhQq/AVsEQy4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jW9XRTj916C/y/SYxsuA6xtg9phwcNY/jMh0ky76ocj6Y5AJ3QZ7iKPS4yhn20+gSDHZTg8hkuRWi3Rono1M+QAzkc/G7j3Y8qLEG+PV8otNpSlftccW0+LdJGhrysxl83ospuqImUvnPD/7Zs1XhPnskKYmXHRfxCJKMJ9ZOgg= 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=ZrkXxdgD; arc=none smtp.client-ip=170.10.129.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=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> 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.3 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; } }