From b56d9ce6006c14037b83465671981505d36a5eb9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 5 May 2019 15:59:00 +0000 Subject: [PATCH] scst_vdisk: Suggest to disable thin provisioning for ZFS Apparently ZFS does not support FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE. Hence suggest to disable thin provisioning if fallocate() returns -EOPNOTSUPP. See also https://github.com/zfsonlinux/zfs/issues/326. Reported-by: Sietse van Zanen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8344 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index dbfe1e1e4..275cba8a8 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1794,7 +1794,11 @@ static int vdisk_unmap_file_range(struct scst_cmd *cmd, res = fd->f_op->fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, len); - if (unlikely(res != 0)) { + if (unlikely(res == -EOPNOTSUPP)) { + PRINT_WARNING_ONCE("%s: fallocate() is not supported. Consider setting 'thin_provisioned' to 0 in scst.conf.\n", + virt_dev->name); + res = 0; + } else if (unlikely(res != 0)) { PRINT_WARNING_ONCE("fallocate() for %lld, len %lld " "failed: %d", (unsigned long long)off, (unsigned long long)len, res);