Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1267537

Re: [PATCH 1/1] usblp: do not set TASK_INTERRUPTIBLE before lock

From Pete Zaitcev <zaitcev@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] usblp: do not set TASK_INTERRUPTIBLE before lock
Date 2015-11-12 00:30 +0100
Message-ID <qtMZY-11K-11@gated-at.bofh.it> (permalink)
References <qqjB7-3zJ-5@gated-at.bofh.it>
Organization Red Hat, Inc.

Show all headers | View raw


On Mon,  2 Nov 2015 10:27:00 +0100
Jiri Slaby <jslaby@suse.cz> wrote:

> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> --- a/drivers/usb/class/usblp.c
> +++ b/drivers/usb/class/usblp.c
> @@ -884,11 +884,11 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
>  
>  	add_wait_queue(&usblp->wwait, &waita);
>  	for (;;) {
> -		set_current_state(TASK_INTERRUPTIBLE);
>  		if (mutex_lock_interruptible(&usblp->mut)) {
>  			rc = -EINTR;
>  			break;
>  		}
> +		set_current_state(TASK_INTERRUPTIBLE);
>  		rc = usblp_wtest(usblp, nonblock);
>  		mutex_unlock(&usblp->mut);
>  		if (rc <= 0)

I'm fully onboard with this. In the original "big cleanup" 317c67b8f,
I got this right. But then I either missed that mutex_lock_interruptible()
can set the state, or it didn't do it back then (it was in 2007), and
the 7f477358e introduced the existing code.

Acked-By: Pete Zaitcev <zaitcev@yahoo.com>

-- Pete
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] usblp: do not set TASK_INTERRUPTIBLE before lock Jiri Slaby <jslaby@suse.cz> - 2015-11-02 10:30 +0100
  Re: [PATCH 1/1] usblp: do not set TASK_INTERRUPTIBLE before lock Pete Zaitcev <zaitcev@redhat.com> - 2015-11-12 00:30 +0100

csiph-web