public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcin Dalecki <dalecki@evision.ag>
To: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Morten Helgesen <morten.helgesen@nextframe.net>,
	linux-kernel@vger.kernel.org
Subject: Re: please DON'T run 2.5.27 with IDE!
Date: Tue, 23 Jul 2002 15:00:05 +0200	[thread overview]
Message-ID: <3D3D5355.40404@evision.ag> (raw)
In-Reply-To: Pine.SOL.4.30.0207231437360.14042-100000@mion.elka.pw.edu.pl

Bartlomiej Zolnierkiewicz wrote:
> On Tue, 23 Jul 2002, Morten Helgesen wrote:
> 
> 
>>On Mon, Jul 22, 2002 at 09:37:13PM +0200, Bartlomiej Zolnierkiewicz wrote:
>>
>>>IDE 99 which is included in 2.5.27 introduced really nasty bug.
>>>Possible lockups and data corruption. Please do not.
>>
>>Could you please elaborate a bit ?
> 
> 
> Bug is a result of Martin being careless and not sending patches for
> public review. It is easy to fix, but I won't, please excuse me.
> Also I wont go in technical details, lets see how quick it will be fixed.

The problem is of a somehow general nature.
Many of the block devices *need* a mechanism to run commands
asynchronously. The most preffered way to do this is
of course to go by the already present request queue.
However the generic queue handling layer
doesn't give us any mechanism to actually stuff
request from the driver and it doesn't behave well in boundary
conditions where the queues are nearly full.

So every single subsystem is (or at least should be) repeating something
along the lines of the following...

tatic void __scsi_insert_special(request_queue_t *q, struct request *rq,
				  void *data, int at_head)
{
	unsigned long flags;

	ASSERT_LOCK(q->queue_lock, 0);

	/*
	 * tell I/O scheduler that this isn't a regular read/write (ie
	 * must not attempt merges on this) and that it acts as a soft
	 * barrier
	 */
	rq->flags &= REQ_QUEUED;
	rq->flags |= REQ_SPECIAL | REQ_BARRIER;

	rq->special = data;

	spin_lock_irqsave(q->queue_lock, flags);
	/* If command is tagged, release the tag */
	if(blk_rq_tagged(rq))
		blk_queue_end_tag(q, rq);
	_elv_add_request(q, rq, !at_head, 0);
	q->request_fn(q);
	spin_unlock_irqrestore(q->queue_lock, flags);
}


int scsi_insert_special_req(Scsi_Request * SRpnt, int at_head)
{
	request_queue_t *q = &SRpnt->sr_device->request_queue;

	__scsi_insert_special(q, SRpnt->sr_request, SRpnt, at_head);
	return 0;
}

Well actually the proper patch will be modelled after what
is done in SCSI. Or maybe even unifying both.
At least it is immediately "obvious" that __scsi_insert_request()
has a signature which doesn't have anything to do with the SCSI
subsystem.
Becouse it is clear from the above as well
that for example at least setting the rq->flags should
be common among every kind of subsystem and it shouldn't
be done inside the subsystems implementation of this
method, since the flags are of a generic nature and there
are changes in this area from time to time.


For now the following *should* do for IDE:

===== drivers/ide/ide-taskfile.c 1.61 vs edited =====
--- 1.61/drivers/ide/ide-taskfile.c	Fri Jul 19 10:18:50 2002
+++ edited/drivers/ide/ide-taskfile.c	Tue Jul 23 12:12:55 2002
@@ -194,22 +194,16 @@
  	request_queue_t *q = &drive->queue;
  	struct list_head *queue_head = &q->queue_head;
  	DECLARE_COMPLETION(wait);
+	struct request req;

  #ifdef CONFIG_BLK_DEV_PDC4030
  	if (ch->chipset == ide_pdc4030 && buf)
  		return -ENOSYS;  /* special drive cmds not supported */
  #endif

-	rq = __blk_get_request(&drive->queue, READ);
-	if (!rq)
-		rq = __blk_get_request(&drive->queue, WRITE);
-
-	/*
-	 * FIXME: Make sure there is a free slot on the list!
-	 */
-
-	BUG_ON(!rq);
-
+	memset(&req, 0, sizeof(req));
+	rq = &req;
+	
  	rq->flags = REQ_SPECIAL;
  	rq->buffer = buf;
  	rq->special = ar;


  reply	other threads:[~2002-07-23 13:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-22 19:37 please DON'T run 2.5.27 with IDE! Bartlomiej Zolnierkiewicz
2002-07-22 20:39 ` Andries Brouwer
2002-07-22 23:25   ` Thunder from the hill
2002-07-23  0:39 ` A Guy Called Tyketto
2002-07-23  0:58   ` Thunder from the hill
2002-07-23  1:10     ` Bartlomiej Zolnierkiewicz
2002-07-23  8:03 ` Morten Helgesen
2002-07-23 12:47   ` Bartlomiej Zolnierkiewicz
2002-07-23 13:00     ` Marcin Dalecki [this message]
2002-07-23 13:42       ` Bartlomiej Zolnierkiewicz
2002-07-23 13:58         ` Marcin Dalecki
2002-07-23 19:52           ` Jan Harkes
2002-07-23 20:08             ` Andre Hedrick
2002-07-24 10:24             ` Marcin Dalecki
2002-07-23 20:24           ` Bartlomiej Zolnierkiewicz
2002-07-24 10:30             ` Marcin Dalecki
2002-07-24 10:54               ` Bartlomiej Zolnierkiewicz
2002-07-24 11:35                 ` Marcin Dalecki
2002-07-24 11:53                   ` Jens Axboe
2002-07-24 12:08                     ` Marcin Dalecki
2002-07-24 12:39                   ` Bartlomiej Zolnierkiewicz
2002-07-24 12:41                     ` Jens Axboe
2002-07-24 12:49                       ` Bartlomiej Zolnierkiewicz
2002-07-24 12:50                         ` Jens Axboe
2002-07-24 13:08                           ` Marcin Dalecki
2002-07-24 13:25                             ` Jens Axboe
2002-07-24 13:35                               ` Bartlomiej Zolnierkiewicz
2002-07-24 13:36                                 ` Jens Axboe
2002-07-24 13:38                                   ` Marcin Dalecki
2002-07-24 13:35                               ` Marcin Dalecki
2002-07-24 12:43                   ` Bartlomiej Zolnierkiewicz
2002-07-24 13:10                     ` Marcin Dalecki
2002-07-24 13:21                       ` Bartlomiej Zolnierkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2002-07-22 19:43 Petr Vandrovec
2002-07-22 19:46 ` Bartlomiej Zolnierkiewicz

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=3D3D5355.40404@evision.ag \
    --to=dalecki@evision.ag \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@dalecki.de \
    --cc=morten.helgesen@nextframe.net \
    /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