2002-06-11 07:52:26

by Hua Zhong (hzhong)

[permalink] [raw]
Subject: dirty buffers and umount/remount

Hi all:

I have a question that should be simple to answer.

When building a system I need to make sure that whenever user
wants to save configuration to nonvolatile storage (i.e., disk),
all dirty buffers are flushed to disk. Basically I do the following:

1) mount filesystem X from read-only to read-write.
2) save all configuration files to a directory A on X.
3) do a sync.
4) write a label file in A saying "this marks a successful save of
all the configuration files".
5) remount X as read-only.

The problem is that 3) takes quite long time to finish (even most files
in 2) are opened with O_SYNC).

I am wondering if 3) is necessary or not. When the filesystem is remounted
from rw to ro, are all dirty buffers related to it flushed to disk? How
about
umount?

The last related question: is the kdev field in the buffer head the physical
block device (i.e., /dev/hda) or the logical block device (i.e., /dev/hda7)?

Thanks a lot.

Hua


2002-06-11 08:12:16

by Hua Zhong (hzhong)

[permalink] [raw]
Subject: RE: dirty buffers and umount/remount

> I am wondering if 3) is necessary or not. When the filesystem is remounted
> from rw to ro, are all dirty buffers related to it flushed to disk? How
> about umount?
>
> The last related question: is the kdev field in the buffer head
> the physical
> block device (i.e., /dev/hda) or the logical block device (i.e.,
> /dev/hda7)?

auh..it must be the logical device which is passed as the mount point..

I also checked the mount/umount code, and didn't find any part does the
flush.
So I guess data can still be lost after an unmount?

> Thanks a lot.
>
> Hua
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/