Re: [PATCH] ovl: fix visible whiteout on not merged dir

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

 



On Thu, May 4, 2017 at 11:36 AM, zhangyi (F) <yi.zhang@xxxxxxxxxx> wrote:

>   Hi Amir:
>
>   Thanks for your valuable time.
>
>   I just found this problem inadvertently when I did some tests.
>   Indeed, cases 1 and 2 may not happen unless user hand crafted, and
>   I don't have these use cases.:)

That's what I thought.

>
>   I saw your patches pushed to overlayfs-constino.v5 last night and V3.
>   We can use OVL_TYPE_COPYUP to figure out dir that has *ever* been copied up,
>   and use the merged flow in ovl_iterate() for these directories.
>

Yes, but keep in mind that OVL_TYPE_COPYUP from v3 did not make it into v5
and it's not trivial to add it back.

After I rebase my OVL_TYPE_COPYUP patches over v5 I'll make the patch
to replace is_real = !OVL_TYPE_MERGE() with !OVL_TYPE_COPYUP()
and let you know so you can test it.

>   I have another two ideas, please assess:
>
>   1. I think we can use an xattr 'overlay.whiteout' to count the whiteouts
>      the OVL_TYPE_COPYUP dir have. We increase count in ovl_remove_and_whiteout()
>      and decrease count in ovl_create_over_whiteout(), so we can make sure
>      the dir have created whiteout or not more accurate.(is it necessary ?)

It's not going to be easy to update overlay.whiteout 'atomically',
because you need to update it either before or after creating/removing
whiteout and both possibilities can get it out of sync.

A simpler optimization would be to set an 'overlay.impure' xattr on a directory
*before* creating the first whiteout AND before creating/moving a COPYUP object
into the dir (so only creating uppers leave the upper dir pure).

So there is no process of purifying a dir, but an upper dir is pure until proven
otherwise by ovl_set_dir_impure() (or by finding 'overlay.impure').

With that optimization, we can set:
is_real = !OVL_TYPE_MERGE() && !ovl_dir_impure();

very similar to your suggestion (but with a twist)

For my use case (lower dirs can disappear underneath) this sort of
optimization can be useful.

>
>   2. Can we read underlying dir entry and get rid of whiteout every time for
>      the 'impure' dircetory, not execute the merged flow ? It will save
>      memory usage.
>

Did not understand this questions.

Cheers,
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