Bug 705701

Summary: Host network is unavailable after killing guest
Product: Red Hat Enterprise Linux 5 Reporter: Amos Kong <akong>
Component: kernelAssignee: Red Hat Kernel Manager <kernel-mgr>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7CC: ailan, hiroshi.itani, jasowang, juzhang, michen, szhou
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-04 02:01:48 UTC Type: ---
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: 580948, 705997    

Description Amos Kong 2011-05-18 07:35:14 UTC
Description of problem:
I loged into a remote RHEl5 host by ssh, 
If I kill a guest, the ssh connect would be unavaiable for about 30 seconds.

Version-Release number of selected component (if applicable):
host kernel: 2.6.18-259.el5
kvm-83-232.el5

How reproducible:
always

Steps to Reproduce:
1. login remote rhel5 host
2. boot up a guest (windows or linux)
3. kill qemu process in another terminal
  # killall qemu-kvm
4. ping this rhel5 host from remote machine
  # ping $rhel5_host_ip
  
Actual results:
Host network is unavailable(ping rhel5 host failed),
the ssh connection would resume after about 30 seconds.

Expected results:
Host network is available
can ping rhel5 host successfully

Additional info:
1. qemu cmdline:
#qemu-kvm -name vm1 -monitor unix:/tmp/monitor-humanmonitor1-20110518-143849-kPqq,server,nowait -serial unix:/tmp/serial-20110518-143849-kPqq,server,nowait -drive file=/home/devel/autotest-devel/client/tests/kvm/images/RHEL-Server-5.6-64-virtio.qcow2,index=0,if=virtio,media=disk,cache=none,boot=on,format=qcow2 -net nic,vlan=0,model=virtio,macaddr=9a:79:2f:8b:83:92 -net tap,vlan=0,ifname=t0-143849-kPqq,script=/home/devel/autotest-devel/client/tests/kvm/scripts/qemu-ifup-switch,downscript=no -m 2048 -smp 2,cores=1,threads=1,sockets=2 -cpu qemu64,+sse2 -soundhw ac97 -vnc :0 -rtc-td-hack -M rhel5.6.0 -boot c -usbdevice tablet -no-kvm-pit-reinjection

2. meminfo
MemTotal:      8106828 kB
MemFree:       7923384 kB
Buffers:          3604 kB
Cached:          35144 kB
SwapCached:          0 kB
Active:         104568 kB
Inactive:        13820 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      8106828 kB
LowFree:       7923384 kB
SwapTotal:    10158072 kB
SwapFree:     10157876 kB
Dirty:              72 kB
Writeback:           0 kB
AnonPages:       79620 kB
Mapped:          17908 kB
Slab:            19416 kB
PageTables:       8356 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  14211484 kB
Committed_AS:   276712 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    269660 kB
VmallocChunk: 34359468647 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

3. cpuinfo:
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Core(TM)2 Quad CPU    Q9400  @ 2.66GHz
stepping        : 10
cpu MHz         : 2659.986
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 3
cpu cores       : 4
apicid          : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm constant_tsc pni monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm
bogomips        : 5319.97
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

Comment 1 Amos Kong 2011-05-18 15:38:06 UTC
We can set a fixed mac to bridge before adding interfaces, then mac of bridge would not change, this problem will not occur.

# strace brctl addbr br0
...
socket(PF_FILE, SOCK_STREAM, 0)         = 3
ioctl(3, SIOCBRADDBR, 0x7fff0b1240c6)   = 0
exit_group(0)                           = ?

# ifconfig br0 (got a random address)
br0       Link encap:Ethernet  HWaddr 5a:34:f1:ba:8f:40 

# strace brctl addif br0 eth0 (no ioctl releated with changing mac)
...
ioctl(4, SIOCGIFINDEX, {ifr_name="eth0", ifr_index=2}) = 0
close(4)                                = 0
ioctl(3, SIOCBRADDIF, 0x7fff57c335c0)   = 0
exit_group(0)                           = ?

# ifconfig br0 (got same addr as eth0)
br0       Link encap:Ethernet  HWaddr 00:22:68:16:c9:e8  

# grep SIOCBRADDIF -nr net/bridge/
net/bridge/br_ioctl.c:409:      case SIOCBRADDIF:
net/bridge/br_ioctl.c:411:              return add_del_if(br, rq->ifr_ifindex, cmd == SIOCBRADDIF);

net/bridge/br_ioctl.c:
int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
...
        case SIOCBRDELIF:
                return add_del_if(br, rq->ifr_ifindex, cmd == SIOCBRADDIF);
                           ^
                           |
                           |
net/bridge/br_ioctl.c      v
static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
{
...
        if (isadd)
                ret = br_add_if(br, dev);
                           ^
                           |
                           |
net/bridge/br_if.c:        v
int br_add_if(struct net_bridge *br, struct net_device *dev)
{
...
        changed_addr = br_stp_recalculate_bridge_id(br);
                           ^
                           |
                           |
net/bridge/br_stp_if.c:    v
bool br_stp_recalculate_bridge_id(struct net_bridge *br)
{       
        const unsigned char *br_mac_zero =
                        (const unsigned char *)br_mac_zero_aligned;
        const unsigned char *addr = br_mac_zero;
        struct net_bridge_port *p;
        
        /* user has chosen a value so keep it */ <---- we can set a mac to bridge before adding interfaces
        if (br->flags & BR_SET_MAC_ADDR)
                return false;
        
        list_for_each_entry(p, &br->port_list, list) {
                if (addr == br_mac_zero ||
                    memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
                        addr = p->dev->dev_addr; <---- a 'min' mac address in port_list will be set to bridge
        }



root@t400:/project/rh/linux-2.6# brctl addbr br0
root@t400:/project/rh/linux-2.6# ifconfig br0 (got a random)
br0       Link encap:Ethernet  HWaddr 2e:83:f9:d6:4c:23  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@t400:/project/rh/linux-2.6# ifconfig br0 hw ether 12:23:34:56:78:56
root@t400:/project/rh/linux-2.6# ifconfig br0
br0       Link encap:Ethernet  HWaddr 12:23:34:56:78:56  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@t400:/project/rh/linux-2.6# brctl addif br0 eth0
root@t400:/project/rh/linux-2.6# ifconfig br0
br0       Link encap:Ethernet  HWaddr 12:23:34:56:78:56  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Comment 2 RHEL Program Management 2011-06-21 05:27:25 UTC
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.7 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.

Comment 4 Amos Kong 2011-08-04 02:01:48 UTC
The same bug is reported in bz650097, it's duplicated with libvirt bz609463.

Bug 650097 - network in host become unavailable for few secs when guest quit
Bug 609463 - MAC address of virtual network bridge changes when TAP devices are added/removed

*** This bug has been marked as a duplicate of bug 609463 ***