Re: Linux 3.19-rc3

Peter Zijlstra
2015-01-06T09:59:48Z

On Tue, Jan 06, 2015 at 10:34:30AM +0100, Sedat Dilek wrote:
> I tried to do such a "similiar" (quick) fix analog to the mentioned
> "sched, inotify: Deal with nested sleeps" patch from Peter.
> If I did correct... It does not make the call-trace go away here.

Are you very sure its the same splat and not another? I don't appear to
have anything triggering this on my test boxes (which are very much not
infected with system-disease).

The patch does look about right.

> ---
> fs/notify/fanotify/fanotify_user.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index c991616..65e96e2 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -14,6 +14,7 @@
> #include <linux/types.h>
> #include <linux/uaccess.h>
> #include <linux/compat.h>
> +#include <linux/wait.h>
>
> #include <asm/ioctls.h>
>
> @@ -259,15 +260,15 @@ static ssize_t fanotify_read(struct file *file, char __user *buf,
> struct fsnotify_event *kevent;
> char __user *start;
> int ret;
> - DEFINE_WAIT(wait);
> + DEFINE_WAIT_FUNC(wait, woken_wake_function);
>
> start = buf;
> group = file->private_data;
>
> pr_debug("%s: group=%p\n", __func__, group);
>
> + add_wait_queue(&group->notification_waitq, &wait);
> while (1) {
> - prepare_to_wait(&group->notification_waitq, &wait, TASK_INTERRUPTIBLE);
>
> mutex_lock(&group->notification_mutex);
> kevent = get_one_event(group, count);
> @@ -289,7 +290,7 @@ static ssize_t fanotify_read(struct file *file, char __user *buf,
>
> if (start != buf)
> break;
> - schedule();
> + wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
> continue;
> }
>
> @@ -318,8 +319,8 @@ static ssize_t fanotify_read(struct file *file, char __user *buf,
> buf += ret;
> count -= ret;
> }
> + remove_wait_queue(&group->notification_waitq, &wait);
>
> - finish_wait(&group->notification_waitq, &wait);
> if (start != buf && ret != -EFAULT)
> ret = buf - start;
> return ret;
> --
> 2.2.1
>