From 5e73767a1b4001452b79ba05e005c5a53b2a28e5 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 20 Dec 2016 06:28:41 +0000 Subject: [PATCH] scst: minor forwarding mode fixes git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7077 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 ++--- scst/src/scst_sysfs.c | 10 ++++------ scst/src/scst_targ.c | 5 +++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 9622e0744..22fe0dbb1 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -1285,8 +1285,7 @@ static const struct scst_sdbops scst_scsi_op_table[] = { {.ops = 0x84, .devkey = "O ", /* implemented only for disks */ .info_op_name = "RECEIVE COPY RESULT", .info_data_direction = SCST_DATA_READ, - .info_op_flags = SCST_FULLY_LOCAL_CMD|SCST_LOCAL_CMD| - SCST_WRITE_EXCL_ALLOWED|SCST_EXCL_ACCESS_ALLOWED, + .info_op_flags = SCST_LOCAL_CMD|SCST_WRITE_EXCL_ALLOWED|SCST_EXCL_ACCESS_ALLOWED, .info_len_off = 10, .info_len_len = 4, .get_cdb_info = get_cdb_info_len_4}, {.ops = 0x85, .devkey = "O O O ", @@ -1322,7 +1321,7 @@ static const struct scst_sdbops scst_scsi_op_table[] = { .info_op_name = "COMPARE AND WRITE", .info_data_direction = SCST_DATA_WRITE, .info_op_flags = SCST_TRANSFER_LEN_TYPE_FIXED| - SCST_FULLY_LOCAL_CMD|SCST_LOCAL_CMD| + SCST_LOCAL_CMD| SCST_WRITE_MEDIUM|SCST_SCSI_ATOMIC, .info_lba_off = 2, .info_lba_len = 8, .info_len_off = 13, .info_len_len = 1, diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index ba5c42e7f..635f1a97d 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -3077,8 +3077,6 @@ static ssize_t scst_dev_sysfs_pr_file_name_show(struct kobject *kobj, res = mutex_lock_interruptible(&dev->dev_pr_mutex); if (res != 0) goto out; - /* pr_file_name is NULL for SCSI pass-through devices */ - WARN_ON_ONCE(!dev->pr_file_name); res = scnprintf(buf, PAGE_SIZE, "%s\n%s", dev->pr_file_name ? : "", dev->pr_file_name_is_set ? SCST_SYSFS_KEY_MARK "\n" : ""); @@ -3900,7 +3898,9 @@ int scst_dev_sysfs_create(struct scst_device *dev) dev->virt_name); goto out_del; } - } else { + } + + if (dev->pr_file_name != NULL) { res = sysfs_create_file(&dev->dev_kobj, &dev_pr_file_name_attr.attr); if (res != 0) { @@ -3909,10 +3909,8 @@ int scst_dev_sysfs_create(struct scst_device *dev) dev->virt_name); goto out_del; } - } #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) - if (dev->scsi_dev == NULL) { res = sysfs_create_file(&dev->dev_kobj, &dev_dump_prs_attr.attr); if (res != 0) { @@ -3920,8 +3918,8 @@ int scst_dev_sysfs_create(struct scst_device *dev) dev_dump_prs_attr.attr.name, dev->virt_name); goto out_del; } - } #endif + } out: TRACE_EXIT_RES(res); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 3311b23bb..6041147ac 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3221,8 +3221,7 @@ int __scst_check_local_events(struct scst_cmd *cmd, bool preempt_tests_only) * All the checks are supposed to be done on the * forwarding requester's side. */ - res = 0; - goto out; + goto skip_reserve; } /* @@ -3255,6 +3254,7 @@ int __scst_check_local_events(struct scst_cmd *cmd, bool preempt_tests_only) * Let's check for ABORTED after scst_pr_is_cmd_allowed(), because * we might sleep for a while there. */ +skip_reserve: if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { TRACE_MGMT_DBG("ABORTED set, aborting cmd %p", cmd); goto out_uncomplete; @@ -3762,6 +3762,7 @@ done: break; EXTRACHECKS_BUG_ON(cmd->state != SCST_CMD_STATE_EXEC_CHECK_SN); + EXTRACHECKS_BUG_ON(cmd->done); cmd->state = SCST_CMD_STATE_EXEC_CHECK_BLOCKING;