I found I needed to change a comparison in au_lkup_dentry in dentry.c
to make aufs work for me.  It's line #182 in aufs-4.1:
https://github.com/sfjro/aufs4-linux/blob/aufs4.1/fs/aufs/dentry.c#L182

Old line:
        if (au_dbwh(dentry) >= 0)
New line:
        if (au_dbwh(dentry) == bindex)

Directories were becoming undeletable for me when there were multiple
layers of whited-out directories underneath them.  I have aufs for
root and was partially through a major upgrade so I couldn't really
use my system until I resolved the issue, and was rather focusing on
just making it work, but I think the problem scenario was something
like this:
- 3 layers of +wh under the rw layer on top
- Bottom layer has folder A with files inside it
- Second-to-bottom layer has a whiteout deleting folder A on bottom layer
- Second-to-top layer has folder A recreated with files inside it
- Go into rw top mount, remove all files from A.  Works fine.
- Rmdir A.  Immediately reappears containing the files again.

I found the problem was that aufs was deciding not to add a whiteout
for the folder when it was rmdir'd because it believed it was already
whited out.  But the whiteout that was causing this check to pass was
beneath a new copy of the folder, so those new contents reappeared.
The change above makes sure the whiteout in that check is at the
folder layer the check is considering, so it won't short circuit until
it's finished checking all the folders on higher layers.

I don't fully understand the workings of aufs to know if this is the
proper solution, but my filesystem seems stable now with this change.

------------------------------------------------------------------------------

Reply via email to