@samitouri / QOSAMI-WSL / commits / d00dd45e

Unmount the distribution before completing import (#41370)

Blue committed Aug 18, 2026 at 21:38 UTC d00dd45eb43eae6f55c7f61d0179787d1fb356c2
1 file changed +15 -6
src/linux/init/main.cpp
+15 -6
@@ -2549,6 +2549,21 @@ void ProcessImportExportMessage(gsl::span<gsl::byte> Buffer, wsl::shared::Socket
2549
2550 Result = -1;
2551 auto ReportStatus = wil::scope_exit([&Channel, &Result, MessageType = Message->Header.MessageType]() {
2552 + wsl::shared::MessageWriter<LX_MINI_INIT_IMPORT_RESULT> message;
2553 +
2554 + if (MessageType != LxMiniInitMessageExport && Result == 0)
2555 + {
2556 + PostProcessImportedDistribution(message, DISTRO_PATH);
2557 + }
2558 +
2559 + sync();
2560 +
2561 + if (umount(DISTRO_PATH) < 0)
2562 + {
2563 + LOG_ERROR("umount({}) failed, {}", DISTRO_PATH, errno);
2564 + Result = -1;
2565 + }
2566 +
2567 if (MessageType == LxMiniInitMessageExport)
2568 {
2569 if (UtilWriteBuffer(Channel.Socket(), &Result, sizeof(Result)) < 0)
@@ -2558,13 +2573,7 @@ void ProcessImportExportMessage(gsl::span<gsl::byte> Buffer, wsl::shared::Socket
2573 }
2574 else
2575 {
2561 - wsl::shared::MessageWriter<LX_MINI_INIT_IMPORT_RESULT> message;
2576 message->Result = Result;
2563 - if (Result == 0)
2564 - {
2565 - PostProcessImportedDistribution(message, DISTRO_PATH);
2566 - }
2567 -
2577 Channel.SendMessage<LX_MINI_INIT_IMPORT_RESULT>(message.Span());
2578 }
2579 });