diff options
author | Rich Ercolani <[email protected]> | 2022-04-20 19:07:03 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-04-21 16:58:07 -0700 |
commit | c220771a47e4206fb43e6849957657c9504b1b14 (patch) | |
tree | 54b352c60e701179759af2e70ac704c4fda384d2 /module | |
parent | 361dc138b1bdd6b7ec32fbd74b775c55c595f45f (diff) |
Corrected oversight in ZERO_RANGE behavior
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.
Also added a zero-range test to catch this, corrected a flaw
that made the punch-hole test succeed vacuously, and a typo
in file_write.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes #13329
Closes #13338
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/zpl_file.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index 4965815ec..1ed41b9c4 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -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; |