Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298746

Re: debugfs_remove_recursive() while a file is in use by userspace

From Greg Kroah-Hartman <greg@kroah.com>
Newsgroups linux.kernel
Subject Re: debugfs_remove_recursive() while a file is in use by userspace
Date 2015-12-28 21:40 +0100
Message-ID <qKMKe-7cQ-17@gated-at.bofh.it> (permalink)
References <qKMAy-78z-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Dec 28, 2015 at 12:27:22PM -0800, Rajat Jain wrote:
> Hi,
> 
> I wanted to understand the behavior taken when a module calls
> debugfs_remove_recursive() on a directory, while files under that
> directory may still be in use by the userspace (for instance an
> ongoing read / write operation).

Bad things :(

> Does the function wait
> 
> (1) until all the currently executing file operation methods
> (read/write/map etc) have returned?

Nope.

> OR
> (2) until the user has given up all references (descriptors) to the
> files under the directory (i.e. until release() method has been
> called)?

Nope.

There are some patches on the mailing list that I need to review that
hopefully should resolve this problem, as it's been known for a very
long time.

In short, just don't remove debugfs files unless your module is
unloading, and all should be good as modules are never auto-unloaded.
If you remove debugfs files when a device is removed, be careful.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 21:30 +0100
  Re: debugfs_remove_recursive() while a file is in use by userspace Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-28 21:40 +0100
  Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 21:40 +0100
    Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 22:00 +0100
      Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 22:20 +0100
      Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:20 +0100
    Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:00 +0100
  Re: debugfs_remove_recursive() while a file is in use by userspace Nicolai Stange <nicstange@gmail.com> - 2015-12-28 21:50 +0100
    Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:00 +0100

csiph-web