From: Brian King <brking@us.ibm.com>
To: james Bottomley <James.Bottomley@SteelEye.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] p00001_scsi_tcq_queue_lock
Date: Tue, 03 Aug 2004 12:49:50 -0500 [thread overview]
Message-ID: <410FD03E.6040305@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 64 bytes --]
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
[-- Attachment #2: p00001_scsi_tcq_queue_lock.patch --]
[-- Type: text/plain, Size: 1474 bytes --]
Add locking to scsi_activate_tcq and scsi_deactivate_tcq to fix a race
condition that can occur when disabling tcqing with commands in flight.
Signed-off-by: Brian King <brking@us.ibm.com>
---
linux-2.6.8-rc2-bjking1/include/scsi/scsi_tcq.h | 8 ++++++++
1 files changed, 8 insertions(+)
diff -puN include/scsi/scsi_tcq.h~scsi_tcq_queue_lock include/scsi/scsi_tcq.h
--- linux-2.6.8-rc2/include/scsi/scsi_tcq.h~scsi_tcq_queue_lock 2004-08-03 11:05:28.000000000 -0500
+++ linux-2.6.8-rc2-bjking1/include/scsi/scsi_tcq.h 2004-08-03 11:12:19.000000000 -0500
@@ -25,9 +25,13 @@
**/
static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
{
+ unsigned long flags;
+
if (sdev->tagged_supported) {
+ spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
if (!blk_queue_tagged(sdev->request_queue))
blk_queue_init_tags(sdev->request_queue, depth, NULL);
+ spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
}
}
@@ -38,8 +42,12 @@ static inline void scsi_activate_tcq(str
**/
static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
{
+ unsigned long flags;
+
+ spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
if (blk_queue_tagged(sdev->request_queue))
blk_queue_free_tags(sdev->request_queue);
+ spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
scsi_adjust_queue_depth(sdev, 0, depth);
}
_
next reply other threads:[~2004-08-03 17:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-03 17:49 Brian King [this message]
2004-08-07 4:09 ` [PATCH] p00001_scsi_tcq_queue_lock James Bottomley
2004-08-09 14:04 ` Brian King
2004-08-09 14:14 ` Brian King
2004-09-17 17:55 ` Brian King
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=410FD03E.6040305@us.ibm.com \
--to=brking@us.ibm.com \
--cc=James.Bottomley@SteelEye.com \
--cc=linux-scsi@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.