From: "Anton V. Boyarshinov" <boyarsh@altlinux.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>,
Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org, Jens Axboe <jaxboe@fusionio.com>
Subject: Re: Strange block/scsi/workqueue issue
Date: Tue, 31 May 2011 10:05:11 +0400 [thread overview]
Message-ID: <20110531100511.7145c545@table.home> (raw)
In-Reply-To: <1302714080.2597.29.camel@mulgrave.site>
Hi
> While you still have the problematic system, can you try this patch?
It seems that a scsi_sysfs.c half of this patch there is in 2.6.39, but
not blk.h part. Now we have frequent panics caused NULL in
q->elevator->ops in block/blk.h.
Panic is triggered by connecting USB Storage device without medium
(card reader, android phone). We saw it on different computers with
different kernel builds. Most frequent panics have seen on kernel build
with forsed preemption under relatively havy load (for example, boot).
Regards, Anton
> It avoids changing anything in block (other than to add a missing
> state guard for the elv_next_request). If it works, we can defer the
> sync vs async discussion and use it for a -stable fix.
>
> Thanks,
>
> James
>
> ---
>
> diff --git a/block/blk.h b/
> index c8db371..11d0d25 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -62,7 +62,8 @@ static inline struct request
> *__elv_next_request(struct request_queue *q) return rq;
> }
>
> - if (!q->elevator->ops->elevator_dispatch_fn(q, 0))
> + if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags) ||
> + !q->elevator->ops->elevator_dispatch_fn(q, 0))
> return NULL;
> }
> }
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index e44ff64..5aa4246 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -322,14 +322,9 @@ static void
> scsi_device_dev_release_usercontext(struct work_struct *work)
> kfree(evt); }
>
> - if (sdev->request_queue) {
> - sdev->request_queue->queuedata = NULL;
> - /* user context needed to free queue */
> - scsi_free_queue(sdev->request_queue);
> - /* temporary expedient, try to catch use of queue
> lock
> - * after free of sdev */
> - sdev->request_queue = NULL;
> - }
> + /* temporary expedient, try to catch use of queue lock after
> + * free of sdev */
> + sdev->request_queue = NULL;
>
> scsi_target_reap(scsi_target(sdev));
>
> @@ -937,6 +932,11 @@ void __scsi_remove_device(struct scsi_device
> *sdev) if (sdev->host->hostt->slave_destroy)
> sdev->host->hostt->slave_destroy(sdev);
> transport_destroy_device(dev);
> + /* Setting this to NULL causes the request function to reject
> + * any I/O requests */
> + sdev->request_queue->queuedata = NULL;
> + /* Freeing the queue signals to block that we're done */
> + scsi_free_queue(sdev->request_queue);
> put_device(dev);
> }
>
>
>
> --
> 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/
next prev parent reply other threads:[~2011-05-31 6:16 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 14:56 Strange block/scsi/workqueue issue Steven Whitehouse
2011-04-11 17:18 ` Tejun Heo
2011-04-11 17:29 ` Jens Axboe
2011-04-11 17:52 ` Steven Whitehouse
2011-04-12 0:14 ` Tejun Heo
2011-04-12 8:49 ` Steven Whitehouse
2011-04-12 0:47 ` James Bottomley
2011-04-12 2:51 ` Tejun Heo
2011-04-12 4:49 ` James Bottomley
2011-04-12 5:02 ` James Bottomley
2011-04-12 8:42 ` Steven Whitehouse
2011-04-12 13:42 ` James Bottomley
2011-04-12 14:06 ` Steven Whitehouse
2011-04-12 15:14 ` James Bottomley
2011-04-12 16:04 ` Steven Whitehouse
2011-04-12 16:27 ` James Bottomley
2011-04-12 16:51 ` Steven Whitehouse
2011-04-12 17:41 ` James Bottomley
2011-04-12 18:33 ` Steven Whitehouse
2011-04-12 19:56 ` James Bottomley
2011-04-12 20:30 ` Steven Whitehouse
2011-04-12 20:43 ` James Bottomley
2011-04-13 5:18 ` Tejun Heo
2011-04-13 6:06 ` Tejun Heo
2011-04-13 9:20 ` Steven Whitehouse
2011-04-13 14:00 ` Steven Whitehouse
2011-04-13 17:01 ` James Bottomley
2011-04-13 19:35 ` Steven Whitehouse
2011-04-13 20:12 ` Jens Axboe
2011-04-13 20:17 ` James Bottomley
2011-04-22 18:01 ` Tejun Heo
2011-04-22 18:06 ` James Bottomley
2011-04-22 18:30 ` Tejun Heo
2011-05-31 6:05 ` Anton V. Boyarshinov [this message]
2011-04-22 18:03 ` Tejun Heo
2011-04-12 5:15 ` Tejun Heo
2011-04-12 15:15 ` James Bottomley
2011-04-13 5:11 ` Tejun Heo
2011-04-13 14:15 ` James Bottomley
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=20110531100511.7145c545@table.home \
--to=boyarsh@altlinux.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=swhiteho@redhat.com \
--cc=tj@kernel.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).