OSDN Git Service

block/file-posix: Try other fallbacks after invalid FALLOC_FL_ZERO_RANGE
authorThomas Huth <thuth@redhat.com>
Thu, 27 May 2021 17:20:20 +0000 (19:20 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 2 Jun 2021 12:23:20 +0000 (14:23 +0200)
commitfa95e9fbab2c19fc07ba82988b1690f8a6ff171b
treeb05b5ef713fd08f51bcb62700f0d000119f0a406
parent73ebf29729d1a40feaa9f8ab8951b6ee6dbfbede
block/file-posix: Try other fallbacks after invalid FALLOC_FL_ZERO_RANGE

If fallocate(... FALLOC_FL_ZERO_RANGE ...) returns EINVAL, it's likely
an indication that the file system is buggy and does not implement
unaligned accesses right. We still might be lucky with the other
fallback fallocate() calls later in this function, though, so we should
not return immediately and try the others first.
Since FALLOC_FL_ZERO_RANGE could also return EINVAL if the file descriptor
is not a regular file, we ignore this filesystem bug silently, without
printing an error message for the user.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210527172020.847617-3-thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/file-posix.c