]> err.no Git - linux-2.6/blobdiff - drivers/s390/scsi/zfcp_fsf.c
Pull netlink into release branch
[linux-2.6] / drivers / s390 / scsi / zfcp_fsf.c
index 4c0a59afd5c85bda51083b6cab01588c11268363..0eb31e162b159604b5e6d7cfca9c4e646486b062 100644 (file)
@@ -156,44 +156,30 @@ zfcp_fsf_req_free(struct zfcp_fsf_req *fsf_req)
        kfree(fsf_req);
 }
 
-/**
- * zfcp_fsf_req_dismiss - dismiss a single fsf request
- */
-static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter,
-                                struct zfcp_fsf_req *fsf_req,
-                                unsigned int counter)
-{
-       u64 dbg_tmp[2];
-
-       dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active);
-       dbg_tmp[1] = (u64) counter;
-       debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16);
-       list_del(&fsf_req->list);
-       fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
-       zfcp_fsf_req_complete(fsf_req);
-}
-
-/**
- * zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests
+/*
+ * Never ever call this without shutting down the adapter first.
+ * Otherwise the adapter would continue using and corrupting s390 storage.
+ * Included BUG_ON() call to ensure this is done.
+ * ERP is supposed to be the only user of this function.
  */
 void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
 {
-       struct zfcp_fsf_req *request, *tmp;
+       struct zfcp_fsf_req *fsf_req, *tmp;
        unsigned long flags;
        LIST_HEAD(remove_queue);
-       unsigned int i, counter;
+       unsigned int i;
 
+       BUG_ON(atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status));
        spin_lock_irqsave(&adapter->req_list_lock, flags);
        atomic_set(&adapter->reqs_active, 0);
-       for (i=0; i<REQUEST_LIST_SIZE; i++)
+       for (i = 0; i < REQUEST_LIST_SIZE; i++)
                list_splice_init(&adapter->req_list[i], &remove_queue);
-
        spin_unlock_irqrestore(&adapter->req_list_lock, flags);
 
-       counter = 0;
-       list_for_each_entry_safe(request, tmp, &remove_queue, list) {
-               zfcp_fsf_req_dismiss(adapter, request, counter);
-               counter++;
+       list_for_each_entry_safe(fsf_req, tmp, &remove_queue, list) {
+               list_del(&fsf_req->list);
+               fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
+               zfcp_fsf_req_complete(fsf_req);
        }
 }
 
@@ -828,7 +814,7 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
 
        if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK))) {
                ZFCP_LOG_NORMAL("bug: Reopen port indication received for"
-                               "nonexisting port with d_id 0x%08x on "
+                               "nonexisting port with d_id 0x%06x on "
                                "adapter %s. Ignored.\n",
                                status_buffer->d_id & ZFCP_DID_MASK,
                                zfcp_get_busid_by_adapter(adapter));
@@ -853,7 +839,7 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
                                &status_buffer->status_subtype, sizeof (u32));
                ZFCP_LOG_NORMAL("bug: Undefined status subtype received "
                                "for a reopen indication on port with "
-                               "d_id 0x%08x on the adapter %s. "
+                               "d_id 0x%06x on the adapter %s. "
                                "Ignored. (debug info 0x%x)\n",
                                status_buffer->d_id,
                                zfcp_get_busid_by_adapter(adapter),
@@ -1156,7 +1142,7 @@ zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
        }
 
        ZFCP_LOG_DEBUG("Abort FCP Command request initiated "
-                      "(adapter%s, port d_id=0x%08x, "
+                      "(adapter%s, port d_id=0x%06x, "
                       "unit x%016Lx, old_req_id=0x%lx)\n",
                       zfcp_get_busid_by_adapter(adapter),
                       unit->port->d_id,
@@ -1554,7 +1540,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
 
        case FSF_ACCESS_DENIED:
                ZFCP_LOG_NORMAL("access denied, cannot send generic service "
-                               "command (adapter %s, port d_id=0x%08x)\n",
+                               "command (adapter %s, port d_id=0x%06x)\n",
                                zfcp_get_busid_by_port(port), port->d_id);
                for (counter = 0; counter < 2; counter++) {
                        subtable = header->fsf_status_qual.halfword[counter * 2];
@@ -1576,7 +1562,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
 
         case FSF_GENERIC_COMMAND_REJECTED:
                ZFCP_LOG_INFO("generic service command rejected "
-                             "(adapter %s, port d_id=0x%08x)\n",
+                             "(adapter %s, port d_id=0x%06x)\n",
                              zfcp_get_busid_by_port(port), port->d_id);
                ZFCP_LOG_INFO("status qualifier:\n");
                ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
@@ -1602,7 +1588,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
 
         case FSF_PORT_BOXED:
                ZFCP_LOG_INFO("port needs to be reopened "
-                             "(adapter %s, port d_id=0x%08x)\n",
+                             "(adapter %s, port d_id=0x%06x)\n",
                              zfcp_get_busid_by_port(port), port->d_id);
                debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed");
                zfcp_erp_port_boxed(port);
@@ -1683,7 +1669,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
                                  NULL, &lock_flags, &fsf_req);
        if (ret < 0) {
                 ZFCP_LOG_INFO("error: creation of ELS request failed "
-                             "(adapter %s, port d_id: 0x%08x)\n",
+                             "(adapter %s, port d_id: 0x%06x)\n",
                               zfcp_get_busid_by_adapter(adapter), d_id);
                 goto failed_req;
        }
@@ -1708,7 +1694,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
                                                 ZFCP_MAX_SBALS_PER_ELS_REQ);
                 if (bytes <= 0) {
                         ZFCP_LOG_INFO("error: creation of ELS request failed "
-                                     "(adapter %s, port d_id: 0x%08x)\n",
+                                     "(adapter %s, port d_id: 0x%06x)\n",
                                      zfcp_get_busid_by_adapter(adapter), d_id);
                         if (bytes == 0) {
                                 ret = -ENOMEM;
@@ -1725,7 +1711,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
                                                 ZFCP_MAX_SBALS_PER_ELS_REQ);
                 if (bytes <= 0) {
                         ZFCP_LOG_INFO("error: creation of ELS request failed "
-                                     "(adapter %s, port d_id: 0x%08x)\n",
+                                     "(adapter %s, port d_id: 0x%06x)\n",
                                      zfcp_get_busid_by_adapter(adapter), d_id);
                         if (bytes == 0) {
                                 ret = -ENOMEM;
@@ -1739,7 +1725,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
                 /* reject request */
                ZFCP_LOG_INFO("error: microcode does not support chained SBALs"
                               ", ELS request too big (adapter %s, "
-                             "port d_id: 0x%08x)\n",
+                             "port d_id: 0x%06x)\n",
                              zfcp_get_busid_by_adapter(adapter), d_id);
                 ret = -EOPNOTSUPP;
                 goto failed_send;
@@ -1760,13 +1746,13 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
        ret = zfcp_fsf_req_send(fsf_req);
        if (ret) {
                ZFCP_LOG_DEBUG("error: initiation of ELS request failed "
-                              "(adapter %s, port d_id: 0x%08x)\n",
+                              "(adapter %s, port d_id: 0x%06x)\n",
                               zfcp_get_busid_by_adapter(adapter), d_id);
                goto failed_send;
        }
 
        ZFCP_LOG_DEBUG("ELS request initiated (adapter %s, port d_id: "
-                      "0x%08x)\n", zfcp_get_busid_by_adapter(adapter), d_id);
+                      "0x%06x)\n", zfcp_get_busid_by_adapter(adapter), d_id);
        goto out;
 
  failed_send:
@@ -1859,7 +1845,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
        case FSF_ELS_COMMAND_REJECTED:
                ZFCP_LOG_INFO("ELS has been rejected because command filter "
                              "prohibited sending "
-                             "(adapter: %s, port d_id: 0x%08x)\n",
+                             "(adapter: %s, port d_id: 0x%06x)\n",
                              zfcp_get_busid_by_adapter(adapter), d_id);
 
                break;
@@ -1907,7 +1893,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
 
        case FSF_ACCESS_DENIED:
                ZFCP_LOG_NORMAL("access denied, cannot send ELS command "
-                               "(adapter %s, port d_id=0x%08x)\n",
+                               "(adapter %s, port d_id=0x%06x)\n",
                                zfcp_get_busid_by_adapter(adapter), d_id);
                for (counter = 0; counter < 2; counter++) {
                        subtable = header->fsf_status_qual.halfword[counter * 2];
@@ -2070,7 +2056,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
        ZFCP_LOG_NORMAL("The adapter %s reported the following characteristics:\n"
                        "WWNN 0x%016Lx, "
                        "WWPN 0x%016Lx, "
-                       "S_ID 0x%08x,\n"
+                       "S_ID 0x%06x,\n"
                        "adapter version 0x%x, "
                        "LIC version 0x%x, "
                        "FC link speed %d Gb/s\n",
@@ -3043,6 +3029,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
        queue_designator = &header->fsf_status_qual.fsf_queue_designator;
 
        atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
+                         ZFCP_STATUS_COMMON_ACCESS_BOXED |
                          ZFCP_STATUS_UNIT_SHARED |
                          ZFCP_STATUS_UNIT_READONLY,
                          &unit->status);
@@ -4645,23 +4632,22 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
        fsf_req->adapter = adapter;
        fsf_req->fsf_command = fsf_cmd;
        INIT_LIST_HEAD(&fsf_req->list);
-       
-       /* this is serialized (we are holding req_queue-lock of adapter */
-       if (adapter->req_no == 0)
-               adapter->req_no++;
-       fsf_req->req_id = adapter->req_no++;
-
        init_timer(&fsf_req->timer);
-       zfcp_fsf_req_qtcb_init(fsf_req);
 
        /* initialize waitqueue which may be used to wait on 
           this request completion */
        init_waitqueue_head(&fsf_req->completion_wq);
 
         ret = zfcp_fsf_req_sbal_get(adapter, req_flags, lock_flags);
-        if(ret < 0) {
+        if (ret < 0)
                 goto failed_sbals;
-       }
+
+       /* this is serialized (we are holding req_queue-lock of adapter) */
+       if (adapter->req_no == 0)
+               adapter->req_no++;
+       fsf_req->req_id = adapter->req_no++;
+
+       zfcp_fsf_req_qtcb_init(fsf_req);
 
        /*
         * We hold queue_lock here. Check if QDIOUP is set and let request fail
@@ -4788,7 +4774,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
                retval = -EIO;
                del_timer(&fsf_req->timer);
                spin_lock(&adapter->req_list_lock);
-               zfcp_reqlist_remove(adapter, fsf_req->req_id);
+               zfcp_reqlist_remove(adapter, fsf_req);
                spin_unlock(&adapter->req_list_lock);
                /* undo changes in request queue made for this request */
                zfcp_qdio_zero_sbals(req_queue->buffer,