mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[SCSI] fix oops on usb storage device disconnect
We fix the oops by enforcing the host state model. There have also been two extra states added: SHOST_CANCEL_RECOVERY and SHOST_DEL_RECOVERY so we can take the model through host removal while the recovery thread is active. Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
a64358db12
commit
939647ee30
8 changed files with 66 additions and 16 deletions
|
|
@ -439,6 +439,8 @@ enum scsi_host_state {
|
|||
SHOST_CANCEL,
|
||||
SHOST_DEL,
|
||||
SHOST_RECOVERY,
|
||||
SHOST_CANCEL_RECOVERY,
|
||||
SHOST_DEL_RECOVERY,
|
||||
};
|
||||
|
||||
struct Scsi_Host {
|
||||
|
|
@ -621,6 +623,13 @@ static inline struct Scsi_Host *dev_to_shost(struct device *dev)
|
|||
return container_of(dev, struct Scsi_Host, shost_gendev);
|
||||
}
|
||||
|
||||
static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
|
||||
{
|
||||
return shost->shost_state == SHOST_RECOVERY ||
|
||||
shost->shost_state == SHOST_CANCEL_RECOVERY ||
|
||||
shost->shost_state == SHOST_DEL_RECOVERY;
|
||||
}
|
||||
|
||||
extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
|
||||
extern void scsi_flush_work(struct Scsi_Host *);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue