linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/7] fuse: Introduce generic fuse_copy_aborted()
Date: Thu, 17 Jan 2019 10:48:49 +0100	[thread overview]
Message-ID: <CAJfpegtEujKVTn+coW2+A0Ppu_j=fk7zseQ8LoSiQPvfbRCh3Q@mail.gmail.com> (raw)
In-Reply-To: <154754758189.4244.13193829723902632197.stgit@localhost.localdomain>

On Tue, Jan 15, 2019 at 11:19 AM Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>
> There is no a reason to set individual FR_ABORTED state
> for every request, since fuse_abort_conn() aborts all
> unlocked requests at once. FR_ABORTED bit just makes
> fuse_copy_aborted() to end some of requests, which are
> in the middle of fuse_dev_do_read() and fuse_dev_do_write(),
> but this is not a big deal. These functions may abort
> the requests themselves.
>
> The patch kills lock_request and unlock_request(),
> and introduces generic fuse_copy_aborted() to use
> instead of them. This allows next patches to kill
> FR_ABORTED, FR_LOCKED and FR_PRIVATE, and simplify
> fuse dev read/write function.

Patch is no good: you assume that fuse_copy_args() called from
fuse_dev_do_*() will finish in finite time.  That's not the case if
page fault on userspace buffer is hung (see e.g.
Documentation/filesystems/fuse.txt #Tricky deadlock).

You *are* right that this is a big wart in the current implementation,
and would be really nice to get rid of.  Certainly doable, just need
to make sure all buffers stored in the request are properly refcounted
and have lifetime bound to that of the request, i.e. all synchronous
requests (not background) can be aborted asynchronously, the caller of
the request can return in this case with an abort, yet the request
processing (copy to/from userspace) can finish without encountering
already freed memory.

The fuse_simple_request() thing was a first step in this direction, so
that one's pretty easy to deal with: copy arguments to a temporary
buffer that is freed only when the request itself is freed...

Requests which have pages need special attention.   A ref is taken for
those pages, so they may be OK, but in some cases they may not be.

Thanks,
Miklos

  reply	other threads:[~2019-01-17  9:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 10:19 [PATCH 0/7] fuse: Improve disconnect scheme and avoid taking fpq->lock on hot paths Kirill Tkhai
2019-01-15 10:19 ` [PATCH 1/7] fuse: Check for fc->connected in fuse_dev_alloc() Kirill Tkhai
2019-01-18 12:07   ` Miklos Szeredi
2019-01-18 12:28     ` Kirill Tkhai
2019-01-23  9:45       ` Miklos Szeredi
2019-01-23  9:55         ` Kirill Tkhai
2019-01-23 10:24           ` Miklos Szeredi
2019-01-15 10:19 ` [PATCH 2/7] fuse: Move flush_bg_queue() up in fuse_abort_conn() Kirill Tkhai
2019-01-15 10:19 ` [PATCH 3/7] fuse: Drop and reacquire fc->lock in middle of fuse_abort_conn() Kirill Tkhai
2019-01-15 10:19 ` [PATCH 4/7] fuse: Add fud pointer to struct fuse_copy_state Kirill Tkhai
2019-01-15 10:19 ` [PATCH 5/7] fuse: Introduce generic fuse_copy_aborted() Kirill Tkhai
2019-01-17  9:48   ` Miklos Szeredi [this message]
2019-01-15 10:19 ` [PATCH 6/7] fuse: Kill unused FR_ABORTED, FR_LOCKED and FR_PRIVATE flags Kirill Tkhai
2019-01-15 10:19 ` [PATCH 7/7] fuse: Kill fuse_pqueue::io list and avoid taking fpq->lock on hot paths Kirill Tkhai

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='CAJfpegtEujKVTn+coW2+A0Ppu_j=fk7zseQ8LoSiQPvfbRCh3Q@mail.gmail.com' \
    --to=miklos@szeredi.hu \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).