]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: zfcp: remove unit will fail if add unit is not finished | |
3 | References: bnc#484767,LTC#48795 | |
4 | ||
5 | Symptom: On some hardware it can take some time to add a unit. If | |
6 | some remove this unit during this process the remove will | |
7 | fail. | |
8 | Problem: There exists some SCSI work which needs to be finished | |
9 | before removing this unit. | |
10 | Solution: Wait until all SCSI work is done for that unit. | |
11 | ||
12 | Acked-by: John Jolly <jjolly@suse.de> | |
13 | --- | |
14 | drivers/s390/scsi/zfcp_sysfs.c | 21 +++++++++++++++------ | |
15 | 1 file changed, 15 insertions(+), 6 deletions(-) | |
16 | ||
17 | Index: linux-sles11/drivers/s390/scsi/zfcp_sysfs.c | |
18 | =================================================================== | |
19 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_sysfs.c | |
20 | +++ linux-sles11/drivers/s390/scsi/zfcp_sysfs.c | |
21 | @@ -253,12 +253,21 @@ static ssize_t zfcp_sysfs_unit_remove_st | |
22 | ||
23 | write_lock_irq(&zfcp_data.config_lock); | |
24 | unit = zfcp_get_unit_by_lun(port, fcp_lun); | |
25 | - if (unit && (atomic_read(&unit->refcount) == 0)) { | |
26 | - zfcp_unit_get(unit); | |
27 | - atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); | |
28 | - list_move(&unit->list, &unit_remove_lh); | |
29 | - } else | |
30 | - unit = NULL; | |
31 | + if (unit) { | |
32 | + write_unlock_irq(&zfcp_data.config_lock); | |
33 | + /* wait for possible timeout during SCSI probe */ | |
34 | + flush_work(&unit->scsi_work); | |
35 | + write_lock_irq(&zfcp_data.config_lock); | |
36 | + | |
37 | + if (atomic_read(&unit->refcount) == 0) { | |
38 | + zfcp_unit_get(unit); | |
39 | + atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, | |
40 | + &unit->status); | |
41 | + list_move(&unit->list, &unit_remove_lh); | |
42 | + } else { | |
43 | + unit = NULL; | |
44 | + } | |
45 | + } | |
46 | ||
47 | write_unlock_irq(&zfcp_data.config_lock); | |
48 |