提交 9960f851 编写于 作者: A Andrei Vagin 提交者: Nicholas Bellinger

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: NAndrei Vagin <avagin@openvz.org>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 ce512d79
...@@ -1216,9 +1216,11 @@ sbc_execute_unmap(struct se_cmd *cmd) ...@@ -1216,9 +1216,11 @@ sbc_execute_unmap(struct se_cmd *cmd)
goto err; goto err;
} }
ret = ops->execute_unmap(cmd, lba, range); if (range) {
if (ret) ret = ops->execute_unmap(cmd, lba, range);
goto err; if (ret)
goto err;
}
ptr += 16; ptr += 16;
size -= 16; size -= 16;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册