From: Markus Pargmann <mpa@pengutronix.de>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
nbd-general@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm 3/3] nbd: don't abuse irqsave/irqrestore while taking nbd->tasks_lock
Date: Mon, 26 Oct 2015 08:50:03 +0100 [thread overview]
Message-ID: <20151026075003.GG16521@pengutronix.de> (raw)
In-Reply-To: <20151025152641.GA1405@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3072 bytes --]
On Sun, Oct 25, 2015 at 04:26:41PM +0100, Oleg Nesterov wrote:
> Both nbd_thread_recv() and nbd_thread_send() are might_sleep() and
> called with irqs enabled(), irqsave/irqrestore make no sense and imo
> look confusing.
Thanks, applied.
Regards,
Markus
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
> drivers/block/nbd.c | 22 ++++++++++------------
> 1 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 0ffd73c..fd79405 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -406,23 +406,22 @@ static int nbd_thread_recv(struct nbd_device *nbd)
> {
> struct request *req;
> int ret;
> - unsigned long flags;
>
> BUG_ON(nbd->magic != NBD_MAGIC);
>
> sk_set_memalloc(nbd->sock->sk);
>
> - spin_lock_irqsave(&nbd->tasks_lock, flags);
> + spin_lock_irq(&nbd->tasks_lock);
> nbd->task_recv = current;
> - spin_unlock_irqrestore(&nbd->tasks_lock, flags);
> + spin_unlock_irq(&nbd->tasks_lock);
>
> ret = device_create_file(disk_to_dev(nbd->disk), &pid_attr);
> if (ret) {
> dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n");
>
> - spin_lock_irqsave(&nbd->tasks_lock, flags);
> + spin_lock_irq(&nbd->tasks_lock);
> nbd->task_recv = NULL;
> - spin_unlock_irqrestore(&nbd->tasks_lock, flags);
> + spin_unlock_irq(&nbd->tasks_lock);
>
> return ret;
> }
> @@ -439,9 +438,9 @@ static int nbd_thread_recv(struct nbd_device *nbd)
>
> device_remove_file(disk_to_dev(nbd->disk), &pid_attr);
>
> - spin_lock_irqsave(&nbd->tasks_lock, flags);
> + spin_lock_irq(&nbd->tasks_lock);
> nbd->task_recv = NULL;
> - spin_unlock_irqrestore(&nbd->tasks_lock, flags);
> + spin_unlock_irq(&nbd->tasks_lock);
>
> if (signal_pending(current)) {
> dev_warn(nbd_to_dev(nbd), "pid %d, %s, got signal",
> @@ -543,11 +542,10 @@ static int nbd_thread_send(void *data)
> {
> struct nbd_device *nbd = data;
> struct request *req;
> - unsigned long flags;
>
> - spin_lock_irqsave(&nbd->tasks_lock, flags);
> + spin_lock_irq(&nbd->tasks_lock);
> nbd->task_send = current;
> - spin_unlock_irqrestore(&nbd->tasks_lock, flags);
> + spin_unlock_irq(&nbd->tasks_lock);
>
> set_user_nice(current, MIN_NICE);
> while (!kthread_should_stop() || !list_empty(&nbd->waiting_queue)) {
> @@ -581,9 +579,9 @@ static int nbd_thread_send(void *data)
> nbd_handle_req(nbd, req);
> }
>
> - spin_lock_irqsave(&nbd->tasks_lock, flags);
> + spin_lock_irq(&nbd->tasks_lock);
> nbd->task_send = NULL;
> - spin_unlock_irqrestore(&nbd->tasks_lock, flags);
> + spin_unlock_irq(&nbd->tasks_lock);
>
> return 0;
> }
> --
> 1.5.5.1
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2015-10-26 7:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 15:26 [PATCH -mm 0/3] nbd: fix/cleanup the usage of kernel_dequeue_signal() Oleg Nesterov
2015-10-25 15:26 ` [PATCH -mm 1/3] nbd: nbd_thread_send: remove the unnecessary kernel_dequeue_signal() Oleg Nesterov
2015-10-26 7:48 ` Markus Pargmann
2015-10-25 15:26 ` [PATCH -mm 2/3] nbd: nbd_thread_recv: remove the buggy kernel_dequeue_signal() Oleg Nesterov
2015-10-26 7:44 ` Markus Pargmann
2015-10-28 15:53 ` Oleg Nesterov
2015-10-25 15:26 ` [PATCH -mm 3/3] nbd: don't abuse irqsave/irqrestore while taking nbd->tasks_lock Oleg Nesterov
2015-10-26 7:50 ` Markus Pargmann [this message]
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=20151026075003.GG16521@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd-general@lists.sourceforge.net \
--cc=oleg@redhat.com \
/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
Powered by JetHome