Re: silent semantic changes with reiser4

Jamie Lokier
2004-08-26T00:12:37Z

This message suggests a way to extend the VFS safe locking rules to
include files-as-directories.

viro@parcelfarce.linux.theplanet.co.uk wrote:
> Note that currently it's OK - we get "all non-directories are always locked
> after all directories". With filesystem that provides hybrid objects with
> non-NULL ->link() it's not true and we are in deadlock country. Before
> we get anywhere near fs code.

Is this a problem if we treat entering a file-as-directory as crossing
a mount point (i.e. like auto-mounting)?

Simply doing a path walk would lock the file and then cross the mount
point to a directory.

A way to ensure that preserves the lock order is to require that the
metadata is in a different filesystem to its file (i.e. not crossing a
bind mount to the same filesystem).

That has the side effect of preventing hard links between metadata
files and non-metadata, which in my opinion is fine.

Path walking will lock the file, and then lock the directory on a
different filesystem. Lock order is still safe, provided a strict
order is maintained between the two filesystems.

The strict order is ensured by preventing bind mounts which create a
path cycle containing a file->metadata edge. One way to ensure that
is to prevent mounts on the metadata filesystems, but the rule doesn't
have to be that strict. This condition only needs to be checked in
the mount() syscall.

-- Jamie