Red Hat Bugzilla – Bug 1311138
rescan-scsi-bus.sh removing and re-adding disks it probably shouldn't
Last modified: 2016-05-22 19:35:36 EDT
Description of problem:
With sg3_utils-1.28-8.el6 the rescan-scsi-bus.sh script could be run with the '-r' flag on systems without problems. Updating to sg3_utils-1.28-9.el6_7 this causes filesystems residing on the internal disk to go read-only.
Version-Release number of selected component (if applicable):
Very, and it panicked my test VM twice, just running it.
Steps to Reproduce:
1. Install RHEL 6.7 and sg3_utils
2. Apply all errata
3. run "rescan-scsi-bus.sh -r"
Root filesystem goes read-only
System only removes and re-adds the LUNs that actually has changed.
Debugging this, I found that the fix from BZ#1291579 added double-quotes around two variables when comparing them. That creates a problem when the variable content have varying amount of leading or trailing whitespace.
The observation after putting a bit of debug in the script was the following:
"Host: scsi8 Channel: 00 Id: 01 Lun: 00
Vendor: Model: RHEL6x-2 SSD Rev: F.5C
Type: Direct-Access ANSI SCSI revision: 05"
Where the last two lines correspond to $TMPSTR and $TYPE. This meant the comparison failed and the script erroneously assumed the devices had changed, thus removing them and re-adding them.
Created attachment 1129761 [details]
Here is a proposed patch that simply strips leading and trailing whitespace from the variables and then use that in the comparison. I have tested it in my VM and it seems to work correctly. I have had additional confirmation from the reporter that it resolves the problem in their environment as well.
*** Bug 1311557 has been marked as a duplicate of this bug. ***
This issue has been fixed in sg3_utils-1.28-12.el6 (RHEL 6.8)
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.