lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55403442-6f35-479b-845c-8659e31491b8@ddn.com>
Date: Sun, 11 Jan 2026 10:43:43 +0100
From: Bernd Schubert <bschubert@....com>
To: Markus Elfring <Markus.Elfring@....de>,
 Jingbo Xu <jefflexu@...ux.alibaba.com>, linux-fsdevel@...r.kernel.org,
 Miklos Szeredi <miklos@...redi.hu>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] fuse: invalidate the page cache after direct write



On 1/11/26 09:18, Markus Elfring wrote:
> [You don't often get email from markus.elfring@....de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> …
>> +++ b/fs/fuse/file.c
>> @@ -667,6 +667,18 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
>>                       struct inode *inode = file_inode(io->iocb->ki_filp);
>>                       struct fuse_conn *fc = get_fuse_conn(inode);
>>                       struct fuse_inode *fi = get_fuse_inode(inode);
>> +                     struct address_space *mapping = io->iocb->ki_filp->f_mapping;
>> +
>> +                     /*
>> +                      * As in generic_file_direct_write(), invalidate after the
>> +                      * write, to invalidate read-ahead cache that may have competed
>> +                      * with the write.
>> +                      */
>> +                     if (io->write && res && mapping->nrpages) {
>> +                             invalidate_inode_pages2_range(mapping,
>> +                                             io->offset >> PAGE_SHIFT,
>> +                                             (io->offset + res - 1) >> PAGE_SHIFT);
>> +                     }
>>
>>                       spin_lock(&fi->lock);
> …
>> @@ -1160,10 +1174,26 @@ static ssize_t fuse_send_write(struct fuse_io_args *ia, loff_t pos,
> …
> -       return err ?: ia->write.out.size;
>> +     /*
>> +      * Without FOPEN_DIRECT_IO, generic_file_direct_write() does the
>> +      * invalidation for us.
>> +      */
>> +     if (!err && written && mapping->nrpages &&
>> +         (ff->open_flags & FOPEN_DIRECT_IO)) {
>> +             /*
>> +              * As in generic_file_direct_write(), invalidate after the
>> +              * write, to invalidate read-ahead cache that may have competed
>> +              * with the write.
>> +              */
>> +             invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT,
>> +                                     (pos + written - 1) >> PAGE_SHIFT);
>> +     }
>> +
>> +     return err ?: written;
> …
> 
> You may omit curly brackets at selected source code places.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19-rc4#n197

We could, but we could also concentrate on code correctness instead of
nit-picky debatable code style.

Thanks,
Bernd


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ