From ggg_mail@inbox.ru  Mon Dec 27 00:32:06 2010
Return-Path: <ggg_mail@inbox.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77D65106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Dec 2010 00:32:06 +0000 (UTC)
	(envelope-from ggg_mail@inbox.ru)
Received: from fallback2.mail.ru (fallback2.mail.ru [94.100.176.87])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F4D88FC13
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Dec 2010 00:32:05 +0000 (UTC)
Received: from smtp6.mail.ru (smtp6.mail.ru [94.100.176.48])
	by fallback2.mail.ru (mPOP.Fallback_MX) with ESMTP id C235E29A6BC4
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Dec 2010 02:43:33 +0300 (MSK)
Received: from [95.27.178.122] (port=3468 helo=atakua.doesntexist.org)
	by smtp6.mail.ru with asmtp 
	id 1PX0FO-0006Ls-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 27 Dec 2010 02:43:30 +0300
Received: by atakua.doesntexist.org (sSMTP sendmail emulation); Mon, 27 Dec 2010 02:43:30 +0300
Message-Id: <E1PX0FO-0006Ls-00.ggg_mail-inbox-ru@smtp6.mail.ru>
Date: Mon, 27 Dec 2010 02:43:30 +0300
From: "Grigory Rechistov" <ggg_mail@inbox.ru>
Reply-To: Grigory Rechistov <ggg_mail@inbox.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: devd cannot be restarted correctly via /etc/rc.d script
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         153460
>Category:       conf
>Synopsis:       devd(8) cannot be restarted correctly via /etc/rc.d script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 00:40:08 UTC 2010
>Closed-Date:    Fri Apr 29 20:58:37 UTC 2011
>Last-Modified:  Fri Apr 29 20:58:37 UTC 2011
>Originator:     Grigory Rechistov
>Release:        FreeBSD 8.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD atakua 8.1-STABLE FreeBSD 8.1-STABLE #3: Wed Oct 20 02:06:12 MSD 2010 root@atakua.doesntexist.org:/usr/obj/usr/src/sys/INTOX i386


	
>Description:
Certain ports, like multimedia/webcamd, ask for devd daemon restart in their pkg-message's . Though when I try to use the regular '/etc/rc.d/devd restart' command I always get this error:
	
Stopping devd.
Waiting for PIDS: 624.
Starting devd.
devd: devd already running, pid: 624
/etc/rc.d/devd: WARNING: failed to start devd

After that no alive 'devd' process exists in system. I have to remove the pidfile manually and then start devd manually.

>How-To-Repeat:
Try to restart devd as root:
# /etc/rc.d/devd restart

You'll end up with no devd running and stale /var/run/devd.pid file preventing it from starting via rc.d scripts.

>Fix:

The run_rc_command() function from /etc/rc.subr file should not only check for pidfile existence but also call check_pidfile() function to verify that the actual process is alive and has name "devd".

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Dec 27 01:10:58 UTC 2010 
Responsible-Changed-Why:  
I'm not sure how to classify this one, but try -rc first. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153460 
State-Changed-From-To: open->patched 
State-Changed-By: dougb 
State-Changed-When: Mon Dec 27 22:50:32 UTC 2010 
State-Changed-Why:  

Patched in r216744 


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Mon Dec 27 22:50:32 UTC 2010 
Responsible-Changed-Why:  

I did the change, I'll handle the MFC 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153460 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/153460: commit references a PR
Date: Mon, 27 Dec 2010 22:52:54 +0000 (UTC)

 Author: dougb
 Date: Mon Dec 27 22:52:47 2010
 New Revision: 216744
 URL: http://svn.freebsd.org/changeset/base/216744
 
 Log:
   Add pidfile [1]
   
   While I'm here, don't run the sysctl frob unconditionally, and
   s/sysctl/$SYSCTL/
   
   PR:		conf/153460 [1]
   Submitted by:	Grigory Rechistov <ggg_mail@inbox.ru>
 
 Modified:
   head/etc/rc.d/devd
 
 Modified: head/etc/rc.d/devd
 ==============================================================================
 --- head/etc/rc.d/devd	Mon Dec 27 22:18:27 2010	(r216743)
 +++ head/etc/rc.d/devd	Mon Dec 27 22:52:47 2010	(r216744)
 @@ -13,11 +13,17 @@
  name="devd"
  rcvar=`set_rcvar`
  command="/sbin/${name}"
 +pidfile=/var/run/${name}.pid
 +
 +start_precmd=${name}_prestart
 +
 +devd_prestart ()
 +{
 +	# If devd is disabled, turn it off in the kernel to avoid memory leaks.
 +	if ! checkyesno ${rcvar}; then
 +	    $SYSCTL hw.bus.devctl_disable=1
 +	fi
 +}
  
  load_rc_config $name
  run_rc_command "$1"
 -
 -# If devd is disabled, turn it off in the kernel to avoid memory leaks.
 -if ! checkyesno ${rcvar}; then
 -    sysctl hw.bus.devctl_disable=1
 -fi
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: dougb 
State-Changed-When: Fri Apr 29 20:58:06 UTC 2011 
State-Changed-Why:  

The change has been MFC'ed to RELENG_[78]. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153460 
>Unformatted:
