On Mon, Jun 19, 2017 at 6:00 AM, zhangyi (F) <yi.zhang@xxxxxxxxxx> wrote: > There is another problem about impure upper dir which have left > whiteout files(the first one is whiteout exposure). 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. > > Reproducer: > mkdir lower upper work merge > mkdir -p lower/dir > touch lower/dir/a > mount -t overlay overlay -olowerdir=lower,upperdir=upper,\ > workdir=work merge > rm merge/dir/a > umount merge > rm -rf lower/* > touch lower/dir (*) > mount -t overlay overlay -olowerdir=lower,upperdir=upper,\ > workdir=work merge > rm -rf merge/dir > > Syslog dump: > overlayfs: cleanup of 'work/#7' failed (-39) > > (*): if we are not creat this file, the result is different: > rm: cannot remove "dir/": Directory not empty > > This patch add impure flag on parent dir in ovl_remove_and_whiteout() > to indicate the dir is impure, and then check and clean it when > removing this dir. I still don't like adding the impure flag because of a whiteout. Impure dir means it contains a copied up object. In fact a valid (but probably not worthwhile) optimizition would be to remove the impure flag on removal of the last copied up object. What's wrong with testing for (origin || merge) to see if we need to check for whiteouts? Thanks, Miklos -- 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