[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] local mounted readonly and exported read write



Wouter Verhelst <w@...112...> writes:

> On Tue, Apr 10, 2012 at 11:18:05AM -0300, Salatiel Filho wrote:
>> Hi guys , i have a doubt.
>> If i have a device , let's say /dev/sdb2 which is mounted locally read
>> only, and this same device is exported using nbd , and mounted
>> readwrite by the client. If the client writes to the Filesystem , this
>> can lead to data corruption ?
>
> Yes, as in, "reads from /dev/sdb2 on the server will probably only get
> you garbage after a while". This is because there's nothing in nbd
> telling the filesystem layer that things have changed in the block
> device it's working with, and that the data it's cached is no longer
> valid.

Worse it can potentially lead to kernel oopses and crash your system.

> There are filesystems who are written to support such a mode of
> operation (e.g., GFS2), but don't try this with "normal" filesystems
> like ext4.
>
> Also, note that "mount -o ro" will still try to write to the filesystem
> if the journal is dirty. Arguably this is a bug in the kernel.

Thereby also endangering the client that has it mounted read-write.

>> Or the local filesystem will just be unable to see the changes until
>> it is remounted ?
>
> No, it doesn't work that way.

MfG
        Goswin



Reply to: