All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Warner <andyw@pobox.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, Doug Ledford <dledford@redhat.com>
Subject: Re: libata & scsi rescan.
Date: Thu, 7 Oct 2004 17:14:57 -0500	[thread overview]
Message-ID: <20041007171457.B21662@florence.linkmargin.com> (raw)
In-Reply-To: <4164BDD6.6000404@pobox.com>; from jgarzik@pobox.com on Wed, Oct 06, 2004 at 11:53:58PM -0400

Jeff Garzik wrote:
> BTW, the SiI folks recommend a debounce timer.

OK, got that. No problem, queue_delayed_work() and some
state handles that. Now I've got the following issue,
calling scsi_remove_device() seems to try and flush
the disk - not a very productive operation:

<drive removed>
ata1: drive not present
Synchronizing SCSI cache for disk sdb: 
ATA: abnormal status 0x7F on port 0xF8A3EC87
ATA: abnormal status 0x7F on port 0xF8A3EC87
ATA: abnormal status 0x7F on port 0xF8A3EC87
ata1: command 0xea timeout, stat 0x50 host_stat 0x0

<drive re-added>
ata1: drive present
  Vendor: ATA       Model: ST3160023AS       Rev: 3.17
  Type:   Direct-Access                      ANSI SCSI revision: 05
SCSI device sdb: 312581808 512-byte hdwr sectors (160042 MB)
SCSI device sdb: drive cache: write back
ATA: abnormal status 0xFF on port 0xF8A3EC87
ATA: abnormal status 0xFF on port 0xF8A3EC87
ata1: command 0x25 timeout, stat 0x50 host_stat 0x1
 unknown partition table
Attached scsi disk sdb at scsi14, channel 0, id 0, lun 0
Attached scsi generic sg2 at scsi14, channel 0, id 0, lun 0,  type 0


I'm not too concerned about the errors when the drive
appears yet, but trying to access the disk that just
vanished is never going to work well. Am I missing
something ?

Here's the code (ignore hardcoded values and sloppy error
checking for now):

if (ap->hotplug_task_state == HOTPLUG_ST_PENDING) {
	struct scsi_device *sdev ;
	/*
	 * Need to read the status register to determine
	 * the current drive state.
	 */
	status = ap->ops->scr_read(ap, SCR_STATUS) ;
	if ((status & (SCR_STAT_IPM_MASK | SCR_STAT_DET_MASK)) ==
			(SCR_STAT_IPM_ACTIVE | SCR_STAT_DET_GOOD)) {
		/*
		 * Drive present.
		 */
		printk("ata%u: drive present\n", ap->id) ;

		/*
		 * Add it.
		 */
		sdev = scsi_add_device(ap->host, 0, 0, 0) ;
	} else {
		/*
		 * Drive not present.
		 */
		printk("ata%u: drive not present\n", ap->id) ;

		/*
		 * Remove it.
		 */
		sdev = scsi_device_lookup(ap->host, 0, 0, 0);
		if (sdev) {
			scsi_remove_device(sdev);
			scsi_device_put(sdev) ;
		}
	}
	ap->hotplug_task_state = HOTPLUG_ST_IDLE ;
}

-- 
andyw@pobox.com

Andy Warner		Voice: (612) 801-8549	Fax: (208) 575-5634

  reply	other threads:[~2004-10-07 22:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 17:39 libata & scsi rescan Andy Warner
2004-10-01 18:32 ` Jeff Garzik
2004-10-01 19:12   ` Andy Warner
2004-10-01 19:30     ` Jeff Garzik
2004-10-04 20:56       ` Andy Warner
2004-10-04 21:05         ` Jeff Garzik
2004-10-06 22:36           ` Andy Warner
2004-10-07  1:07             ` Jeff Garzik
2004-10-07  2:47               ` Andy Warner
2004-10-07  3:17                 ` Jeff Garzik
2004-10-07  3:49                   ` Andy Warner
2004-10-07  3:59                     ` Jeff Garzik
2004-10-07  3:53                   ` Jeff Garzik
2004-10-07 22:14                     ` Andy Warner [this message]
2004-10-07 22:21                       ` Jeff Garzik
2004-10-07 22:25                       ` Jeff Garzik
2004-10-08  2:48                         ` Andy Warner
2004-10-08 15:56                         ` Andy Warner
2004-10-07 22:26                       ` Jeff Garzik

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=20041007171457.B21662@florence.linkmargin.com \
    --to=andyw@pobox.com \
    --cc=dledford@redhat.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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.