All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Patlasov <mpatlasov@parallels.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel <fuse-devel@lists.sourceforge.net>,
	Anand Avati <avati@gluster.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/6] fuse: fix synchronous case of fuse_file_put()
Date: Wed, 24 Sep 2014 11:19:41 +0400	[thread overview]
Message-ID: <5422708D.20601@parallels.com> (raw)
In-Reply-To: <CAJfpegs3v9EVzoPMgX9_JV+-Y3qy7oWD8tceSi+tnmo=_b=a7A@mail.gmail.com>

On 09/16/2014 12:19 PM, Miklos Szeredi wrote:
> On Thu, Sep 11, 2014 at 6:14 PM, Maxim Patlasov <mpatlasov@parallels.com> wrote:
>
>> I really need your help to proceed with this patch. Could you please explain
>> what those places are where we should allow interruption.
>>
>> BTW, as for "just an optimization", I've recently noticed that __fput()
>> calls locks_remove_file(). So guarantees provided by the patch-set are on
>> the same level as flock(2) behaviour.
> SIGKILL trumps that.  At least that's what I think, and that's what
> NFS currently does as well, AFAICS.
>
>>> Also fuse really should distinguish fatal and non-fatal interruptions
>>> and handle them accordingly...
>>
>> And elaborate on this concern, please.
> Requests have two states where they stay for any significant amount of
> time: PENDING (queued to userspace) and SENT (in userspace).
>
> Currently we do the following for interrupted requests:
>
> PENDING:
>     - non-fatal signal: do nothing
>     - fatal signal: dequeue and return -EINTR, unless force is set
>
> SENT:
>     - send INTERRUPT request to userspace
>
> This is fine, but fatal interrupts should be able to abort SENT and
> forced requests as well without having to wait for the userspace
> reply.  This is what I was referring to.

Thank you for detailed clarification, that's much clearer now. If I 
understood it right, fatal signals must abort *any* request in *any* 
state. The only difference between forced and not forced requests is 
that forced ones must be eventually delivered to userspace in all cases 
(even if they were in PENDING state when we were interrupted and we 
returned -EINTR).

The thing that bothers me is the net result of these changes. Yes, 
end-user will be able to interrupt its app by SIGKIILL if it is waiting 
in request_wait_answer(). But there are many other places where kernel 
fuse waits for something dependent on userspace. Do you think we have to 
make those places interruptible as well?

>
> This would not be difficult, were it not for i_mutex and
> s_vfs_rename_mutex being held by some operations.   For correctness,
> we can't release these while a reply is not received, since the
> locking expecations of the userspace filesystem would not be met.
> This can be solved by adding shadow locks to fuse that we hold onto
> even after the request is interrupted.

Shadow locking seems to be not enough. For example, we have to postpone 
FUSE_RELEASE until all interrupted synchronous I/O is ACKed by 
userspace. And similarly we shouldn't surprise userspace by FUSE_DESTROY 
if any requests are still in-flight. May be there are other hidden 
dependencies that don't come to mind now.

Thanks,
Maxim


  reply	other threads:[~2014-09-24  7:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 16:07 [PATCH 0/6] fuse: handle release synchronously (v3) Maxim Patlasov
2014-08-21 16:08 ` [PATCH 1/6] fuse: add FOPEN_SYNC_RELEASE flag to ff->open_flags Maxim Patlasov
2014-08-21 16:08 ` [PATCH 2/6] fuse: cosmetic rework of fuse_send_readpages Maxim Patlasov
2014-08-21 16:08 ` [PATCH 3/6] fuse: wait for end of IO on release Maxim Patlasov
2014-08-22 14:00   ` Miklos Szeredi
2014-08-25 15:12     ` Maxim Patlasov
2014-08-26  8:42   ` [PATCH 3/6] fuse: wait for end of IO on release (v2) Maxim Patlasov
2014-08-21 16:09 ` [PATCH 4/6] fuse: enable close_wait synchronous release Maxim Patlasov
2014-08-22 14:04   ` Miklos Szeredi
2014-08-25 15:27     ` Maxim Patlasov
2014-08-21 16:09 ` [PATCH 5/6] fuse: fix synchronous case of fuse_file_put() Maxim Patlasov
2014-08-22 14:08   ` Miklos Szeredi
2014-08-25 15:58     ` Maxim Patlasov
2014-09-11 16:14     ` Maxim Patlasov
2014-09-16  8:19       ` Miklos Szeredi
2014-09-24  7:19         ` Maxim Patlasov [this message]
2014-08-21 16:09 ` [PATCH 6/6] fuse: add mount option to disable synchronous release Maxim Patlasov
2014-08-22 14:09   ` Miklos Szeredi
2014-08-22 18:10     ` [fuse-devel] " Anand Avati

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=5422708D.20601@parallels.com \
    --to=mpatlasov@parallels.com \
    --cc=avati@gluster.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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.