Bug 972314

Summary: Every upgrade starts 'ksmd' due to broken initscript 'status' function
Product: Red Hat Enterprise Linux 6 Reporter: Enrico Scholz <rh-bugzilla>
Component: qemu-kvmAssignee: Michal Novotny <minovotn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, areis, bsarathy, chayang, juzhang, lnovich, michen, mkenneth, qzhang, virt-maint, ypu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.380.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 06:59:17 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:
Attachments:
Description Flags
Simple patch that fixes this issue none

Description Enrico Scholz 2013-06-08 10:59:29 UTC
Description of problem:

[root@bintak qemu]# /etc/init.d/ksm stop
Stopping ksm:                                              [  OK  ]
[root@bintak qemu]# /etc/init.d/ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]

--> 'service ksm condrestart' (which is executed by %post script) starts always ksm.

This happens due do broken status() function:

----
status() {
         ...
        RETVAL=0
    fi; fi
}
  ...

  condrestart|try-restart)
        status >/dev/null 2>&1 || exit 0
        restart
----

E.g. 'RETVAL' is computed but never returned so that 'status' always succeeds and the 'restart' is executed unconditionally.


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

qemu-kvm-0.12.1.2-2.355.el6_4.5.x86_64

Comment 2 Qunfang Zhang 2013-06-08 12:35:19 UTC
Reproduce this issue on qemu-kvm-0.12.1.2-2.375.el6.x86_64.

1. Stop ksm service
[root@localhost home]# service  ksm stop
Stopping ksm:                                              [  OK  ]

2. [root@localhost home]# service ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]
[root@localhost home]# 

Expected result:
After step 2, ksm should not be restarted if it's stopped previously.

Comment 3 Ademar Reis 2013-06-12 12:54:24 UTC
Enrico, thanks for taking the time to enter a bug report with us. We appreciate
the feedback and look to use reports such as this to guide our efforts at
improving our products. That being said, we're not able to  guarantee the
timeliness or suitability of a resolution for issues entered here because this
is not a mechanism for requesting support.

If this issue is critical or in any way time sensitive, please raise a ticket
through your regular Red Hat support channels to make certain  it receives the
proper attention and prioritization to assure a timely resolution.

For information on how to contact the Red Hat production support team, please
visit: https://www.redhat.com/support/process/production/#howto

Comment 7 Michal Novotny 2013-06-25 12:48:44 UTC
Created attachment 765072 [details]
Simple patch that fixes this issue

Simple patch that fixes this issue

Comment 9 Michal Novotny 2013-06-25 13:05:11 UTC
(In reply to Enrico Scholz from comment #0)
> Description of problem:
> 
> [root@bintak qemu]# /etc/init.d/ksm stop
> Stopping ksm:                                              [  OK  ]
> [root@bintak qemu]# /etc/init.d/ksm condrestart
> Stopping ksm:                                              [  OK  ]
> Starting ksm:                                              [  OK  ]
> 
> --> 'service ksm condrestart' (which is executed by %post script) starts
> always ksm.
> 
> This happens due do broken status() function:
> 
> ----
> status() {
>          ...
>         RETVAL=0
>     fi; fi
> }
>   ...
> 
>   condrestart|try-restart)
>         status >/dev/null 2>&1 || exit 0
>         restart
> ----
> 
> E.g. 'RETVAL' is computed but never returned so that 'status' always
> succeeds and the 'restart' is executed unconditionally.
> 
> 
> Version-Release number of selected component (if applicable):
> 
> qemu-kvm-0.12.1.2-2.355.el6_4.5.x86_64

Thanks for your analysis Enrico. You are correct, it's been caused by return value not used. See comment #7 for fix :-)

Thanks,
Michal

Comment 12 Qunfang Zhang 2013-07-09 08:11:17 UTC
Verified pass on qemu-kvm-0.12.1.2-2.377.el6.

[root@t2 home]# service  ksm stop
Stopping ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is not running
[root@t2 home]# service ksm condrestart
[root@t2 home]# 
[root@t2 home]# service  ksm status
ksm is not running
[root@t2 home]# 
[root@t2 home]# service ksm start
Starting ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is running
[root@t2 home]# service ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is running

Comment 16 errata-xmlrpc 2013-11-21 06:59:17 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-1553.html