Skip to content

Commit c20c0d7

Browse files
committed
cifs: Make add_credits_and_wake_if() clear deducted credits
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
1 parent edea94a commit c20c0d7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/smb/client/cifsglob.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,12 @@ add_credits(struct TCP_Server_Info *server, const struct cifs_credits *credits,
881881

882882
static inline void
883883
add_credits_and_wake_if(struct TCP_Server_Info *server,
884-
const struct cifs_credits *credits, const int optype)
884+
struct cifs_credits *credits, const int optype)
885885
{
886886
if (credits->value) {
887887
server->ops->add_credits(server, credits, optype);
888888
wake_up(&server->request_q);
889+
credits->value = 0;
889890
}
890891
}
891892

0 commit comments

Comments
 (0)