[LTP] [PATCH] tst_umount: Retry open() after umount to handle delayed device release

Li Wang liwang@redhat.com
Tue Aug 12 05:43:15 CEST 2025


On Mon, Aug 11, 2025 at 10:19 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > From the bpfstrace logs, there seems udisksd listening to the same
> > udevevents and probes the device via libblockdev/blkid, performing
> > real O_RDONLY opens (flags=0x0). These O_RDONLY opens from
> > udisksd race with mkfs.ext3’s O_EXCL open, intermittently causing
> > “apparently in use by the system” (EBUSY).
> >
> > Does this analysis sound reasonable to you?
>
> Yes. So we have another daemon that probes block devices on each change.
>
> I suppose that turning off udisksd fixes the problem right? If that is
> so I would be inclined just to print a message to turn off udisksd if
> mkfs on a loop device fails...
>

That's right, this intermittent EBUSY is not related to LTP (and not
be a big deal), a hint print should be useful enough, we can leave
stopping udisks2 operation to the tester env setup.

What about this amendment:

--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -107,6 +107,13 @@ void tst_mkfs_(const char *file, const int lineno,
void (cleanup_fn)(void),
                        "%s not found in $PATH", mkfs);
        break;
        default:
+               tst_resm_(file, lineno, TINFO,
+                       "Check if mkfs failed with the (loop) device busy. "
+                       "Background probing (e.g., udisks2) can cause this.
\n"
+                       "Consider temporarily stopping udisks2 during the
test:\n"
+                       "  systemctl stop udisks2.service\n"
+                       "and restart afterward:\n"
+                       "  systemctl start udisks2.service");
                tst_brkm_(file, lineno, TBROK, cleanup_fn,
                        "%s failed with exit code %i", mkfs, ret);
        }


-- 
Regards,
Li Wang


More information about the ltp mailing list