From 0a3d0759b6ed84d6cf33395d77bb2fb7c28c319d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 2 Jul 2005 05:37:33 +0000 Subject: [PATCH] sync before umount; cleanup --- .../MemoryCard/MemoryCardDriverThreaded_Linux.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp index 760cefe3f6..522ea652a8 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp @@ -245,7 +245,7 @@ bool MemoryCardDriverThreaded_Linux::DoOneUpdate( bool bMount, vectorUnmount( "dir", d.sOsMountDir, TEMP_MOUNT_POINT ); } - ExecuteCommand( "umount -l \"" + d.sOsMountDir + "\"" ); + ExecuteCommand( "sync; umount -l \"" + d.sOsMountDir + "\"" ); LOG->Trace( "WriteTest: %s, Name: %s", d.m_State == UsbStorageDevice::STATE_ERROR? "failed":"succeeded", d.sName.c_str() ); } @@ -459,7 +459,7 @@ void MemoryCardDriverThreaded_Linux::Unmount( UsbStorageDevice* pDevice ) * by new devices until those are closed. Without this, if something * causes the device to not unmount here, we'll never unmount it; that * causes a device name leak, eventually running us out of mountpoints. */ - CString sCommand = "umount -l \"" + pDevice->sDevice + "\""; + CString sCommand = "sync; umount -l \"" + pDevice->sDevice + "\""; ExecuteCommand( sCommand ); } @@ -469,11 +469,8 @@ void MemoryCardDriverThreaded_Linux::Flush( UsbStorageDevice* pDevice ) return; // "sync" will only flush all file systems at the same time. -Chris - // I don't think so. Also, sync() merely queues a flush; it doesn't guarantee - // that the flush is completed on return. However, we can mount the filesystem - // with the flag "-o sync", which forces synchronous access (but that's probably - // very slow.) -glenn - ExecuteCommand( "mount -o remount " + pDevice->sDevice ); + // That's OK. + ExecuteCommand( "sync" ); } /*