Bug 105056

Summary: FS can not be remounted read-only, if a running process' executable was modified
Product: Base System Reporter: Mikhail T. <freebsd-2024>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.2-PRERELEASE   
Hardware: Any   
OS: Any   

Description Mikhail T. 2006-11-02 01:20:23 UTC
	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 /
		%
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2007-02-15 10:41:21 UTC
State Changed
From-To: open->closed

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)
Comment 2 Mikhail Teterin freebsd_committer freebsd_triage 2007-02-15 16:28:23 UTC
State Changed
From-To: closed->open

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...
Comment 3 Mikhail Teterin freebsd_committer freebsd_triage 2007-03-29 11:47:29 UTC
State Changed
From-To: open->closed

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.
Comment 4 Alex Kozlov 2007-03-29 12:08:44 UTC
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