From 0dd8dec2c996f4b16884f03c9de304dde9eac105 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 14 Feb 2020 16:35:50 +0000 Subject: [PATCH] deploy: Avoid trying to change immutable state unnecessarily For some reason I haven't fully debugged (probably a recent kernel change), in the case where the immutable bit isn't set, trying to call `EXT2_IOC_SETFLAGS` without it set returns `EINVAL`. Let's avoid calling the `ioctl()` if we don't have anything to do. This fixes a slew of `make check` failures here in my toolbox environment. (kernel is `5.5.0-0.rc6.git0.1.fc32.x86_64` with `xfs`) --- src/libostree/ostree-linuxfsutil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libostree/ostree-linuxfsutil.c b/src/libostree/ostree-linuxfsutil.c index d1dde8b4..231ecf76 100644 --- a/src/libostree/ostree-linuxfsutil.c +++ b/src/libostree/ostree-linuxfsutil.c @@ -68,6 +68,10 @@ _ostree_linuxfs_fd_alter_immutable_flag (int fd, } else { + gboolean prev_immutable_state = (flags & EXT2_IMMUTABLE_FL) > 0; + if (prev_immutable_state == new_immutable_state) + return TRUE; /* Nothing to do */ + if (new_immutable_state) flags |= EXT2_IMMUTABLE_FL; else