linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-fsdevel@vger.kernel.org,
	Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
Subject: Re: [PATCH] fuse: fix unfreezable tasks
Date: Mon, 21 Jun 2021 11:05:15 +0200	[thread overview]
Message-ID: <CAJfpeguzZXB1d8PrtXA4Um6eFoDDpBpFtLiyogmTWOKB+ksiag@mail.gmail.com> (raw)
In-Reply-To: <fc097829-b4f1-5d8d-fd71-d204c79480dc@omp.ru>

On Fri, 18 Jun 2021 at 21:45, Sergey Shtylyov <s.shtylyov@omp.ru> wrote:
>
> From: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
>
> It could be impossible to freeze the fuse task in request_wait_answer()
> when it calls wait_event_killable() with the FR_FINISHED flag because
> the fuse daemon could be frozen before the task, so it simply can't
> finish a request. E.g. it could be impossible to freeze while doing
> poll() on a fuse FS:
>
> [   90.468003] (0)[]Freezing of tasks aborted after 6.507 seconds
> [   90.468793] (0)[1649:kworker/u8:18]qtaround::mt::A D
> [   90.468830]    0  1590   1102 0x00400009
> [   90.468850] (0)[1649:kworker/u8:18]Call trace:
> [   90.468887] (0)[1649:kworker/u8:18][<ffffff82a7685a44>] __switch_to+0xd8/0xf4
> [   90.468929] (0)[1649:kworker/u8:18][<ffffff82a851fa9c>] __schedule+0x75c/0x964
> [   90.468964] (0)[1649:kworker/u8:18][<ffffff82a851fd14>] schedule+0x70/0x90
> [   90.468995] (0)[1649:kworker/u8:18][<ffffff82a79fec00>] __fuse_request_send+0x228/0x3a4
> [   90.469031] (0)[1649:kworker/u8:18][<ffffff82a79feeec>] fuse_simple_request+0x170/0x1c4
> [   90.469068] (0)[1649:kworker/u8:18][<ffffff82a7a070e0>] fuse_file_poll+0x164/0x1c8
> [   90.469107] (0)[1649:kworker/u8:18][<ffffff82a7851050>] do_sys_poll+0x2f4/0x5a0
> [   90.469142] (0)[1649:kworker/u8:18][<ffffff82a78518f4>] do_restart_poll+0x4c/0x90
> [   90.469178] (0)[1649:kworker/u8:18][<ffffff82a76bb32c>] sys_restart_syscall+0x18/0x20
> [   90.469213] (0)[1649:kworker/u8:18][<ffffff82a76835c0>] el0_svc_naked+0x34/0x38
> [   90.469457] (3)[647:dsme-server]Restarting tasks ...
>
> Use freezer_do_not_count() to tell freezer to ignore the task while it
> waits for event.
>
> [Sergey: added #include <linux/freezer.h>, cleaned up the patch description]
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198879
> Fixes: 7d3a07fcb8a0 (fuse: don't mess with blocking signals)
> Signed-off-by: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>
> ---
> This patch is against the Linus' repo -- I didn't find a tag suitable for
> the fixes in Miklos Szeredi's FUSE repo. :-(
>
>  fs/fuse/dev.c |    3 +++
>  1 file changed, 3 insertions(+)
>
> Index: linux/fs/fuse/dev.c
> ===================================================================
> --- linux.orig/fs/fuse/dev.c
> +++ linux/fs/fuse/dev.c
> @@ -8,6 +8,7 @@
>
>  #include "fuse_i.h"
>
> +#include <linux/freezer.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/poll.h>
> @@ -386,9 +387,11 @@ static void request_wait_answer(struct f
>         }
>
>         if (!test_bit(FR_FORCE, &req->flags)) {
> +               freezer_do_not_count();
>                 /* Only fatal signals may interrupt this */
>                 err = wait_event_killable(req->waitq,
>                                         test_bit(FR_FINISHED, &req->flags));
> +               freezer_count();


This is just and open coded variant of
wait_event_freezekillable_unsafe() which comes with this warning:

/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */

This is a really old issue and unlikely to be properly solvable with a
quick hack...

Thanks,
Miklos

      reply	other threads:[~2021-06-21  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 19:45 [PATCH] fuse: fix unfreezable tasks Sergey Shtylyov
2021-06-21  9:05 ` Miklos Szeredi [this message]

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=CAJfpeguzZXB1d8PrtXA4Um6eFoDDpBpFtLiyogmTWOKB+ksiag@mail.gmail.com \
    --to=miklos@szeredi.hu \
    --cc=i.kamaletdinov@omp.ru \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=s.shtylyov@omp.ru \
    /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;
as well as URLs for NNTP newsgroup(s).