[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Messiness in removing directories

Messiness in removing directories

Posted Jun 17, 2018 2:18 UTC (Sun) by ebiederm (subscriber, #35028)
In reply to: Messiness in removing directories by nix
Parent article: Messiness in removing directories

Looking at the code of rmdir, and reading Al's comments I think I see what he is talking about.

The code was changed to do umount -l of anything mounted on the removed directory. However the generic code assumed the directory was empty and so did not umount -l of any files or directories in the removed directory, assuming removed directories
were always empty.

d_invalidate handles the recursive umount -l properly, and is how filesystems like proc with a revalidate handler ultimately
get the job done.

It sounds like there is just a case of some special filesystems that need to call d_invalidate to trigger the unmount instead of leaking things.


to post comments

Messiness in removing directories

Posted Jun 17, 2018 4:52 UTC (Sun) by viro (subscriber, #7872) [Link]

Close, but not quite. We do need something close to d_invalidate(), except that it ought to be combined with recursive removal. There's quite a few places that open-code what's essentially rm -rf. And it has to be done in the code that initiates the removal - there's no way in hell for generic syscalls to guess what would get such treatment.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds