RE: [Bug 25832] kernel crashes when a mounted ext3/4 file system isphysically removed

From: Alan Stern
Date: Sat Sep 17 2011 - 13:35:04 EST


On Sat, 17 Sep 2011, Rocko Requin wrote:

> > Why were you using gnome-terminal? You should be running the tests at
> > a console VT, not under X at all. Ctrl-Alt-F2 or the equivalent...
>
> Because with Ted's patch it doesn't crash when run from a console VT, even with an X server running.

That's weird. Maybe the screen updates change some timing.

> > Here's another patch to address the new problem. You can apply it on
> > top of all the other patches.
>
> Attached is the crash log I get with the latest patch applied.

Okay, more fallout from the same problem. Here's an updated version of
the previous patch.

These are really just bandaid-type fixes. The people who understand
the block layer ought to be involved. If this keeps up much longer
I'll get in touch with them.

Alan Stern


Index: usb-3.1/block/blk-core.c
===================================================================
--- usb-3.1.orig/block/blk-core.c
+++ usb-3.1/block/blk-core.c
@@ -367,8 +367,10 @@ void blk_cleanup_queue(struct request_qu
queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
mutex_unlock(&q->sysfs_lock);

- if (q->elevator)
+ if (q->elevator) {
elevator_exit(q->elevator);
+ q->elevator = NULL;
+ }

blk_throtl_exit(q);

Index: usb-3.1/block/elevator.c
===================================================================
--- usb-3.1.orig/block/elevator.c
+++ usb-3.1/block/elevator.c
@@ -769,7 +769,7 @@ void elv_put_request(struct request_queu
{
struct elevator_queue *e = q->elevator;

- if (e->ops->elevator_put_req_fn)
+ if (e && e->ops->elevator_put_req_fn)
e->ops->elevator_put_req_fn(rq);
}

@@ -812,7 +812,7 @@ void elv_completed_request(struct reques
*/
if (blk_account_rq(rq)) {
q->in_flight[rq_is_sync(rq)]--;
- if ((rq->cmd_flags & REQ_SORTED) &&
+ if ((rq->cmd_flags & REQ_SORTED) && e &&
e->ops->elevator_completed_req_fn)
e->ops->elevator_completed_req_fn(q, rq);
}

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