From 4e563735eea4038064cac5f9c02230207a63e708 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 04:37:39 +0000 Subject: [PATCH] Merge r7466 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7719 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 ++ scst/src/scst_lib.c | 4 ++++ scst/src/scst_mem.c | 3 +++ scst/src/scst_targ.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index ecd1f13d4..ae77108eb 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6621,6 +6621,7 @@ static void blockio_endio(struct bio *bio) #endif if (error == -ENOSPC) { struct scst_vdisk_dev *virt_dev = blockio_work->cmd->dev->dh_priv; + WARN_ON(!virt_dev->thin_provisioned); scst_set_cmd_error(blockio_work->cmd, SCST_LOAD_SENSE(scst_space_allocation_failed_write_protect)); @@ -8025,6 +8026,7 @@ static void vdev_check_node(struct scst_vdisk_dev **pvirt_dev, int orig_nodeid) if (virt_dev->numa_node_id != orig_nodeid) { struct scst_vdisk_dev *v; + TRACE_MEM("Realloc virt_dev %s on node %d", virt_dev->name, nodeid); /* It's read-mostly, so cache alignment isn't needed */ v = kzalloc_node(sizeof(*v), GFP_KERNEL, nodeid); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index b521ed9c0..ed24b290e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -13901,6 +13901,7 @@ int scst_get_max_lun_commands(struct scst_session *sess, uint64_t lun) if (sess == NULL) { struct scst_device *dev; + list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { if (dev->handler == &scst_null_devtype) continue; @@ -13916,6 +13917,7 @@ int scst_get_max_lun_commands(struct scst_session *sess, uint64_t lun) struct list_head *head = &sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(lun)]; struct scst_tgt_dev *tgt_dev; + list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (tgt_dev->lun == lun) { res = tgt_dev->dev->max_tgt_dev_commands; @@ -13931,6 +13933,7 @@ int scst_get_max_lun_commands(struct scst_session *sess, uint64_t lun) for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) { struct list_head *head = &sess->sess_tgt_dev_list[i]; struct scst_tgt_dev *tgt_dev; + list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (res > tgt_dev->dev->max_tgt_dev_commands) res = tgt_dev->dev->max_tgt_dev_commands; @@ -15841,6 +15844,7 @@ void scst_update_lat_stats(struct scst_cmd *cmd) if (unlikely((scst_time < 0) || (tgt_time < 0) || (dev_time < 0))) { /* It might happen due to small difference in time between CPUs */ static int q; + if (q++ < 20) { PRINT_WARNING("Ignoring max latency sample, because time is " "moving backward (cmd %p, scst %lld, tgt %lld, " diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index f6f2b924a..553b036ea 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1788,6 +1788,7 @@ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) for (i = 0; i < NR_CPUS; i++) { char name[60]; + if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-%d", i); @@ -1799,6 +1800,7 @@ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) for (i = 0; i < NR_CPUS; i++) { char name[60]; + if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-clust-%d", i); @@ -1810,6 +1812,7 @@ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) for (i = 0; i < NR_CPUS; i++) { char name[60]; + if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-dma-%d", i); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 6d637e765..c3ac19025 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -4468,6 +4468,7 @@ again: } } else if (likely(cmd->tgt_dev != NULL)) { struct scst_order_data *order_data = cmd->cur_order_data; + if (unlikely(order_data->aca_tgt_dev != 0)) { if (!cmd->cmd_aca_allowed) { spin_lock_irq(&order_data->sn_lock); @@ -4504,6 +4505,7 @@ again: if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_ACA) && (cmd->tgt_dev != NULL)) { struct scst_order_data *order_data = cmd->cur_order_data; + spin_lock_irq(&order_data->sn_lock); if (order_data->aca_cmd == cmd) { TRACE_MGMT_DBG("ACA cmd %p finished", cmd); @@ -7196,6 +7198,7 @@ static void __scst_clear_aca(struct scst_tgt_dev *tgt_dev, aca_cmd = order_data->aca_cmd; if (aca_cmd != NULL) { unsigned long flags; + TRACE_MGMT_DBG("Aborting pending ACA cmd %p", aca_cmd); spin_lock_irqsave(&aca_cmd->sess->sess_list_lock, flags); scst_abort_cmd(aca_cmd, mcmd, other_ini, (mcmd != NULL));