All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Stange <nicstange@gmail.com>
To: Rajat Jain <rajatxjain@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-newbie@vger.kernel.org, Greg Kroah-Hartman <greg@kroah.com>
Subject: Re: debugfs_remove_recursive() while a file is in use by userspace
Date: Mon, 28 Dec 2015 21:42:49 +0100	[thread overview]
Message-ID: <87poxqqp86.fsf@gmail.com> (raw)
In-Reply-To: <CAA93t1pTkDpaZpQuVu0bQpxsxxUDViKU6-bLbporqkyHCJ0=mw@mail.gmail.com> (Rajat Jain's message of "Mon, 28 Dec 2015 12:27:22 -0800")

Hi Rajat,

Rajat Jain <rajatxjain@gmail.com> writes:

> 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).
>
> Does the function wait
>
> (1) until all the currently executing file operation methods
> (read/write/map etc) have returned?
> 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)?

The current state is that both question are to be answered with "no",
i.e. debugfs file removal is racy.

I've recently sent a patch addressing this issue:
  https://lkml.kernel.org/g/87y4dfukzy.fsf@gmail.com

Basically, it turns the answer to your first question into "yes".
Subsequent reads/writes will return a -EIO.

That patch (series) is still under review though.

Further reference can be found in the *sub*-thread rooted at
  http://thread.gmane.org/gmane.linux.kernel/1452470/focus=1467314

Best,

Nicolai
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" 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.linux-learn.org/faqs

WARNING: multiple messages have this Message-ID (diff)
From: Nicolai Stange <nicstange@gmail.com>
To: Rajat Jain <rajatxjain@gmail.com>
Cc: "linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-newbie@vger.kernel.org, Greg Kroah-Hartman <greg@kroah.com>
Subject: Re: debugfs_remove_recursive() while a file is in use by userspace
Date: Mon, 28 Dec 2015 21:42:49 +0100	[thread overview]
Message-ID: <87poxqqp86.fsf@gmail.com> (raw)
In-Reply-To: <CAA93t1pTkDpaZpQuVu0bQpxsxxUDViKU6-bLbporqkyHCJ0=mw@mail.gmail.com> (Rajat Jain's message of "Mon, 28 Dec 2015 12:27:22 -0800")

Hi Rajat,

Rajat Jain <rajatxjain@gmail.com> writes:

> 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).
>
> Does the function wait
>
> (1) until all the currently executing file operation methods
> (read/write/map etc) have returned?
> 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)?

The current state is that both question are to be answered with "no",
i.e. debugfs file removal is racy.

I've recently sent a patch addressing this issue:
  https://lkml.kernel.org/g/87y4dfukzy.fsf@gmail.com

Basically, it turns the answer to your first question into "yes".
Subsequent reads/writes will return a -EIO.

That patch (series) is still under review though.

Further reference can be found in the *sub*-thread rooted at
  http://thread.gmane.org/gmane.linux.kernel/1452470/focus=1467314

Best,

Nicolai

  parent reply	other threads:[~2015-12-28 20:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28 20:27 debugfs_remove_recursive() while a file is in use by userspace Rajat Jain
2015-12-28 20:30 ` Al Viro
2015-12-28 20:30   ` Al Viro
2015-12-28 20:31 ` Greg Kroah-Hartman
2015-12-28 20:51   ` Rajat Jain
2015-12-28 20:51     ` Rajat Jain
2015-12-28 20:58     ` Greg Kroah-Hartman
2015-12-28 21:11       ` Rajat Jain
2015-12-28 21:17         ` Greg Kroah-Hartman
2015-12-28 21:17           ` Greg Kroah-Hartman
2015-12-28 20:42 ` Nicolai Stange [this message]
2015-12-28 20:42   ` Nicolai Stange
2015-12-28 20:56   ` Rajat Jain
2015-12-28 20:56     ` Rajat Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87poxqqp86.fsf@gmail.com \
    --to=nicstange@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-newbie@vger.kernel.org \
    --cc=rajatxjain@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.