From: Randy Dunlap <randy.dunlap@oracle.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: akpm <akpm@osdl.org>, axboe <axboe@suse.de>,
jejb <James.Bottomley@SteelEye.com>,
scsi <linux-scsi@vger.kernel.org>
Subject: [Ubuntu PATCH] CDROMEJECT cannot eject some devices
Date: Mon, 03 Jul 2006 13:46:24 -0700 [thread overview]
Message-ID: <44A98220.2000007@oracle.com> (raw)
Fix the bug where CDROMEJECT cannot eject some devices.
bug discussion: https://bugzilla.ubuntu.com/show_bug.cgi?id=5049
Patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=f431f87fc9ac9ba248f43662ef9da9cdaa3418c2
---
block/scsi_ioctl.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- linux-2617-g21.orig/block/scsi_ioctl.c
+++ linux-2617-g21/block/scsi_ioctl.c
@@ -501,7 +501,7 @@ static int __blk_send_generic(request_qu
struct request *rq;
int err;
- rq = blk_get_request(q, WRITE, __GFP_WAIT);
+ rq = blk_get_request(q, READ, __GFP_WAIT);
rq->flags |= REQ_BLOCK_PC;
rq->data = NULL;
rq->data_len = 0;
@@ -521,6 +521,11 @@ static inline int blk_send_start_stop(re
return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
}
+static inline int blk_send_allow_medium_removal(request_queue_t *q, struct gendisk *bd_disk)
+{
+ return __blk_send_generic(q, bd_disk, GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, 0);
+}
+
int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
{
request_queue_t *q;
@@ -645,7 +650,11 @@ int scsi_cmd_ioctl(struct file *file, st
err = blk_send_start_stop(q, bd_disk, 0x03);
break;
case CDROMEJECT:
- err = blk_send_start_stop(q, bd_disk, 0x02);
+ err = 0;
+
+ err |= blk_send_allow_medium_removal(q, bd_disk);
+ err |= blk_send_start_stop(q, bd_disk, 0x01);
+ err |= blk_send_start_stop(q, bd_disk, 0x02);
break;
default:
err = -ENOTTY;
next reply other threads:[~2006-07-03 20:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-03 20:46 Randy Dunlap [this message]
2006-07-03 21:04 ` [Ubuntu PATCH] CDROMEJECT cannot eject some devices Matthew Wilcox
2006-07-03 21:10 ` 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=44A98220.2000007@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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.