block: handle invalid lseek returns gracefully
commita03083a0170d86ee1baa73476a48e715af665ddb
authorJeff Cody <jcody@redhat.com>
Tue, 3 Apr 2018 04:37:26 +0000 (3 00:37 -0400)
committerKevin Wolf <kwolf@redhat.com>
Tue, 3 Apr 2018 13:25:17 +0000 (3 15:25 +0200)
tree916dab80030414e128ac00fc0e5a8d8cbc690c73
parent3e4d88eabfd6ccceb49885cc026c2778b6d5b7d2
block: handle invalid lseek returns gracefully

In commit 223a23c198787328ae75bc65d84edf5fde33c0b6, we implemented a
workaround in the gluster driver to handle invalid values returned for
SEEK_DATA or SEEK_HOLE.

In some instances, these same invalid values can be seen in the posix
file handler as well - for example, it has been reported on FUSE gluster
mounts.

Calling assert() for these invalid values is overly harsh; we can safely
return -EIO and allow this case to be treated as a "learned nothing"
case (e.g., D4 / H4, as commented in the code).

This patch does the same thing that 223a23c198787 did for gluster.c,
except in file-posix.c

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/file-posix.c