Re: [PATCH v2 03/23] ovl: store layer index in ovl_layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 5, 2018 at 5:00 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> On Fri, Jan 05, 2018 at 01:22:34PM +0200, Amir Goldstein wrote:
[...]
>
>> 3. Based on the current code, I can post a trivial patch to relax copy up of dir
>>    on encode when ofs->nulower > 1 in case lower dir layer->idx == 1.
>>    Just wasn't sure if that case is worth optimizing, so decided to wait for
>>    comments on the ofs->nulower > 1 behavior.
>
> I must admit, I can't understand this. Please elaborate a bit more.
>

I admit this needs elaborating...

Because middle layers redirects are not "indexed", decoding an overlay
dir file handle that was encoded from a dir in layer > 1 (before copy up)
is complicated and was not implemented in my implementation of NFS export.
The complication is due to the fact that lower dir can have an ancestor in
middle layer above (say in layer 1) that is redirected and we cannot find that
redirect in index.

In V1, NFS export was not supported for ofs->numlower > 1 (lame).
In V2, all dirs are copied up on encode and the upper dir encoded,
so any lower redirect becomes irrelevant when decoding.

Copying up all dirs for ->numlower > 1 to work around middle layer redirects
is a bit of an overkill.
Lower dirs on layer 1 can be exempted from copy up, because they should (*)
not have an ancestor in layer above (upper layer) that is redirected and not
indexed.

So it is easy to apply this relaxing rule if the lower layer index
info is available
in the overlay dir dentry. I did not make that optimization, because I
can't tell
if that will matter to anyone.

(*) NFS export is expected to work well when starting with a clean upper layer
and verify=on, so all copy ups dir and non-dir are indexed. When mounting an
overlay with verify=on, where old non-indexed merge dirs exist, NFS export
will be "best effort", meaning:
- encoding/decoding a non-indexed merge dir works fine whether or not this dir
  is redirected (because decoded upper dir provides the overlay path).
- encoding/decoding a lower dir, whose ancestors is a non-indexed merge dir,
  but NOT redirected works fine (because decoding lower dir yields the
correct path).
- encoding/decoding a lower dir, whose ancestors is a non-indexed merge dir,
  AND redirected will result in -ESTALE

Should probably add a line to documentation about "undefined behavior" when
exporting overlayfs that was not mounted with 'verify=on' to begin with.... and
in the future suggest to run fsck.overlay to index all redirects.

Was I able to clarify more than confusing you??

Amir.
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux