All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Joanne Koong <joannelkoong@gmail.com>,
	Miklos Szeredi <miklos@szeredi.hu>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
	linux-fsdevel@vger.kernel.org, josef@toxicpanda.com,
	bernd.schubert@fastmail.fm, hannes@cmpxchg.org,
	linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH v2 2/2] fuse: remove tmp folio for writebacks and internal rb tree
Date: Mon, 28 Oct 2024 10:02:52 +0800	[thread overview]
Message-ID: <aad84cef-9e13-45f3-b21a-bd059dfa350a@linux.alibaba.com> (raw)
In-Reply-To: <CAJnrk1ZC9fW3y8sc2nyRUzPwwjQhnQuJzCS4+L9Chq49+Ob7Fg@mail.gmail.com>



On 10/26/24 2:19 AM, Joanne Koong wrote:
> On Fri, Oct 25, 2024 at 11:02 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
>>
>> On Fri, 25 Oct 2024 at 19:36, Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>>> That's a great point. It seems like we can just skip waiting on
>>> writeback to finish for fuse folios in sync(2) altogether then. I'll
>>> look into what's the best way to do this.
>>
>> I just tested this, and it turns out this doesn't quite work the way
>> I'd expected.  I can trigger sync(2) being blocked by a suspended fuse
>> server:
>>
>> task:kworker/u16:3   state:D stack:0     pid:172   tgid:172   ppid:2
>>    flags:0x00004000
>> Workqueue: writeback wb_workfn (flush-0:30)
>> Call Trace:
>>  __schedule+0x40b/0xad0
>>  schedule+0x36/0x120
>>  inode_sleep_on_writeback+0x9d/0xb0
>>  wb_writeback+0x104/0x3d0
>>  wb_workfn+0x325/0x490
>>  process_one_work+0x1d8/0x520
>>  worker_thread+0x1af/0x390
>>  kthread+0xcc/0x100
>>  ret_from_fork+0x2d/0x50
>>  ret_from_fork_asm+0x1a/0x30
>>
>> task:dd              state:S stack:0     pid:1364  tgid:1364
>> ppid:1336   flags:0x00000002
>> Call Trace:
>>  __schedule+0x40b/0xad0
>>  schedule+0x36/0x120
>>  request_wait_answer+0x16b/0x200
>>  __fuse_simple_request+0xd6/0x290
>>  fuse_flush_times+0x119/0x140
>>  fuse_write_inode+0x6d/0xc0
>>  __writeback_single_inode+0x36d/0x480
>>  writeback_single_inode+0xa8/0x170
>>  write_inode_now+0x75/0xa0
>>  fuse_flush+0x85/0x1c0
>>  filp_flush+0x2c/0x70
>>  __x64_sys_close+0x2e/0x80
>>  do_syscall_64+0x64/0x140
>>  entry_SYSCALL_64_after_hwframe+0x76/0x7e
>>
>> task:sync            state:D stack:0     pid:1365  tgid:1365
>> ppid:1336   flags:0x00004002
>> Call Trace:
>>  __schedule+0x40b/0xad0
>>  schedule+0x36/0x120
>>  wb_wait_for_completion+0x56/0x80
>>  sync_inodes_sb+0xc5/0x450
>>  iterate_supers+0x69/0xd0
>>  ksys_sync+0x40/0xa0
>>  __do_sys_sync+0xa/0x20
>>  do_syscall_64+0x64/0x140
>>  entry_SYSCALL_64_after_hwframe+0x76/0x7e
>>
> 
> Thanks for the trace. If i'm understanding it correctly, this only
> blocks temporarily until the writeback wb_workfn is rescheduled?
> 
>> Maybe I'm too paranoid about this, and in practice we can just let
>> sync(2) block in any case.  But I want to understand this better
> 
> in the case of a malicious fuse server, it could block sync(2) forever
> so I think this means we have to skip the wait for fuse folios
> altogether.

Right. In summary we need to skip waiting on the completion for the
writeback in case of a malicious fuse server could block sync(2)
forever, and meanwhile the change won't break the backward compatibility
as the current fuse implementation also doesn't wait for the data
actually being written back and persistent on the backstore in sync(2).


-- 
Thanks,
Jingbo

  reply	other threads:[~2024-10-28  2:03 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 18:22 [PATCH v2 0/2] fuse: remove extra page copies in writeback Joanne Koong
2024-10-14 18:22 ` [PATCH v2 1/2] mm: skip reclaiming folios in writeback contexts that may trigger deadlock Joanne Koong
2024-10-14 18:38   ` Shakeel Butt
2024-10-14 21:04     ` Joanne Koong
2024-10-14 23:57       ` Shakeel Butt
2024-10-15 16:59         ` Joanne Koong
2024-10-14 18:22 ` [PATCH v2 2/2] fuse: remove tmp folio for writebacks and internal rb tree Joanne Koong
2024-10-15 10:01   ` Miklos Szeredi
2024-10-15 17:06     ` Joanne Koong
2024-10-15 19:17       ` Shakeel Butt
2024-10-16  9:44         ` Jingbo Xu
2024-10-16  9:57           ` Miklos Szeredi
2024-10-16  9:51         ` Miklos Szeredi
2024-10-16 17:52           ` Shakeel Butt
2024-10-16 18:37             ` Miklos Szeredi
2024-10-16 21:27               ` Shakeel Butt
2024-10-17 13:31                 ` Miklos Szeredi
2024-10-18  5:31                   ` Shakeel Butt
2024-10-21 10:15                     ` Miklos Szeredi
2024-10-21 17:01                       ` Shakeel Butt
2024-10-22 15:03                         ` Miklos Szeredi
2024-10-21 21:05                       ` Joanne Koong
2024-10-24 16:54                         ` Joanne Koong
2024-10-25  1:38                           ` Jingbo Xu
2024-10-25 15:32                             ` Miklos Szeredi
2024-10-25 17:36                             ` Joanne Koong
2024-10-25 18:02                               ` Miklos Szeredi
2024-10-25 18:19                                 ` Joanne Koong
2024-10-28  2:02                                   ` Jingbo Xu [this message]
2024-10-25 18:47                               ` Joanne Koong
2024-10-28  2:28                                 ` Jingbo Xu
2024-10-28 21:57                                   ` Joanne Koong
2024-10-25 22:40                               ` Joanne Koong
2024-10-28 21:58                                 ` Joanne Koong
2024-10-30  9:32                                   ` Bernd Schubert
2024-10-30 16:04                                     ` Joanne Koong
2024-10-30 16:21                                       ` Bernd Schubert
2024-10-30 17:02                                         ` Joanne Koong
2024-10-30 17:27                                           ` Bernd Schubert
2024-10-30 17:35                                             ` Joanne Koong
2024-10-30 21:56                                               ` Shakeel Butt
2024-10-30 22:17                                                 ` Bernd Schubert
2024-10-30 22:51                                                   ` Joanne Koong
2024-10-31  0:30                                                     ` Shakeel Butt
2024-10-31 19:06                                                       ` Joanne Koong
2024-10-31 20:06                                                         ` Shakeel Butt
2024-10-31 21:52                                                           ` Joanne Koong
2024-10-31 22:38                                                             ` Shakeel Butt
2024-11-06 23:37                                                               ` Joanne Koong
2024-11-06 23:56                                                                 ` Shakeel Butt
2024-11-01 11:44                                                             ` Jingbo Xu
2024-11-01 20:54                                                               ` Joanne Koong
2024-11-04  8:09                                                                 ` Jingbo Xu
2024-10-29 22:04                   ` Bernd Schubert
2024-10-16  9:56     ` Jingbo Xu
2024-10-16 10:00       ` Miklos Szeredi
2024-10-18  1:30     ` Joanne Koong
2024-10-18  5:57       ` Shakeel Butt
2024-10-18 19:57         ` Joanne Koong
2024-10-18 20:46           ` Shakeel Butt
2024-10-21  9:32       ` Miklos Szeredi
2024-10-18  9:24   ` Jingbo Xu
2024-10-18 20:29     ` Joanne Koong

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=aad84cef-9e13-45f3-b21a-bd059dfa350a@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=hannes@cmpxchg.org \
    --cc=joannelkoong@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=shakeel.butt@linux.dev \
    /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.