Re: silent semantic changes with reiser4

From: Jamie Lokier
Date: Wed Aug 25 2004 - 19:14:19 EST


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

viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/