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] [day] [month] [year] [list]
Message-ID: <6fd06c7f-a30b-4ba5-97aa-b7277d56b190@linux.alibaba.com>
Date: Sun, 11 Jan 2026 15:29:10 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Bernd Schubert <bernd@...ernd.com>, miklos@...redi.hu,
 linux-fsdevel@...r.kernel.org, bschubert@....com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] fuse: invalidate the page cache after direct write



On 1/9/26 10:05 PM, Bernd Schubert wrote:
> 
> 
> On 1/9/26 08:01, Jingbo Xu wrote:
>> -	return err ?: ia->write.out.size;
>> +	/*
>> +	 * As in generic_file_direct_write(), invalidate after the write, to
>> +	 * invalidate read-ahead cache that may have competed with the write.
>> +	 * Without FOPEN_DIRECT_IO, generic_file_direct_write() does the
>> +	 * invalidation for synchronous write.
>> +	 */
>> +	if (!err && written && mapping->nrpages &&
>> +	    ((ff->open_flags & FOPEN_DIRECT_IO) || !ia->io->blocking)) {
>> +		invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT,
>> +					(pos + written - 1) >> PAGE_SHIFT);
>> +	}
>> +
>> +	return err ?: written;
>>  }
> 
> Sorry, but I'm confused about "|| !ia->io->blocking". When we go into this
> code path it either via generic_file_direct_write(), which then
> already invalidates or directly and then 
> (ff->open_flags & FOPEN_DIRECT_IO) is set?
> 

Alright. I mistakenly thought that generic_file_direct_write() will skip
the invalidation for async write (without FOPEN_DIRECT_IO) when
fc->async_dio is false, as the ->direct_IO() will return -EIOCBQUEUED
for async write.

But in fact when fc->async_dio is false, fuse_direct_IO() will wait for
the IO completion and return the number of bytes written on success.
Thus generic_file_direct_write() will do the invalidation in this case.

I will drop "|| !ia->io->blocking" in v3 and add your "Reviewed-by" tag
then.

Thank you for the reviewing!

-- 
Thanks,
Jingbo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ