Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1360915 - --forceremove within rescan-scsi-bus.sh not working as expected
Summary: --forceremove within rescan-scsi-bus.sh not working as expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sg3_utils
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Gris Ge
QA Contact: David Jež
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-27 20:15 UTC by John Pittman
Modified: 2017-08-01 18:56 UTC (History)
4 users (show)

Fixed In Version: sg3_utils-1.37-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 18:56:47 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2048 normal SHIPPED_LIVE sg3_utils bug fix update 2017-08-01 18:13:11 UTC

Description John Pittman 2016-07-27 20:15:10 UTC
Description of problem:

When using rescan-scsi-bus.sh with the --forceremove option, expectation, taken from the --help of the command, is to "Remove and readd every device". Currently, the devices are removed, but we do not readd. Added additional line to ensure readd attempt.

Version-Release number of selected component (if applicable):

sg3_utils-libs-1.37-5.el7.x86_64
sg3_utils-1.37-5.el7.x86_64

How reproducible:

Run 'rescan-scsi-bus.sh --forceremove'
Observe devices are removed and not readded

Actual results:

Devices are removed

Expected results:

Devices should be removed and readded as mentioned in the help

Additional info:

Patch to enable readding:

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index fad4868..f2ae310 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -499,6 +499,7 @@ dolunscan()
         fi
         echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/delete
         sleep 0.02
+       echo "scsi add-single-device $devnr" > /proc/scsi/scsi
       else
         echo "scsi remove-single-device $devnr" > /proc/scsi/scsi
         if test $RC -eq 1 -o $lun -eq 0 ; then

As a note, I submitted the patch upstream on github but never got response.
https://github.com/hreinecke/sg3_utils/pull/5/commits/becd6d75acecc4e816e2e22f7cf649c24b9bd1ac

Comment 5 Gris Ge 2017-03-13 11:57:15 UTC
Hi John Pittman,

Upstream decideded to change help message instead of change action of
`forceremove`, and I would like to keep that way in RHEL 7.

Is that OK to you?

Comment 6 John Pittman 2017-03-13 12:29:08 UTC
Hi Gris.  Yes, that's fine with me.

Comment 9 Gris Ge 2017-03-14 07:15:36 UTC
Help text of forceremove changed:
 old: --forceremove: Remove and readd every device (DANGEROUS)
 new: --forceremove: Remove stale devices (DANGEROUS)

Help text of forcerescan changed:
 old: --forcerescan: Rescan existing devices
 new: --forcerescan: Remove and readd existing devices (DANGEROUS)

Comment 11 Gris Ge 2017-05-10 15:31:57 UTC
Patch submitted to upstream:
https://github.com/hreinecke/sg3_utils/pull/16

Comment 15 errata-xmlrpc 2017-08-01 18:56:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2048


Note You need to log in before you can comment on or make changes to this bug.