On Fri, Jun 16, 2017 at 12:50 PM, Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > On Fri, Jun 16, 2017 at 10:55 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: >> On Fri, Jun 16, 2017 at 10:39 AM, zhangyi (F) <yi.zhang@xxxxxxxxxx> wrote: >>> On 2017/6/16 14:02, Amir Goldstein Wrote: >>>> On Fri, Jun 16, 2017 at 6:55 AM, zhangyi (F) <yi.zhang@xxxxxxxxxx> wrote: >>>>> Hi All: >>>>> >>>>> I found another problem about impure upper dir which have left >>>>> whiteout files. If an "impure && not merged" upper dir have >>>>> left whiteout files(last mount created), ovl cannot clear this >>>>> dir when we removing it, which may lead to rmdir fail or temp >>>>> file left in workdir. > > Thanks for the report and patch. > > I think the unlink failures are indicative of a bigger problem, > though: we optimize directory reading (and empty checking) based on > the MERGE flag. This results in the whiteout being returned in the > directory listing in your test case. But not only. Now we already check MERGE || (!UPPER && !IMPURE), so this patch DOES address both empty checking and whiteout filtering in readdir. > > Fortunately we now have a way to identify directories that may contain > whiteouts: the "overlay.origin" xattr. So I think we should switch to > using that instead of the MERGE flag for deciding whether we can use > real readdir and if we need to check for emptiness by iterating the > directory. > Well, IMPURE can be !ORIGIN and then its a waste to check whiteouts, but that is a rare case (ORIGIN object moved into pure upper dir). OTOH, ORIGIN can be !IMPURE (only new files created in merge dir) and I think that is a more common case, so overall, if we have to choose from existing flags and not add new ones (i.e. HAS_WHITEOUTS yuck) then IMO marking IMPURE on whiteout and checking only IMPURE on readdir is the better option. 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