Comment 6 for bug 1856871

Revision history for this message
Eric Desrochers (slashd) wrote :

# parted code (3.3-1) from focal

---------
libparted/arch/linux.c:
.....
=> if (fsync (fd) < 0 || close (fd) < 0)
                                        if (ped_exception_throw (
                                                PED_EXCEPTION_WARNING,
                                                PED_EXCEPTION_RETRY +
                                                        PED_EXCEPTION_IGNORE,
=> _("Error fsyncing/closing %s: %s"),
                                                name, strerror (errno))
                                                        == PED_EXCEPTION_RETRY)
                                                goto retry;
                        }
                }
                free (name);

# FSYNC(2)
RETURN VALUE
       On success, these system calls return zero. On error, -1 is returned, and errno is set appropriately.
---------

so definitely fsync() fails returning "-1" on the next unused loop device as oppose to any other unused loop device.

The question is why unused loop device fails on fsync() ONLY when it is the next unused loop device after a system boot (losetup -f) ?