This is one of the weirdest problems I’ve had for a while. On one of the servers I look after, my home directory was a zfs filesystem set to /home/user. If I ever did an rm -rf on a directory structure underneath my home dir, it would remove all the files but leave all directories in place. The only way to get rid of the directories was to recursively remove each one. Painful.
Today I discovered a fix - although I don’t know the reason why.
I had a fairly restrictive umask set, system wide, in /etc/profile - 027. When I did ‘zfs set mountpoint=blah’ with that umask I wouldn’t be able to rm -rf successfully. However, if I moved the mountpoint, set umask to 022, then put it back where it should be, rm -rf works fine!
The underlying directory was left when I temporarily shifted the home directory, and it was owned root:root and 750, as the umask would suggest, but why that would then effect the ZFS mount on top of it (which was correctly owned by my own user ID) I do not know.
Anyone know why this would have been?