All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Douglas Gilbert <dougg@torque.net>
Cc: Jeff Tranter <tranter@pobox.com>,
	linux-scsi@vger.kernel.org, Linux IDE <linux-ide@vger.kernel.org>,
	Jeff Garzik <jeff@garzik.org>, Tejun Heo <htejun@gmail.com>,
	Unicorn Chang <uchang@tw.ibm.com>, Doug Maxey <dwm@enoyolf.org>,
	Gary Hade <garyhade@us.ibm.com>
Subject: Ejecting removable disk causes a flood of ALLOW_MEDIUM_REMOVAL
Date: Thu, 13 Jul 2006 12:07:51 +0800	[thread overview]
Message-ID: <44B5C717.40300@tw.ibm.com> (raw)

Hi Doug,

A problem related to SG_IO.
When testing the 2.6.18-rc1 libata, a flood of ALLOW_MEDIUM_REMOVAL is seen
after ejecting a removable disk drive:

http://bugzilla.kernel.org/show_bug.cgi?id=6799

The interaction to trigger the problem is below:
1. The "eject" utility, using SG_IO, issues ALLOW_MEDIUM_REMOVAL twice to unlock the disk of the device.
2. The disk of the physical device is now unlocked, however, sdev->locked is still 1, inconsistent with the physical device status.
3. The "eject" utility ejects the disk by START_STOP_UNIT.
4. Someone issues TEST_UNIT_READY. The device is not ready since no disk inside. ATAPI check condition returned.
5. 2.6.18-rc1 libata EH triggered in SCSI EH context to request sense.
6. scsi_restart_operations(), seeing sdev->locked == 1, tries to lock the door.
7. Lock failed since no disk inside. ATAPI check condition returned.
8. 2.6.18 libata EH triggered in SCSI EH context. Goto 5 and loop forever until the disk is inserted again.

It looks more like eject/scsi problem. (Libata 2.6.17 EH is not affected by the problem 
because the request sense is done when qc is completed, not in the SCSI EH context.)

Maybe adding a filter to the SCSI SG IO layer to
 - Check incoming SCSI commands
 - Whenever ALLOW_MEDIUM_REMOVAL is seen, update the sdev->locked to make the 
   kernel data structure consistent with the physical device status
can fix the problem?

--
albert


             reply	other threads:[~2006-07-13  4:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-13  4:07 Albert Lee [this message]
2006-07-13  5:45 ` Ejecting removable disk causes a flood of ALLOW_MEDIUM_REMOVAL Douglas Gilbert

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=44B5C717.40300@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=albertl@mail.com \
    --cc=dougg@torque.net \
    --cc=dwm@enoyolf.org \
    --cc=garyhade@us.ibm.com \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tranter@pobox.com \
    --cc=uchang@tw.ibm.com \
    /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.