Bug 972314 - Every upgrade starts 'ksmd' due to broken initscript 'status' function
Every upgrade starts 'ksmd' due to broken initscript 'status' function
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Michal Novotny
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-08 06:59 EDT by Enrico Scholz
Modified: 2014-02-02 17:39 EST (History)
11 users (show)

See Also:
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 01:59:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple patch that fixes this issue (1.20 KB, patch)
2013-06-25 08:48 EDT, Michal Novotny
no flags Details | Diff

  None (edit)
Description Enrico Scholz 2013-06-08 06:59:29 EDT
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 08:35:19 EDT
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 08:54:24 EDT
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 08:48:44 EDT
Created attachment 765072 [details]
Simple patch that fixes this issue

Simple patch that fixes this issue
Comment 9 Michal Novotny 2013-06-25 09:05:11 EDT
(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 04:11:17 EDT
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 01:59:17 EST
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

Note You need to log in before you can comment on or make changes to this bug.