Re: [PATCH] zonefs: Always invalidate last cache page on append write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 29, 2023 at 02:58:23PM +0900, Damien Le Moal wrote:
> +	/*
> +	 * If the inode block size (sector size) is smaller than the
> +	 * page size, we may be appending data belonging to an already
> +	 * cached last page of the inode. So make sure to invalidate that
> +	 * last cached page. This will always be a no-op for the case where
> +	 * the block size is equal to the page size.
> +	 */
> +	ret = invalidate_inode_pages2_range(inode->i_mapping,
> +					    iocb->ki_pos >> PAGE_SHIFT, -1);
> +	if (ret)
> +		return ret;

The missing truncate here obviously is a bug and needs fixing.

But why does this not follow the logic in __iomap_dio_rw to to return
-ENOTBLK for any error so that the write falls back to buffered I/O.
Also as far as I can tell from reading the code, -1 is not a valid
end special case for invalidate_inode_pages2_range, so you'll actually
have to pass a valid end here.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux