From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: Re: Union mounts and fchown/fchmod/utimensat Date: Tue, 30 Mar 2010 16:30:35 -0400 Message-ID: <20100330203035.GA7487@shell> References: <20100326224533.GB29874@shell> <23818.1269704603@jrobl> <20100329183925.GA24328@shell> <20100329234843.GG9876@shareable.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jamie Lokier , "J. R. Okajima" , linux-fsdevel@vger.kernel.org, Alexander Viro , Erez Zadok , Christoph Hellwig To: Theodore Tso Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36237 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754433Ab0C3UbG (ORCPT ); Tue, 30 Mar 2010 16:31:06 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Mar 30, 2010 at 07:16:18AM -0400, Theodore Tso wrote: > Hmmm.... do we also need to worry about read-only fd's of directories, and interaction with the *at() system calls. For example: > > int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) > > ... where olddirfd and newdirfd might be r/o file descriptors for directories participating in a Union mount? > > This is just one example, of course. There's also openat(), symlinkat(), etc. Directories are always copied up in this version of union mounts, so it doesn't matter whether you open a directory O_RDONLY or not, you'll always have the topmost version and see all the effects of link(), linkat(), rename(), renameat(), etc. It's only with files that you can get a stale copy if you open it O_RDONLY and it gets modified through some other path. Always copying up directories solves a lot of problems. I managed to eliminate several hundred lines of code with that change in the design. -VAL