Skip to content

Commit

Permalink
cifs: Make add_credits_and_wake_if() clear deducted credits
Browse files Browse the repository at this point in the history
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
  • Loading branch information
David Howells committed May 1, 2024
1 parent edea94a commit c20c0d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/smb/client/cifsglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit c20c0d7

Please sign in to comment.