Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1400491

Summary: rescan-scsi-bus.sh removes devices after their revision changes
Product: Red Hat Enterprise Linux 7 Reporter: Andreas Bleischwitz <ableisch>
Component: sg3_utilsAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: zguo <zguo>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: ableisch, coughlan, djez, dkutalek, fge, loberman, ovasik
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: sg3_utils-1.37-14.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:54:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851, 1473612, 1546181    
Attachments:
Description Flags
scsi_debug code with rev change patch none

Description Andreas Bleischwitz 2016-12-01 11:27:30 UTC
Description of problem:
"rescan-scsi-bus.sh -r" currently removes and re-adds scsi-disk after their SCSI-Revision changed which could render a system unusable.

Version-Release number of selected component (if applicable):
sg3_utils-1.37-5.el7.x86_64

How reproducible:
Always after SCSI-revision change

Steps to Reproduce:
1. Create virtual machine on a host running qemu-2.4 or lower
2. live migrate that machine to a host running qemu-2.5+
3. issue a "rescan-scsi-bus.sh -r" on the quest

Actual results:
System detects a SCSI-revision change and removes the old-disk and re-adds the disk with the updated revision - which renders the system unusable.

Expected results:
System detects SCSI-revision change and issues a "rescan" to reflect any updates or simply ignores the revision change.

Additional info:
The issue is caused by a revision change of a existing SCSI-disk. This also affects disks which may be presented by a storage-system which gets a firmware upgrade - yes this is possible doing online without interruption of the disk.

Comment 4 Andreas Bleischwitz 2017-02-10 09:48:25 UTC
In case that rescan-scsi-bus.sh with option "-r" can not be changed in the behavior, we should at least remark that this could be a very dangerous action as system-devices could be removed and render the system unusable.

This should be reflected in the output of "--help" and in the manpage at least.

Raised the priority for given reason.

Comment 6 Gris Ge 2017-03-07 14:30:43 UTC
Hi Andreas Bleischwitz,

Changing "-r" behaviour is too risky, I am intend to:

 1. Add new option like '--ignore-rev-change' to skip remove/readd on disks with
    rev change only.
 2. Mark '-r' option as 'DANGEROUS'.

How's that sounds to you?

Comment 7 Andreas Bleischwitz 2017-03-07 14:33:45 UTC
Hi Gris,

sounds reasonable. I'm fine with a opt-out for the "-r" parameter and that this will be marked as potentially dangerous.
That way we would not change current behaviour - which may be intentionally remove devices on revision-changes.
/Andreas

Comment 8 Gris Ge 2017-03-10 10:00:09 UTC
Patch send to upstream for review.

https://github.com/hreinecke/sg3_utils/pull/13

I didn't mark '-r' as dangerous as 'remove' seems already contain dangerous in it.

Comment 9 Gris Ge 2017-03-10 10:20:06 UTC
Hi Andreas Bleischwitz,

I have no idea how to do a live migrate VM.

Could try these rpms in your system for `sudo rescan-scsi-bus.sh -r --ignore-rev`
command:
    http://people.redhat.com/fge/BZ_1400491/

Thank you very much.

Comment 12 Tom Coughlan 2017-04-27 16:32:21 UTC
Not accepted upstream yet.

Comment 14 Red Hat Bugzilla Rules Engine 2017-11-03 13:46:56 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 19 Gris Ge 2018-04-17 13:08:14 UTC
Created attachment 1423018 [details]
scsi_debug code with rev change patch

Reproduce steps:

 * Download attached tarball and extract it.
 * cd scsi_debug-el7-bz-1400491 && sudo make
 * sudo insmod scsi_debug.ko
 * To change revision: 
   echo -n '0001' | sudo tee /sys/module/scsi_debug/parameters/inq_rev
 * To check current revision:
   sg_inq /dev/sdb

Comment 22 Gris Ge 2018-06-12 12:32:10 UTC
`--ignore-rec` option has been added to `rescan-scsi-bus.sh` command.

Comment 27 errata-xmlrpc 2018-10-30 10:54:34 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-2018:3181