提交 09cbfc04 编写于 作者: J Ján Tomko

storage: fix return values of virStorageBackendWipeExtentLocal

Return -1:
* on all failures of fdatasync. Instead of propagating -errno
  all the way up to the virStorageVolWipe API, which is documented
  to return 0 or -1.
* after a partial wipe. If safewrite failed, we would re-use the
  non-negative return value of lseek (which should be 0 in this case,
  because that's the only offset we seek to).
上级 242e3ea4
...@@ -2002,7 +2002,7 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol, ...@@ -2002,7 +2002,7 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol,
VIR_DEBUG("extent logical start: %ju len: %ju", VIR_DEBUG("extent logical start: %ju len: %ju",
(uintmax_t)extent_start, (uintmax_t)extent_length); (uintmax_t)extent_start, (uintmax_t)extent_length);
if ((ret = lseek(fd, extent_start, SEEK_SET)) < 0) { if (lseek(fd, extent_start, SEEK_SET) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Failed to seek to position %ju in volume " _("Failed to seek to position %ju in volume "
"with path '%s'"), "with path '%s'"),
...@@ -2029,7 +2029,6 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol, ...@@ -2029,7 +2029,6 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol,
} }
if (fdatasync(fd) < 0) { if (fdatasync(fd) < 0) {
ret = -errno;
virReportSystemError(errno, virReportSystemError(errno,
_("cannot sync data to volume with path '%s'"), _("cannot sync data to volume with path '%s'"),
vol->target.path); vol->target.path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册