Skip to content

Commit a0b67fa

Browse files
committed
fix(cloud): tell a recreated data directory apart from the original when ext4 reuses its inode
1 parent 08aab70 commit a0b67fa

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

apps/cloud/src/server.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,14 @@ export async function startCloudServer(options: CloudServerOptions = {}): Promis
11311131
return currentStat.isDirectory()
11321132
&& currentRealPath === initialDataDirRealPath
11331133
&& currentStat.dev === initialDataDirStat.dev
1134-
&& currentStat.ino === initialDataDirStat.ino;
1134+
&& currentStat.ino === initialDataDirStat.ino
1135+
// ext4 hands the freed inode straight back to the next directory
1136+
// created, so a data dir removed and recreated between checks can
1137+
// return with the original dev+ino. The birth timestamp only
1138+
// survives on the original directory; skip it on filesystems
1139+
// that do not report one.
1140+
&& (initialDataDirStat.birthtimeMs <= 0
1141+
|| currentStat.birthtimeMs === initialDataDirStat.birthtimeMs);
11351142
} catch {
11361143
return false;
11371144
}

0 commit comments

Comments
 (0)