public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Li Fei <fei.li@intel.com>,
	pavel@ucw.cz, rjw@sisk.pl, len.brown@intel.com, mingo@redhat.com,
	peterz@infradead.org, biao.wang@intel.com,
	linux-pm@vger.kernel.org, fuse-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, chuansheng.liu@intel.com
Subject: Re: [fuse-devel] [PATCH] fuse: make fuse daemon frozen along with kernel threads
Date: Fri, 8 Feb 2013 15:11:23 +0100	[thread overview]
Message-ID: <20130208141123.GA29460@frosties> (raw)
In-Reply-To: <CAJfpegv1-Db+0DxZ8QUQv9BJiEBG3-8a2YaOVMbkb=Y7m+3DTw@mail.gmail.com>

On Thu, Feb 07, 2013 at 10:59:19AM +0100, Miklos Szeredi wrote:
> [CC list restored]
> 
> On Thu, Feb 7, 2013 at 9:41 AM, Goswin von Brederlow <goswin-v-b@web.de> wrote:
> > On Wed, Feb 06, 2013 at 10:27:40AM +0100, Miklos Szeredi wrote:
> >> On Wed, Feb 6, 2013 at 2:11 AM, Li Fei <fei.li@intel.com> wrote:
> >> >
> >> > There is well known issue that freezing will fail in case that fuse
> >> > daemon is frozen firstly with some requests not handled, as the fuse
> >> > usage task is waiting for the response from fuse daemon and can't be
> >> > frozen.
> >> >
> >> > To solve the issue above, make fuse daemon frozen after all all user
> >> > space processes frozen and during the kernel threads frozen phase.
> >> > PF_FREEZE_DAEMON flag is added to indicate that the current thread is
> >> > the fuse daemon,
> >>
> >> Okay and how do you know which thread, process or processes belong to
> >> the "fuse daemon"?
> >
> > Maybe I'm talking about the wrong thing but isn't any process having
> > /dev/fuse open "the fuse daemon"? And that doesn't even cover cases
> > where one thread reads requests from the kernel and hands them to
> > worker threads (that do not have /dev/fuse themself). Or the fuse
> > request might need mysql to finish a request.
> >
> > I believe figuring out what processes handle fuse requests is a lost
> > proposition.
> 
> Pretty much.
> 
> >
> >
> > Secondly how does freezing the daemon second garanty that it has
> > replied to all pending requests? Or how is leaving it thawed the right
> > decision?
> >
> > Instead the kernel side of fuse should be half frozen and stop sending
> > out new requests. Then it should wait for all pending requests to
> > complete. Then and only then can userspace processes be frozen safely.
> 
> The problem with that is one fuse filesystem might be calling into
> another.  Say two fuse filesystems are mounted at /mnt/A and /mnt/B,
> Process X starts a read request on /mnt/A. This is handled by process
> A, which in turn starts a read request on /mnt/B, which is handled by
> B.  If we freeze the system at the moment when A starts handling the
> request but hasn't yet sent the request to B then things wil be stuck
> and the freezing will fail.
> 
> So the order should be:  Freeze the "topmost" fuse filesystems (A in
> the example) first and if all pending requests are completed then
> freeze the next ones in the hierarchy, etc...  This would work if this
> dependency between filesystems were known.  But it's not and again it
> looks like an impossible task.

What is topmost? The kernel can't know that for sure.
 
> The only way to *reliably* freeze fuse filesystems is to let it freeze
> even if there are outstanding requests.  But that's the hardest to
> implement, because then it needs to allow freezing of tasks waiting on
> i_mutex, for example, which is currently not possible.  But this is
> the only way I see that would not have unsolvable corner cases that
> prop up at the worst moment.
> 
> And yes, it would be prudent to  wait some time for pending requests
> to finish before freezing.  But it's not a requirement, things
> *should* work without that: suspending a machine is just like a very
> long pause by the CPU, as long as no hardware is involved.  And with
> fuse filesystems there is no hardware involved directly by definition.
> 
> But I'm open to ideas and at this stage I think even patches that
> improve the situation for the majority of the cases would be
> acceptable, since this is turning out to be a major problem for a lot
> of people.
> 
> Thanks,
> Miklos

For shutdown in userspace there is the sendsigs.omit.d/ to avoid the
problem of halting/killing processes of the fuse filesystems (or other
services) prematurely. I guess something similar needs to be done for
freeze. The fuse filesystem has to tell the kernel what is up.

MfG
	Goswin

  reply	other threads:[~2013-02-08 14:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  1:11 [PATCH] fuse: make fuse daemon frozen along with kernel threads Li Fei
2013-02-06  9:27 ` Miklos Szeredi
     [not found]   ` <20130207084144.GB6168@frosties>
2013-02-07  9:59     ` [fuse-devel] " Miklos Szeredi
2013-02-08 14:11       ` Goswin von Brederlow [this message]
2013-02-09 17:49         ` Pavel Machek
2013-02-09 20:31           ` Rafael J. Wysocki
2013-02-10 10:33             ` Getting rid of freezer for suspend [was Re: [fuse-devel] [PATCH] fuse: make fuse daemon frozen along with kernel threads] Pavel Machek
2013-02-10 13:51               ` Rafael J. Wysocki
2013-02-10 14:22                 ` Rafael J. Wysocki
2013-02-10 18:55                   ` Pavel Machek
2013-02-10 23:31                     ` Rafael J. Wysocki
2013-02-11 10:11                       ` Miklos Szeredi
2013-02-11 12:08                         ` Rafael J. Wysocki
2013-02-11 13:59                           ` Miklos Szeredi
2013-02-11 19:28                             ` Rafael J. Wysocki
2013-02-12 10:46                             ` Pavel Machek
2013-02-12 13:13                               ` Miklos Szeredi
2013-02-12 13:17                                 ` Miklos Szeredi
2013-02-13 17:34                                   ` Miklos Szeredi
2013-02-13 20:16                                     ` Pavel Machek
2013-02-14 10:31                                       ` Miklos Szeredi
2013-02-13 21:21                                     ` Rafael J. Wysocki
2013-02-14 10:41                                       ` Miklos Szeredi
2013-02-14 12:11                                         ` Rafael J. Wysocki
2013-02-14 13:09                                           ` Miklos Szeredi
2013-02-14 17:38                                             ` Rafael J. Wysocki
2013-02-18  6:26                                               ` Li, Fei
2013-02-18 12:26                                                 ` Rafael J. Wysocki
2013-02-19 10:46                                                   ` Pavel Machek
2013-02-20  2:54                                                     ` Li, Fei
     [not found]                                                       ` <BEC9F67575FA1E429CA7CF5AE9BE3634403505-0J0gbvR4kTiiAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-02-20 13:13                                                         ` Getting rid of freezer for suspend [was " Miklos Szeredi
2013-02-11 10:53                       ` Getting rid of freezer for suspend [was Re: [fuse-devel] " Pavel Machek
2013-02-06  9:56 ` [fuse-devel] [PATCH] fuse: make fuse daemon frozen along with kernel threads Han-Wen Nienhuys
2013-02-06 14:59   ` Miklos Szeredi

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=20130208141123.GA29460@frosties \
    --to=goswin-v-b@web.de \
    --cc=biao.wang@intel.com \
    --cc=chuansheng.liu@intel.com \
    --cc=fei.li@intel.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mingo@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=rjw@sisk.pl \
    /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