From c385eea9a1d44e845b0b4189fbcab0ee1aa74dde Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 1 Feb 2024 09:59:47 -0800 Subject: [PATCH] Check for all offline in scoutfs_file_write_iter When we write to file contents we change the data_version. To stage old contents into an offline region the data_version of the file must match the archived copy. When writing we have to make sure that there is no offline data so that we don't increase the data_version which will prevent staging of any other file regions because the data_versions no longer match. scoutfs_file_write_iter was only checking for offline data in its write region, not the entire file. Fix it to match the _aio_write method and check the whole file. Signed-off-by: Zach Brown --- kmod/src/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kmod/src/file.c b/kmod/src/file.c index f572a55d..cac72245 100644 --- a/kmod/src/file.c +++ b/kmod/src/file.c @@ -223,10 +223,8 @@ retry: if (scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, scoutfs_inode_lock)) { /* data_version is per inode, whole file must be online */ - ret = scoutfs_data_wait_check_iter(inode, iocb->ki_pos, from, - SEF_OFFLINE, - SCOUTFS_IOC_DWO_WRITE, - &dw, scoutfs_inode_lock); + ret = scoutfs_data_wait_check(inode, 0, i_size_read(inode), SEF_OFFLINE, + SCOUTFS_IOC_DWO_WRITE, &dw, scoutfs_inode_lock); if (ret != 0) goto out; }