Skip to content

Commit

Permalink
Linux: improve truncate pagecache consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Snajdr <[email protected]>
  • Loading branch information
snajpa committed Oct 30, 2024
1 parent 0cbb323 commit 35b1a81
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions module/os/linux/zfs/zfs_znode_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ zfs_trunc(znode_t *zp, uint64_t end)
VERIFY(sa_bulk_update(zp->z_sa_hdl, bulk, count, tx) == 0);

dmu_tx_commit(tx);
truncate_setsize(ZTOI(zp), end);
zfs_rangelock_exit(lr);

return (0);
Expand Down Expand Up @@ -1804,13 +1805,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
error = 0;

out:
/*
* Truncate the page cache - for file truncate operations, use
* the purpose-built API for truncations. For punching operations,
* the truncation is handled under a range lock in zfs_free_range.
*/
if (len == 0)
truncate_setsize(ZTOI(zp), off);
return (error);
}

Expand Down

0 comments on commit 35b1a81

Please sign in to comment.