Skip to contentSkip to conversation

Can't rmdir an empty directory when using overlayfs

DISCUSSION Francis Moreau 1 participant 1 message Aug 28, 2014 VFS

lore
Share & tools
lore
#0 lore raw

Hello,

I've a weird problem when using overlayfs.

The version I'm using is quite old, it's v12 on top of a 3.4 kernel. I guess the patches are coming from:

http://git.kernel.org/cgit/linux/kernel/git/apw/overlayfs.git/log/?h=overlayfs.v12apw1

Sorry if the version is old but I'm stick with 3.4 and v12 seems the latest version available for this kernel.

My problem is that I can't rmdir an empty directory, it fails with 'device or resource busy'.

This directory is created by an application and is used to mount a block device. Once the job is finished the block device is unmounted and finally app tries to rmdir it.

The directory doesn't seem to be a mountpoint (anymore). Looking in /proc/mounts confirm this.

I tried to trace what's going on in the kernel when calling the syscall 'rmdir' and found that it's currently failing in vfs_rmdir() when testing for that particular condition:

error = -EBUSY;
if (d_mountpoint(dentry))

         goto out;

If I'm not mistaken, the kernel still thinks that the directory is a mountpoint.

Another weird behaviour is that if I'm touching/modifying some unrelated files (not in the directory) before starting my app, then the issue disappear.

Does this issue seem to be an old known issue ?

Thanks !