Skip to content

Commit

Permalink
Corrected oversight in ZERO_RANGE behavior
Browse files Browse the repository at this point in the history
It turns out, no, in fact, ZERO_RANGE and PUNCH_HOLE do
have differing semantics in some ways - in particular,
one requires KEEP_SIZE, and the other does not.

Signed-off-by: Rich Ercolani <[email protected]>
  • Loading branch information
rincebrain committed Apr 15, 2022
1 parent 0dd34a1 commit c03b64c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,11 +781,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
if (mode & (test_mode)) {
flock64_t bf;

if (offset > olen)
goto out_unmark;
if (mode & FALLOC_FL_KEEP_SIZE) {
if (offset > olen)
goto out_unmark;

if (offset + len > olen)
len = olen - offset;
if (offset + len > olen)
len = olen - offset;
}
bf.l_type = F_WRLCK;
bf.l_whence = SEEK_SET;
bf.l_start = offset;
Expand Down

0 comments on commit c03b64c

Please sign in to comment.