From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: silent semantic changes with reiser4 Date: Thu, 26 Aug 2004 01:11:52 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040826001152.GB23423@mail.shareable.org> References: <20040824202521.GA26705@lst.de> <412CEE38.1080707@namesys.com> <20040825200859.GA16345@lst.de> <20040825204240.GI21964@parcelfarce.linux.theplanet.co.uk> <20040825212518.GK21964@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , Christoph Hellwig , Hans Reiser , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Lyamin aka FLX , ReiserFS List Return-path: Received: from mail.shareable.org ([81.29.64.88]:35269 "EHLO mail.shareable.org") by vger.kernel.org with ESMTP id S266796AbUHZAMC (ORCPT ); Wed, 25 Aug 2004 20:12:02 -0400 To: viro@parcelfarce.linux.theplanet.co.uk Content-Disposition: inline In-Reply-To: <20040825212518.GK21964@parcelfarce.linux.theplanet.co.uk> List-Id: linux-fsdevel.vger.kernel.org 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