From mi@aldan.algebra.com  Thu Nov  2 01:14:11 2006
Return-Path: <mi@aldan.algebra.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1E28516A40F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  2 Nov 2006 01:14:11 +0000 (UTC)
	(envelope-from mi@aldan.algebra.com)
Received: from aldan.algebra.com (aldan.algebra.com [216.254.65.224])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A640243D5E
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  2 Nov 2006 01:14:10 +0000 (GMT)
	(envelope-from mi@aldan.algebra.com)
Received: from aldan.algebra.com (aldan [127.0.0.1])
	by aldan.algebra.com (8.13.8/8.13.7) with ESMTP id kA21E9Ix011767
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 1 Nov 2006 20:14:09 -0500 (EST)
	(envelope-from mi@aldan.algebra.com)
Received: (from mi@localhost)
	by aldan.algebra.com (8.13.8/8.13.7/Submit) id kA21E9Rp011766;
	Wed, 1 Nov 2006 20:14:09 -0500 (EST)
	(envelope-from mi)
Message-Id: <200611020114.kA21E9Rp011766@aldan.algebra.com>
Date: Wed, 1 Nov 2006 20:14:09 -0500 (EST)
From: "Mikhail T." <mi@aldan.algebra.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: FS can not be remounted read-only, if a running process' executable was modified
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         105056
>Category:       kern
>Synopsis:       FS can not be remounted read-only, if a running process' executable was modified
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 02 01:20:23 GMT 2006
>Closed-Date:    Thu Mar 29 10:48:59 GMT 2007
>Last-Modified:  Thu Mar 29 11:10:08 GMT 2007
>Originator:     Mikhail T.
>Release:        FreeBSD 6.2-PRERELEASE amd64
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD aldan.algebra.com 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #1: Sat Sep 30 16:33:20 EDT 2006 root@aldan.algebra.com:/meow/obj/var/src/sys/SILVER amd64

>Description:

	If a running process' image is overwritten (such by install-ing
	a new version), the hosting file-system can not be remounted
	read-only until the process exits.

>How-To-Repeat:

	Here is an example. My / is routinely mounted read-only:

		% mount -orw -u /
		% cp -p /bin/sleep /tmp/
		% sleep 3600 &
		% install -m 755 -o root -g bin /tmp/sleep /bin/sleep
		% mount -oro -u /
		mount: /dev/ad4s1a: Device busy

	Ending the running process, allows the read-only remount:

		% kill %
		% mount -oro -u /
		%

>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Feb 15 10:41:21 UTC 2007 
State-Changed-Why:  
Your explaination tells us that you are still using the device (there 
are open and running files from the partition you are trying to remount, 
exiting them will free the partition and will make sure that you can 
remount this). Imo this is not a flaw (please correct me if i am wrong) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105056 
State-Changed-From-To: closed->open 
State-Changed-By: mi 
State-Changed-When: Thu Feb 15 16:28:23 UTC 2007 
State-Changed-Why:  
Correcting. Yes, there are open and running files on the partition, but 
they are open ONLY FOR READING (execution, actually). Thus a ``-o ro 
-u'' remount should succeed, yet it fails... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105056 
State-Changed-From-To: open->closed 
State-Changed-By: mi 
State-Changed-When: Thu Mar 29 10:47:29 UTC 2007 
State-Changed-Why:  
Not possible with the current state of the art. The space 
of the overwritten-but-still-open files will only be reclaimed, 
when they get closed, which requires the fs to be rw until 
then. 

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

From: Alex Kozlov <spam@rm-rf.kiev.ua>
To: bug-followup@FreeBSD.org, mi@aldan.algebra.com, spam@rm-rf.kiev.ua
Cc:  
Subject: Re: kern/105056: FS can not be remounted read-only, if a running
	process' executable was modified
Date: Thu, 29 Mar 2007 14:08:44 +0300

 On Thu, Mar 29, 2007 at 10:48:58AM +0000, Mikhail Teterin wrote:
 > Synopsis: FS can not be remounted read-only, if a running process' executable was modified
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: mi
 > State-Changed-When: Thu Mar 29 10:47:29 UTC 2007
 > State-Changed-Why: 
 > Not possible with the current state of the art. The space
 > of the overwritten-but-still-open files will only be reclaimed,
 > when they get closed, which requires the fs to be rw until
 > then.
 Perhaps better mark as suspended?
 
 
 --
 Adios
>Unformatted:
