2002-12-16 12:53:40

by Linux Geek

[permalink] [raw]
Subject: Unmounting a busy RO-Filesystem

I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and
/dev/hda2 for swap.

I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now
remounted ReadOnly.

1) cd '/boot'
2) umount /boot ----> This gives me an error "Device Busy"
3) cd /
4) umount / -------> No error
5) echo $? -----> outputs '0' indicating success. !!!!!!!!

When i do the above by skipping the Sysrq part, i get the usual expected
errors.

So is the above behaviour expected ? I tried this on 2.4.19 & 2.5.51.
Same results.

I am subscribed to the list

TIA
Bourne


2002-12-16 13:13:18

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Unmounting a busy RO-Filesystem

On 16 December 2002 23:06, Bourne wrote:
> I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and
> /dev/hda2 for swap.
>
> I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now
> remounted ReadOnly.
>
> 1) cd '/boot'
> 2) umount /boot ----> This gives me an error "Device Busy"

How do you imagine unmounting a directory when you are in it? ;)

> 3) cd /
> 4) umount / -------> No error

This is special case: "umount /" == "mount -o remount,ro /"

> 5) echo $? -----> outputs '0' indicating success. !!!!!!!!
>
> When i do the above by skipping the Sysrq part, i get the usual
> expected errors.

Without SysRq,

# mount -o remount,ro /

fails 'coz you have files open for writing.
You might ask how kernel can do that ro remount with SysRq?
It cheats! ;)
--
vda

2002-12-16 18:10:16

by Steven Dake

[permalink] [raw]
Subject: Re: Unmounting a busy RO-Filesystem



Denis Vlasenko wrote:

>On 16 December 2002 23:06, Bourne wrote:
>
>
>>I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and
>>/dev/hda2 for swap.
>>
>>I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now
>>remounted ReadOnly.
>>
>>1) cd '/boot'
>>2) umount /boot ----> This gives me an error "Device Busy"
>>
>>
>
>How do you imagine unmounting a directory when you are in it? ;)
>
>
This is possible with a kernel patch called forced unmount. It will
blow away the mount point even if there are files open in it or not.
The best part is it properly closes the superblock so the filesystem
doesn't have to be fsck'ed.

>
>