Skip to content

Commit 9d0d78a

Browse files
authored
Flush the cache on STOP UNIT (#644)
1 parent 36cadd7 commit 9d0d78a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/raspberrypi/devices/disk.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,16 +1293,21 @@ bool Disk::StartStop(const DWORD *cdb)
12931293
SetStopped(!start);
12941294
}
12951295

1296-
// Look at the eject bit and eject if necessary
1297-
if (load && !start) {
1298-
if (IsLocked()) {
1299-
// Cannot be ejected because it is locked
1300-
SetStatusCode(STATUS_PREVENT);
1301-
return false;
1302-
}
1296+
if (!start) {
1297+
// Flush the cache when stopping
1298+
disk.dcache->Save();
13031299

1304-
// Eject
1305-
return Eject(false);
1300+
// Look at the eject bit and eject if necessary
1301+
if (load) {
1302+
if (IsLocked()) {
1303+
// Cannot be ejected because it is locked
1304+
SetStatusCode(STATUS_PREVENT);
1305+
return false;
1306+
}
1307+
1308+
// Eject
1309+
return Eject(false);
1310+
}
13061311
}
13071312

13081313
return true;

0 commit comments

Comments
 (0)