Allow individual add drvfs share to fail (#40806)
Handle individual virtiofs share failures. So that one drive's failure does not cause all shares to fail. The failure could happen with google drive.
Feng Wang committed
Jun 18, 2026 at 10:53 UTC
c8066b49323a1fe1327bc5a23030804e6e8f72ee
1 file changed
+10
-1
src/windows/service/exe/WslCoreVm.cpp
+10
-1
@@ -895,7 +895,16 @@ void WslCoreVm::AddDrvFsShare(_In_ bool Admin, _In_ HANDLE UserToken)
895
ULONG index;
896
WI_VERIFY(_BitScanForward(&index, fixedDrives) != FALSE);
897
const wchar_t fixedDrivePath[] = {gsl::narrow_cast<wchar_t>(L'A' + index), L':', L'\\', L'\0'};
898
- AddVirtioFsShare(Admin, fixedDrivePath, TEXT(LX_INIT_DEFAULT_PLAN9_MOUNT_OPTIONS), UserToken);
898
+ try
899
+ {
900
+ AddVirtioFsShare(Admin, fixedDrivePath, TEXT(LX_INIT_DEFAULT_PLAN9_MOUNT_OPTIONS), UserToken);
901
+ }
902
+ catch (...)
903
+ {
904
+ const auto result = wil::ResultFromCaughtException();
905
+ WSL_LOG(
906
+ "AddVirtioFsShareError", TraceLoggingValue(fixedDrivePath, "DrivePath"), TraceLoggingValue(result, "result"));
907
+ }
908
fixedDrives ^= (1 << index);
909
}
910
}