[PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

David Howells dhowells at redhat.com
Thu Oct 10 21:34:59 AEDT 2024


Zizhi Wo <wozizhi at huawei.com> wrote:

> In the __cachefiles_prepare_write function, DIO aligns blocks using
> PAGE_SIZE as the unit. And currently cachefiles_add_cache() binds
> cache->bsize with the requirement that it must not exceed PAGE_SIZE.
> However, if cache->bsize is smaller than PAGE_SIZE, the calculated block
> count will be incorrect in __cachefiles_prepare_write().
> 
> Set the block size to cache->bsize to resolve this issue.

Have you tested this with 9p, afs, cifs, ceph and/or nfs?  This may cause an
issue there as it assumed that the cache file will be padded out to
PAGE_SIZE (see cachefiles_adjust_size()).

David



More information about the Linux-erofs mailing list