linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Steve French <smfrench@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	Jeff Layton <jlayton@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Paulo Alcantara <pc@manguebit.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>,
	Christian Brauner <christian@brauner.io>,
	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 <sfrench@samba.org>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>
Subject: [PATCH v6 09/15] cifs: Make add_credits_and_wake_if() clear deducted credits
Date: Thu, 28 Mar 2024 16:58:00 +0000	[thread overview]
Message-ID: <20240328165845.2782259-10-dhowells@redhat.com> (raw)
In-Reply-To: <20240328165845.2782259-1-dhowells@redhat.com>

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 <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
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;
 	}
 }
 



  parent reply	other threads:[~2024-03-28 17:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 16:57 [PATCH v6 00/15] netfs, cifs: Delegate high-level I/O to netfslib David Howells
2024-03-28 16:57 ` [PATCH v6 01/15] cifs: Replace cifs_readdata with a wrapper around netfs_io_subrequest David Howells
2024-03-28 16:57 ` [PATCH v6 02/15] cifs: Replace cifs_writedata " David Howells
2024-03-28 16:57 ` [PATCH v6 03/15] cifs: Use more fields from netfs_io_subrequest David Howells
2024-03-28 16:57 ` [PATCH v6 04/15] cifs: Make wait_mtu_credits take size_t args David Howells
2024-03-28 16:57 ` [PATCH v6 05/15] cifs: Replace the writedata replay bool with a netfs sreq flag David Howells
2024-03-28 16:57 ` [PATCH v6 06/15] cifs: Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c David Howells
2024-03-28 16:57 ` [PATCH v6 07/15] cifs: Set zero_point in the copy_file_range() and remap_file_range() David Howells
2024-03-28 16:57 ` [PATCH v6 08/15] cifs: Add mempools for cifs_io_request and cifs_io_subrequest structs David Howells
2024-03-28 16:58 ` David Howells [this message]
2024-03-28 16:58 ` [PATCH v6 10/15] cifs: Implement netfslib hooks David Howells
2024-03-28 16:58 ` [PATCH v6 11/15] cifs: When caching, try to open O_WRONLY file rdwr on server David Howells
2024-03-29  9:58   ` Naveen Mamindlapalli
2024-03-28 16:58 ` [PATCH v6 12/15] cifs: Cut over to using netfslib David Howells
2024-03-28 16:58 ` [PATCH v6 13/15] cifs: Remove some code that's no longer used, part 1 David Howells
2024-03-28 16:58 ` [PATCH v6 14/15] cifs: Remove some code that's no longer used, part 2 David Howells
2024-03-28 16:58 ` [PATCH v6 15/15] cifs: Remove some code that's no longer used, part 3 David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240328165845.2782259-10-dhowells@redhat.com \
    --to=dhowells@redhat.com \
    --cc=christian@brauner.io \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfs@lists.linux.dev \
    --cc=nspmangalore@gmail.com \
    --cc=pc@manguebit.com \
    --cc=rohiths.msft@gmail.com \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).