Skip to content

Commit

Permalink
[SCSI] zfcp: remove union zfcp_req_data, use unit refcount for FCP co…
Browse files Browse the repository at this point in the history
…mmands

o union zfcp_req_data removed
o increment unit refcount when processing FCP commands
 (This fixes a theoretical race: When all scsi commands of a unit
  are aborted and the scsi_device is removed then the unit could be
  removed before all fsf_requests of that unit are completely processed.)

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Andreas Herrmann authored and James Bottomley committed Sep 19, 2005
1 parent 3734d24 commit 059c97d
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 275 deletions.
8 changes: 3 additions & 5 deletions drivers/s390/scsi/zfcp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ zfcp_cmd_dbf_event_fsf(const char *text, struct zfcp_fsf_req *fsf_req,

spin_lock_irqsave(&adapter->dbf_lock, flags);
if (zfcp_fsf_req_is_scsi_cmnd(fsf_req)) {
scsi_cmnd = fsf_req->data.send_fcp_command_task.scsi_cmnd;
scsi_cmnd = (struct scsi_cmnd*) fsf_req->data;
debug_text_event(adapter->cmd_dbf, level, "fsferror");
debug_text_event(adapter->cmd_dbf, level, text);
debug_event(adapter->cmd_dbf, level, &fsf_req,
Expand All @@ -167,14 +167,12 @@ void
zfcp_cmd_dbf_event_scsi(const char *text, struct scsi_cmnd *scsi_cmnd)
{
struct zfcp_adapter *adapter;
union zfcp_req_data *req_data;
struct zfcp_fsf_req *fsf_req;
int level = ((host_byte(scsi_cmnd->result) != 0) ? 1 : 5);
unsigned long flags;

adapter = (struct zfcp_adapter *) scsi_cmnd->device->host->hostdata[0];
req_data = (union zfcp_req_data *) scsi_cmnd->host_scribble;
fsf_req = (req_data ? req_data->send_fcp_command_task.fsf_req : NULL);
fsf_req = (struct zfcp_fsf_req *) scsi_cmnd->host_scribble;
spin_lock_irqsave(&adapter->dbf_lock, flags);
debug_text_event(adapter->cmd_dbf, level, "hostbyte");
debug_text_event(adapter->cmd_dbf, level, text);
Expand Down Expand Up @@ -1609,7 +1607,7 @@ zfcp_fsf_incoming_els(struct zfcp_fsf_req *fsf_req)
u32 els_type;
struct zfcp_adapter *adapter;

status_buffer = fsf_req->data.status_read.buffer;
status_buffer = (struct fsf_status_read_buffer *) fsf_req->data;
els_type = *(u32 *) (status_buffer->payload);
adapter = fsf_req->adapter;

Expand Down
69 changes: 2 additions & 67 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,45 +635,6 @@ struct zfcp_adapter_mempool {
mempool_t *data_gid_pn;
};

struct zfcp_exchange_config_data{
};

struct zfcp_open_port {
struct zfcp_port *port;
};

struct zfcp_close_port {
struct zfcp_port *port;
};

struct zfcp_open_unit {
struct zfcp_unit *unit;
};

struct zfcp_close_unit {
struct zfcp_unit *unit;
};

struct zfcp_close_physical_port {
struct zfcp_port *port;
};

struct zfcp_send_fcp_command_task {
struct zfcp_fsf_req *fsf_req;
struct zfcp_unit *unit;
struct scsi_cmnd *scsi_cmnd;
unsigned long start_jiffies;
};

struct zfcp_send_fcp_command_task_management {
struct zfcp_unit *unit;
};

struct zfcp_abort_fcp_command {
struct zfcp_fsf_req *fsf_req;
struct zfcp_unit *unit;
};

/*
* header for CT_IU
*/
Expand Down Expand Up @@ -781,33 +742,6 @@ struct zfcp_send_els {
int status;
};

struct zfcp_status_read {
struct fsf_status_read_buffer *buffer;
};

struct zfcp_fsf_done {
struct completion *complete;
int status;
};

/* request specific data */
union zfcp_req_data {
struct zfcp_exchange_config_data exchange_config_data;
struct zfcp_open_port open_port;
struct zfcp_close_port close_port;
struct zfcp_open_unit open_unit;
struct zfcp_close_unit close_unit;
struct zfcp_close_physical_port close_physical_port;
struct zfcp_send_fcp_command_task send_fcp_command_task;
struct zfcp_send_fcp_command_task_management
send_fcp_command_task_management;
struct zfcp_abort_fcp_command abort_fcp_command;
struct zfcp_send_ct *send_ct;
struct zfcp_send_els *send_els;
struct zfcp_status_read status_read;
struct fsf_qtcb_bottom_port *port_data;
};

struct zfcp_qdio_queue {
struct qdio_buffer *buffer[QDIO_MAX_BUFFERS_PER_Q]; /* SBALs */
u8 free_index; /* index of next free bfr
Expand Down Expand Up @@ -963,11 +897,12 @@ struct zfcp_fsf_req {
u32 fsf_command; /* FSF Command copy */
struct fsf_qtcb *qtcb; /* address of associated QTCB */
u32 seq_no; /* Sequence number of request */
union zfcp_req_data data; /* Info fields of request */
unsigned long data; /* private data of request */
struct zfcp_erp_action *erp_action; /* used if this request is
issued on behalf of erp */
mempool_t *pool; /* used if request was alloacted
from emergency pool */
struct zfcp_unit *unit;
};

typedef void zfcp_fsf_req_handler_t(struct zfcp_fsf_req*);
Expand Down
Loading

0 comments on commit 059c97d

Please sign in to comment.