mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Log an error when we fail to set the COW attribute
Coverity complains about the return value of ioctl not being checked. Even though we carry on when this fails (just like qemu-img does), we can log an error.
This commit is contained in:
parent
11d28050c5
commit
490bf29d50
@ -462,11 +462,16 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
/* Set NOCOW flag. This is an optimisation for btrfs.
|
||||
* The FS_IOC_SETFLAGS ioctl return value will be ignored since any
|
||||
* failure of this operation should not block the left work.
|
||||
* failure of this operation should not block the volume creation.
|
||||
*/
|
||||
if (ioctl(fd, FS_IOC_GETFLAGS, &attr) == 0) {
|
||||
if (ioctl(fd, FS_IOC_GETFLAGS, &attr) < 0) {
|
||||
virReportSystemError(errno, "%s", _("Failed to get fs flags"));
|
||||
} else {
|
||||
attr |= FS_NOCOW_FL;
|
||||
ioctl(fd, FS_IOC_SETFLAGS, &attr);
|
||||
if (ioctl(fd, FS_IOC_SETFLAGS, &attr) < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Failed to set NOCOW flag"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user