Bug 844542

Summary: virtio: Use ida to allocate virtio index
Product: Red Hat Enterprise Linux 6 Reporter: Asias He <asias>
Component: kernelAssignee: Asias He <asias>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: areis, juzhang, lnovich, sluo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-2.6.32-301.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 06:44:07 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:

Description Asias He 2012-07-31 03:14:15 UTC
Description of problem:

    Current index allocation in virtio is based on a monotonically
    increasing variable "index". This means we'll run out of numbers
    after a while. E.g. someone crazy doing this in host side.
    
    while(1) {
        hot-plug a virtio device
        hot-unplug the virito devcie
    }


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

How reproducible:

100%

Steps to Reproduce:
1. hot-plug a virtio device, e.g. virito-blk
2. hot-unplug the virito devcie
3. goto step 1 until loop == 10 times 
4. hot-plug the virtio device

Actual results:
# ls -l /sys/block/vda/device
lrwxrwxrwx 1 root root 0 Jul 30 23:04 /sys/block/vda/device -> ../../../virtio10

Expected results:
The virtio device should pointed to the original virito number instead of increasing monotonically.

Additional info:
Upstream fix is: 90e03207f468e84258270ad07095ef50f925c17d, I will backport to RHEL6.4 soon.

Comment 2 RHEL Program Management 2012-08-10 18:39:07 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 4 Jarod Wilson 2012-08-24 19:27:34 UTC
Patch(es) available on kernel-2.6.32-301.el6

Comment 7 Sibiao Luo 2012-12-17 03:44:14 UTC
Reproduce this issue on 2.6.32-300.el6.x86_64 with the same steps as comment #0.
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-300.el6.x86_64   <---------
qemu-kvm-0.12.1.2-2.334.el6.x86_64
guest info:
# uname -r
2.6.32-300.el6.x86_64   <---------

Results:
after steps 4, the virtio device number will increase monotonically, did not point to the original virito number.
eg:
# ls -l /sys/block/vda/device
lrwxrwxrwx. 1 root root 0 Dec 17 19:00 /sys/block/vda/device -> ../../../virtio10

Verify this issue on 2.6.32-345.el6.x86_64 with the same steps as comment #0.
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-345.el6.x86_64   <---------
qemu-kvm-0.12.1.2-2.334.el6.x86_64
guest info:
# uname -r
2.6.32-345.el6.x86_64   <---------

Results:
The virtio device pointed to the original virtio number instead of increasing monotonically after hot-plug the virtio blk device again.
e.g:
# ls -l /sys/block/vda/device
lrwxrwxrwx. 1 root root 0 Dec 17 19:35 /sys/block/vda/device -> ../../../virtio2

# ls -l /sys/block/vda/device
lrwxrwxrwx. 1 root root 0 Dec 17 19:35 /sys/block/vda/device -> ../../../virtio2

Base on above, this issue has been fixed correctly.

Comment 8 juzhang 2012-12-18 03:12:41 UTC
According to comment7, set this issue as verified.

Comment 10 errata-xmlrpc 2013-02-21 06:44:07 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.

http://rhn.redhat.com/errata/RHSA-2013-0496.html