diff options
author | Matthew Ahrens <[email protected]> | 2014-09-17 17:25:10 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-09-23 10:38:45 -0700 |
commit | d97aa48f7c53e851675ad5d250daecee1bac81c1 (patch) | |
tree | 81472793ebbb63c12c5bc26d18a4699216742a5d /module/zfs/dnode.c | |
parent | 843b4aad504b791eb1e8dfe6772a55d4da090b65 (diff) |
Illumos 5139 - SEEK_HOLE failed to report a hole at end of file
5139 SEEK_HOLE failed to report a hole at end of file
Reviewed by: Adam Leventhal <[email protected]>
Reviewed by: Alex Reece <[email protected]>
Reviewed by: Christopher Siden <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Max Grossman <[email protected]>
Reviewed by: Peng Dai <[email protected]>
Reviewed by: Richard Elling <[email protected]>
Approved by: Dan McDonald <[email protected]>
References:
https://www.illumos.org/issues/5139
https://github.com/illumos/illumos-gate/commit/0fbc0cd
Ported by: Turbo Fredriksson <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2714
Diffstat (limited to 'module/zfs/dnode.c')
-rw-r--r-- | module/zfs/dnode.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 436816497..20fce9a2d 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -1902,6 +1902,15 @@ dnode_next_offset(dnode_t *dn, int flags, uint64_t *offset, flags, offset, lvl, blkfill, txg); } + /* + * There's always a "virtual hole" at the end of the object, even + * if all BP's which physically exist are non-holes. + */ + if ((flags & DNODE_FIND_HOLE) && error == ESRCH && txg == 0 && + minlvl == 1 && blkfill == 1 && !(flags & DNODE_FIND_BACKWARDS)) { + error = 0; + } + if (error == 0 && (flags & DNODE_FIND_BACKWARDS ? initial_offset < *offset : initial_offset > *offset)) error = SET_ERROR(ESRCH); |