target: don't call an unmap callback if a range length is zero

If a length of a range is zero, it means there is nothing to unmap
and we can skip this range.

Here is one more reason, why we have to skip such ranges.  An unmap
callback calls file_operations->fallocate(), but the man page for the
fallocate syscall says that fallocate(fd, mode, offset, let) returns
EINVAL, if len is zero. It means that file_operations->fallocate() isn't
obligated to handle zero ranges too.

Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
此提交包含在:
Andrei Vagin
2017-12-13 13:55:13 -08:00
提交者 Nicholas Bellinger
父節點 ce512d79d0
當前提交 9960f85181

查看文件

@@ -1216,9 +1216,11 @@ sbc_execute_unmap(struct se_cmd *cmd)
goto err;
}
ret = ops->execute_unmap(cmd, lba, range);
if (ret)
goto err;
if (range) {
ret = ops->execute_unmap(cmd, lba, range);
if (ret)
goto err;
}
ptr += 16;
size -= 16;