]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: fully suppress unnecessary size changes
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Aug 2025 19:42:39 +0000 (21:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Sep 2025 06:49:25 +0000 (08:49 +0200)
Typically we set the offset argument to UINT64_MAX in most calls, but
this caused us to not detect no-change invocations. Fix that.

src/shared/loop-util.c

index b60e66c37e315dfd150cdfe50771cc4c428d8ff0..53d7759e2ef44b4f6b568fcb3efea7da310c485e 100644 (file)
@@ -1064,9 +1064,8 @@ int loop_device_refresh_size(LoopDevice *d, uint64_t offset, uint64_t size) {
         VALGRIND_MAKE_MEM_DEFINED(&info, sizeof(info));
 #endif
 
-        if (size == UINT64_MAX && offset == UINT64_MAX)
-                return 0;
-        if (info.lo_sizelimit == size && info.lo_offset == offset)
+        if ((size == UINT64_MAX || info.lo_sizelimit == size) &&
+            (offset == UINT64_MAX || info.lo_offset == offset))
                 return 0;
 
         if (size != UINT64_MAX)