How to synchronize SCSI user scan with SCSI hotplug/rescan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Folks,

In libata EH code, both SCSI hotplug and rescan are executed from a
separate workqueue after EH completes as shown below:
void ata_scsi_error(struct Scsi_Host *host)
{
...
	if (ap->pflags & ATA_PFLAG_LOADING)
		ap->pflags &= ~ATA_PFLAG_LOADING;
	else if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG)
		queue_work(ata_aux_wq, &ap->hotplug_task);
}

static int ata_eh_revalidate_and_attach()
{
...
queue_work(ata_aux_wq, &(ap->scsi_rescan_task));
}

However SCSI user scan code is synchronized to EH only as shown below:
static int ata_scsi_user_scan()
{
...
	if (rc == 0)
	{
	  ata_port_schedule_eh(ap);
	  spin_unlock_irqrestore(ap->lock, flags);
	  ata_port_wait_eh(ap);
       }
...
}

So SCSI user scan could race with SCSI hotplug/rescan and the
consequence is that   we may not be able to access device right after
user scan.  We can work around the issue by adding timeout in user
space code but this is not a real fix. Can we synchronize SCSI user
scan with SCSI hotplug/rescan?

Thanks,
Fajun
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux