public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: mingo@kernel.org, oleg@redhat.com, torvalds@linux-foundation.org,
	tglx@linutronix.de, ilya.dryomov@inktank.com,
	umgwanakikbuti@gmail.com, linux-kernel@vger.kernel.org,
	Eric Paris <eparis@parisplace.org>,
	John McCutchan <john@johnmccutchan.com>,
	Robert Love <rlove@rlove.org>
Subject: Re: [RFC][PATCH 4/7] inotify: Deal with nested sleeps
Date: Tue, 5 Aug 2014 09:28:13 +0200	[thread overview]
Message-ID: <20140805072813.GW3935@laptop> (raw)
In-Reply-To: <53E03FD3.5050705@cn.fujitsu.com>

On Tue, Aug 05, 2014 at 10:22:11AM +0800, Lai Jiangshan wrote:
> I don't think this one needs nested sleeps.
> 
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index cc423a3..1ca5888 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -233,15 +233,16 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
>  	group = file->private_data;
>  
>  	while (1) {
> +		mutex_lock(&group->notification_mutex);
>  		prepare_to_wait(&group->notification_waitq, &wait, TASK_INTERRUPTIBLE);
>  
> -		mutex_lock(&group->notification_mutex);
>  		kevent = get_one_event(group, count);
>  		mutex_unlock(&group->notification_mutex);
>  
>  		pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent);
>  
>  		if (kevent) {
> +			__set_current_state(TASK_RUNNING);
>  			ret = PTR_ERR(kevent);
>  			if (IS_ERR(kevent))
>  				break;

Yeah, that'll probably work, but I'm not sure this the place to be
creative like that though. But whatever the inotify people prefer
really.

  reply	other threads:[~2014-08-05  7:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 10:30 [RFC][PATCH 0/7] nested sleeps, fixes and debug infra Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 1/7] wait: Provide infrastructure to deal with nested blocking Peter Zijlstra
2014-08-04 13:44   ` Peter Zijlstra
2014-08-04 18:35     ` Oleg Nesterov
2014-08-04 10:30 ` [RFC][PATCH 2/7] wait: Provide Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 3/7] exit: Desl with nested sleeps Peter Zijlstra
2014-08-04 18:53   ` Oleg Nesterov
2014-08-04 10:30 ` [RFC][PATCH 4/7] inotify: Deal " Peter Zijlstra
2014-08-04 19:23   ` Oleg Nesterov
2014-08-04 21:02     ` Peter Zijlstra
2014-08-05  2:22   ` Lai Jiangshan
2014-08-05  7:28     ` Peter Zijlstra [this message]
2014-08-04 10:30 ` [RFC][PATCH 5/7] tty: " Peter Zijlstra
2014-08-05 23:29   ` Greg Kroah-Hartman
2014-08-04 10:30 ` [RFC][PATCH 6/7] smp: Correctly deal " Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 7/7] sched: Debug " Peter Zijlstra
2014-08-05  8:33 ` [RFC][PATCH 0/7] nested sleeps, fixes and debug infra Ilya Dryomov
2014-08-05 13:06   ` Peter Zijlstra
2014-08-06  7:51     ` Ilya Dryomov
2014-08-06  8:31       ` Peter Zijlstra
2014-08-06 21:16         ` David Miller
2014-08-07  8:10           ` Peter Zijlstra

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=20140805072813.GW3935@laptop \
    --to=peterz@infradead.org \
    --cc=eparis@parisplace.org \
    --cc=ilya.dryomov@inktank.com \
    --cc=john@johnmccutchan.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rlove@rlove.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=umgwanakikbuti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox