linux-stable/fs/zonefs
Damien Le Moal 5cefd8fea6 zonefs: Always invalidate last cached page on append write
commit c1976bd8f2 upstream.

When a direct append write is executed, the append offset may correspond
to the last page of a sequential file inode which might have been cached
already by buffered reads, page faults with mmap-read or non-direct
readahead. To ensure that the on-disk and cached data is consistant for
such last cached page, make sure to always invalidate it in
zonefs_file_dio_append(). If the invalidation fails, return -EBUSY to
userspace to differentiate from IO errors.

This invalidation will always be a no-op when the FS block size (device
zone write granularity) is equal to the page size (e.g. 4K).

Reported-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Fixes: 02ef12a663 ("zonefs: use REQ_OP_ZONE_APPEND for sync DIO")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-06 12:12:42 +02:00
..
Kconfig zonefs: select CONFIG_CRC32 2021-01-04 09:06:42 +09:00
Makefile zonefs: Reorganize code 2023-04-06 12:12:23 +02:00
file.c zonefs: Always invalidate last cached page on append write 2023-04-06 12:12:42 +02:00
super.c zonefs: Separate zone information from inode information 2023-04-06 12:12:23 +02:00
sysfs.c zonefs: Remove to_attr() helper function 2022-11-16 16:08:31 +09:00
trace.h zonefs: Separate zone information from inode information 2023-04-06 12:12:23 +02:00
zonefs.h zonefs: Separate zone information from inode information 2023-04-06 12:12:23 +02:00