[libvirt PATCH] util: Fix logic in virFileSetCOW

Jiri Denemark posted 1 patch 3 years, 8 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/9d9409be903871c29c8709ca7532ac7bcfdf2546.1596616401.git.jdenemar@redhat.com
src/util/virfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] util: Fix logic in virFileSetCOW
Posted by Jiri Denemark 3 years, 8 months ago
When COW is not explicitly requested to be disabled or enabled, the
function is supposed to do nothing on non-BTRFS file systems.

Fixes commit 7230bc95aa78379c9ee20cf59394c5fc4305b75b.

https://bugzilla.redhat.com/show_bug.cgi?id=1866157

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/util/virfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 6ada3a708c..7f22884b07 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -4522,7 +4522,7 @@ virFileSetCOW(const char *path,
     }
 
     if (buf.f_type != BTRFS_SUPER_MAGIC) {
-        if (state == VIR_TRISTATE_BOOL_ABSENT) {
+        if (state != VIR_TRISTATE_BOOL_ABSENT) {
             virReportSystemError(ENOSYS,
                                  _("unable to control COW flag on '%s', not btrfs"),
                                  path);
-- 
2.27.0

Re: [libvirt PATCH] util: Fix logic in virFileSetCOW
Posted by Daniel P. Berrangé 3 years, 8 months ago
On Wed, Aug 05, 2020 at 10:33:21AM +0200, Jiri Denemark wrote:
> When COW is not explicitly requested to be disabled or enabled, the
> function is supposed to do nothing on non-BTRFS file systems.
> 
> Fixes commit 7230bc95aa78379c9ee20cf59394c5fc4305b75b.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1866157
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/util/virfile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 6ada3a708c..7f22884b07 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -4522,7 +4522,7 @@ virFileSetCOW(const char *path,
>      }
>  
>      if (buf.f_type != BTRFS_SUPER_MAGIC) {
> -        if (state == VIR_TRISTATE_BOOL_ABSENT) {
> +        if (state != VIR_TRISTATE_BOOL_ABSENT) {
>              virReportSystemError(ENOSYS,
>                                   _("unable to control COW flag on '%s', not btrfs"),
>                                   path);

/facepalm

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>



Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|