public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* question about sd_sync_cache and shutdown
@ 2006-07-12  0:57 Mike Christie
  2006-07-12 16:25 ` Stefan Richter
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Christie @ 2006-07-12  0:57 UTC (permalink / raw)
  To: open-iscsi, SCSI Mailing List

Currently, if we remove a host, target, transport object like session or
rport or scsi_device sd_shutdown will get called but
scsi_disk_get_from_dev will return NULL and we hit this return statement

static void sd_shutdown(struct device *dev)
{
        struct scsi_device *sdp = to_scsi_device(dev);
        struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);

        if (!sdkp)
                return;         /* this can happen */

The reason is that __scsi_remove_device calls scsi_device_set_state and
sets the state to SDEV_CANCEL then it calls device_del. then when
scsi_disk_get_from_dev is called in sd.c it eventually calls
scsi_device_get which checks if the state is SDEV_CANCEL and it so
returns NULL.

My question is if this a bug or expected behavior? It seems like a bug
because for a orderly removal of some object, like someone shutting down
a iscsi session, we are going to hit that path, but the command will not
get sent. However, for unorderly removal, like ripping out a usb device
or FC rport or iSCSI session being removed due to dev_loss_tmp expiring
then we do not want the command sent. So it seems like it may be
intended behavior.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-12 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12  0:57 question about sd_sync_cache and shutdown Mike Christie
2006-07-12 16:25 ` Stefan Richter
2006-07-12 16:41   ` Mike Christie
2006-07-12 18:49     ` Stefan Richter
2006-07-12 19:18       ` Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox