mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Cheng Ding <cding@ddn.com>, Bernd Schubert <bschubert@ddn.com>,
	Miklos Szeredi <miklos@szeredi.hu>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fuse: move page cache invalidation after AIO to workqueue
Date: Fri, 6 Mar 2026 22:10:00 +0800	[thread overview]
Message-ID: <084f9ce5-3532-4455-834e-c4a096e5ecd7@linux.alibaba.com> (raw)
In-Reply-To: <LV1PR19MB88707F9B1F84DC199F99BF25BC7AA@LV1PR19MB8870.namprd19.prod.outlook.com>



On 3/6/26 6:11 PM, Cheng Ding wrote:
> 
>> After reverting my previous patch, I think it would be cleaner by:
>>
>>
>> "The page cache invalidation for FOPEN_DIRECT_IO write in
>> fuse_direct_io() is moved to fuse_direct_write_iter() (with any progress
>> in write), to keep consistent with generic_file_direct_write().  This
>> covers the scenarios of both synchronous FOPEN_DIRECT_IO write
>> (regardless FUSE_ASYNC_DIO) and asynchronous FOPEN_DIRECT_IO write
>> without FUSE_ASYNC_DIO.
> 
> This suggestion sounds good to me.
> 
>>
>>
>>>
>>> +int sb_init_dio_done_wq(struct super_block *sb);
>>> +
>>
>> #include "../internal.h” ?
> 
> We prefer to keep FUSE independent from other parts of the kernel. This way, we can create DKMS packages for the FUSE kernel module.
> 
>>> +                     if (!inode->i_sb->s_dio_done_wq)
>>> +                             res = sb_init_dio_done_wq(inode->i_sb);
>>
>> Better to call sb_init_dio_done_wq() from fuse_direct_IO(), and fail the
>> IO directly if sb_init_dio_done_wq() fails.
>>
>>> +                     if (res >= 0) {
>>> +                             INIT_WORK(&io->work, fuse_aio_invalidate_worker);
>>> +                             queue_work(inode->i_sb->s_dio_done_wq, &io->work);
>> +                             return;
>>                        }
>>
>> Otherwise, the page cache invalidation would be missed if the previous
>> sb_init_dio_done_wq() fails.
> 
> If sb_init_dio_done_wq() fails, res contains the error code, which will be passed to iocb->ki_complete(). However, I can change this if you still prefer to do that in fuse_direct_IO().
> 

Yes I still prefer initializing sb->s_dio_done_wq in advance in
fuse_direct_IO().  Otherwise even you fail the direct IO on failure of
sb_init_dio_done_wq(), the data has been written to the file.


-- 
Thanks,
Jingbo


      parent reply	other threads:[~2026-03-06 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 10:23 Bernd Schubert
2026-03-03 12:03 ` Jingbo Xu
2026-03-03 12:37   ` Bernd Schubert
2026-03-03 14:16     ` Jingbo Xu
     [not found]   ` <LV1PR19MB88707F9B1F84DC199F99BF25BC7AA@LV1PR19MB8870.namprd19.prod.outlook.com>
2026-03-06 14:10     ` Jingbo Xu [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=084f9ce5-3532-4455-834e-c4a096e5ecd7@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=bschubert@ddn.com \
    --cc=cding@ddn.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®