fix scsi add-single-device
PATCH 1/1 fix scsi add-single-device
There was a logic typo in the abstraction of scsi_add_single_device() that meant it could never work.
The attached patch fixes it.
James
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.958 -> 1.959
# drivers/scsi/scsi_scan.c 1.52 -> 1.53
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/01/26 jejb@mulgrave.(none) 1.959
# [SCSI] make echo scsi add-single-device x x x x > /proc/scsi/scsi work again #
# Correct the logic error making it fail
# --------------------------------------------
#
drivers/scsi/scsi_scan.c +1 -1
@@ -1758,7 +1758,7 @@ shost =scsi_host_hn_get (host);if (!shost)return -ENODEV ; -if (scsi_find_device (shost, channel, id, lun) !=NULL ) +if (scsi_find_device (shost, channel, id, lun) ==NULL ) goto out; if (scsi_probe_and_add_lun(shost, NULL, channel, id, lun, NULL) ==
drivers/scsi/scsi_scan.c line 1762
Quoted 10 lines · James Bottomley [[email protected]] wrote:
diff -Nru
a/drivers/scsi/scsi_scan.cb/drivers/scsi/scsi_scan.cdrivers/scsi/scsi_scan.c +1
-1@@ -1758,7 +1758,7 @@ shost =scsi_host_hn_get (host);if (!shost)return -ENODEV ; -if (scsi_find_device (shost, channel, id, lun) !=NULL ) +if (scsi_find_device (shost, channel, id, lun) ==NULL ) goto out;
The previous condition seemed to be correct as you want to exit if scsi_find_device finds a scsi_device at the nexus you are trying to add.
The patch below fixed the interface for me. Though I only tested in with scsi_debug under UML YMMV.
-andmike
--
Michael Anderson
[email protected]
hosts.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
------
drivers/scsi/hosts.h +2 -2
@@ -605,8 +605,8 @@ list_for_each_entry (sdev, &shost->my_devices, siblings)if (sdev->channel == channel && sdev->id == pun && sdev->lun ==lun) -break ; -return sdev; +return sdev; +return NULL ; }/*
Quoted 15 lines · Mike Anderson
drivers/scsi/scsi_scan.c line 1762
Quoted 10 lines · James Bottomley [[email protected]] wrote:
diff -Nru
a/drivers/scsi/scsi_scan.cb/drivers/scsi/scsi_scan.cdrivers/scsi/scsi_scan.c +1
-1@@ -1758,7 +1758,7 @@ shost =scsi_host_hn_get (host);if (!shost)return -ENODEV ; -if (scsi_find_device (shost, channel, id, lun) !=NULL ) +if (scsi_find_device (shost, channel, id, lun) ==NULL ) goto out;The previous condition seemed to be correct as you want to exit if
scsi_find_devicefinds ascsi_deviceat the nexus you are trying to add.
Quoted 2 lines
The patch below fixed the interface for me. Though I only tested in with
scsi_debugunder UML YMMV.
Yes, sorry (long week last week). It is indeed the semantics of scsi_find_device() that are broken.
Thanks,
James