diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 464f0473877a..788fd3a4cd23 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -174,7 +174,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, | |||
174 | 174 | ||
175 | switch (need) { | 175 | switch (need) { |
176 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 176 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
177 | zfcp_unit_get(unit); | 177 | get_device(&unit->sysfs_device); |
178 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status); | 178 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status); |
179 | erp_action = &unit->erp_action; | 179 | erp_action = &unit->erp_action; |
180 | if (!(atomic_read(&unit->status) & ZFCP_STATUS_COMMON_RUNNING)) | 180 | if (!(atomic_read(&unit->status) & ZFCP_STATUS_COMMON_RUNNING)) |
@@ -183,7 +183,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, | |||
183 | 183 | ||
184 | case ZFCP_ERP_ACTION_REOPEN_PORT: | 184 | case ZFCP_ERP_ACTION_REOPEN_PORT: |
185 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: | 185 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: |
186 | zfcp_port_get(port); | 186 | get_device(&port->sysfs_device); |
187 | zfcp_erp_action_dismiss_port(port); | 187 | zfcp_erp_action_dismiss_port(port); |
188 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); | 188 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); |
189 | erp_action = &port->erp_action; | 189 | erp_action = &port->erp_action; |
@@ -192,7 +192,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, | |||
192 | break; | 192 | break; |
193 | 193 | ||
194 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | 194 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: |
195 | zfcp_adapter_get(adapter); | 195 | kref_get(&adapter->ref); |
196 | zfcp_erp_action_dismiss_adapter(adapter); | 196 | zfcp_erp_action_dismiss_adapter(adapter); |
197 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); | 197 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); |
198 | erp_action = &adapter->erp_action; | 198 | erp_action = &adapter->erp_action; |
@@ -1177,19 +1177,19 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result) | |||
1177 | switch (act->action) { | 1177 | switch (act->action) { |
1178 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 1178 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
1179 | if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) { | 1179 | if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) { |
1180 | zfcp_unit_get(unit); | 1180 | get_device(&unit->sysfs_device); |
1181 | if (scsi_queue_work(unit->port->adapter->scsi_host, | 1181 | if (scsi_queue_work(unit->port->adapter->scsi_host, |
1182 | &unit->scsi_work) <= 0) | 1182 | &unit->scsi_work) <= 0) |
1183 | zfcp_unit_put(unit); | 1183 | put_device(&unit->sysfs_device); |
1184 | } | 1184 | } |
1185 | zfcp_unit_put(unit); | 1185 | put_device(&unit->sysfs_device); |
1186 | break; | 1186 | break; |
1187 | 1187 | ||
1188 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: | 1188 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: |
1189 | case ZFCP_ERP_ACTION_REOPEN_PORT: | 1189 | case ZFCP_ERP_ACTION_REOPEN_PORT: |
1190 | if (result == ZFCP_ERP_SUCCEEDED) | 1190 | if (result == ZFCP_ERP_SUCCEEDED) |
1191 | zfcp_scsi_schedule_rport_register(port); | 1191 | zfcp_scsi_schedule_rport_register(port); |
1192 | zfcp_port_put(port); | 1192 | put_device(&port->sysfs_device); |
1193 | break; | 1193 | break; |
1194 | 1194 | ||
1195 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | 1195 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: |
@@ -1198,7 +1198,7 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result) | |||
1198 | schedule_work(&adapter->scan_work); | 1198 | schedule_work(&adapter->scan_work); |
1199 | } else | 1199 | } else |
1200 | unregister_service_level(&adapter->service_level); | 1200 | unregister_service_level(&adapter->service_level); |
1201 | zfcp_adapter_put(adapter); | 1201 | kref_put(&adapter->ref, zfcp_adapter_release); |
1202 | break; | 1202 | break; |
1203 | } | 1203 | } |
1204 | } | 1204 | } |
@@ -1224,8 +1224,9 @@ static int zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1224 | unsigned long flags; | 1224 | unsigned long flags; |
1225 | struct zfcp_adapter *adapter = erp_action->adapter; | 1225 | struct zfcp_adapter *adapter = erp_action->adapter; |
1226 | 1226 | ||
1227 | write_lock_irqsave(&adapter->erp_lock, flags); | 1227 | kref_get(&adapter->ref); |
1228 | 1228 | ||
1229 | write_lock_irqsave(&adapter->erp_lock, flags); | ||
1229 | zfcp_erp_strategy_check_fsfreq(erp_action); | 1230 | zfcp_erp_strategy_check_fsfreq(erp_action); |
1230 | 1231 | ||
1231 | if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) { | 1232 | if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) { |
@@ -1282,6 +1283,7 @@ static int zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1282 | if (retval != ZFCP_ERP_CONTINUES) | 1283 | if (retval != ZFCP_ERP_CONTINUES) |
1283 | zfcp_erp_action_cleanup(erp_action, retval); | 1284 | zfcp_erp_action_cleanup(erp_action, retval); |
1284 | 1285 | ||
1286 | kref_put(&adapter->ref, zfcp_adapter_release); | ||
1285 | return retval; | 1287 | return retval; |
1286 | } | 1288 | } |
1287 | 1289 | ||