From owner-freebsd-rc@FreeBSD.ORG Fri Aug 8 00:30:03 2008 Return-Path: Delivered-To: freebsd-rc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F4F5106564A for ; Fri, 8 Aug 2008 00:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3D3E38FC12 for ; Fri, 8 Aug 2008 00:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m780U317057814 for ; Fri, 8 Aug 2008 00:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m780U3Yu057813; Fri, 8 Aug 2008 00:30:03 GMT (envelope-from gnats) Date: Fri, 8 Aug 2008 00:30:03 GMT Message-Id: <200808080030.m780U3Yu057813@freefall.freebsd.org> To: freebsd-rc@FreeBSD.org From: Alex Kozlov Cc: Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second time X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alex Kozlov List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2008 00:30:03 -0000 The following reply was made to PR bin/126324; it has been noted by GNATS. From: Alex Kozlov To: Kris Kennaway , bug-followup@freebsd.org, spam@rm-rf.kiev.ua Cc: Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second time Date: Fri, 8 Aug 2008 03:25:19 +0300 On Thu, Aug 07, 2008 at 06:50:06PM +0000, Alex Kozlov wrote: > The following reply was made to PR bin/126324; it has been noted by GNATS. > > From: Alex Kozlov > To: Kris Kennaway , bug-followup@freebsd.org, > spam@rm-rf.kiev.ua > Cc: > Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second > time > Date: Thu, 7 Aug 2008 21:49:03 +0300 > > On Thu, Aug 07, 2008 at 07:25:49PM +0200, Kris Kennaway wrote: > > Alex Kozlov wrote: > > > > > Well, as alternative We can just don't touch /tmp if it already mounted. > > This is much better on general grounds. > I post patch for review soon. Index: src/etc/rc.d/tmp @@ -37,13 +37,20 @@ load_rc_config $name +is_mounted () +{ + /sbin/mount | /usr/bin/grep -ql $1 && return 0 + return 1 +} + # If we do not have a writable /tmp, create a memory # filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp, -# then it should already be writable). +# then it should already be writable). If we already have /tmp +# mounted somewhere, doing nothing. # case "${tmpmfs}" in [Yy][Ee][Ss]) - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + is_mounted /tmp || mount_md ${tmpsize} /tmp "${tmpmfs_flags}" chmod 01777 /tmp ;; [Nn][Oo]) @@ -57,7 +64,7 @@ echo "dropping into shell, ^D to continue anyway." /bin/sh else - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + is_mounted /tmp || mount_md ${tmpsize} /tmp "${tmpmfs_flags}" chmod 01777 /tmp fi fi