From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miklos Szeredi Subject: Re: [PATCH v2 05/11] ovl: lookup redirect by file handle Date: Thu, 27 Apr 2017 09:48:23 +0200 Message-ID: References: <1493025256-27188-1-git-send-email-amir73il@gmail.com> <1493025256-27188-6-git-send-email-amir73il@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org To: Amir Goldstein Cc: Vivek Goyal , Al Viro , "linux-unionfs@vger.kernel.org" , linux-fsdevel List-Id: linux-unionfs@vger.kernel.org On Thu, Apr 27, 2017 at 8:27 AM, Amir Goldstein wrote: > Let me try to explain the problem with a worse case, but not > improbable example: > > Suppose I have an overlay with deep file at /a/b/c/.../z > Suppose the layers are at /old/{lower,upper} I copy them > over to /new/{lower,upper} and mount the overlay at new path. > > Suppose that dcache is fully populated under /new and fully > evicted under /old. > > When trying to decode the file handle for z, exportfs_decode_fh() > will call the file system to actually read all directories a..z from disk > in order to reconnect the dentry of old z all the way up to /old > and it will do that *before* calling the acceptable() callback. > > Alternatively, if we first try to decode the file handle for /old/lower, > decoding will be very fast (most likely already in cache) and we will > not have to continue to decoding z and reading all directories a..z > from disk. To answer my own question in the prev mail: we need to decode the fh and not just blindly use the inum to prevent issues with copied/mutilited/etc lower layers. And yes, in the copied case decoding origin.root first would be a good optimization that couldn't be done without it. > Wait, what do you mean by "we don't special case the layer root?" > Do you mean that we could mount an overlay at a subdir path? > i.e. in the example below, we could mount an overlay with > upperdir=/new/upper/a/b/c,lowerdir=/new/lower/a/b/c? > > If this is what you mean then it is not true that we don't special case > layer root. We do it with path redirect relative to layer root. > If anything, we should be storing origin.root along with overlay.redirect > in order to verify that we are not redirecting into the wrong relative > path. Yeah, you're right, we are special casing layer root.