[Box Backup-commit] COMMIT r3280 - in box/trunk: . lib/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Thu Feb 27 23:35:24 GMT 2014


Author: chris
Date: 2014-02-27 23:35:24 +0000 (Thu, 27 Feb 2014)
New Revision: 3280

Modified:
   box/trunk/BUGS.txt
   box/trunk/lib/backupstore/BackupStoreAccounts.cpp
   box/trunk/lib/backupstore/BackupStoreCheck.cpp
Log:
Allow read-only account check without taking a write lock on account.

Modified: box/trunk/BUGS.txt
===================================================================
--- box/trunk/BUGS.txt	2014-02-27 23:35:14 UTC (rev 3279)
+++ box/trunk/BUGS.txt	2014-02-27 23:35:24 UTC (rev 3280)
@@ -13,3 +13,4 @@
 * more automated tests for win32
 * change off_t to box_off_t in preparation for win32 large file support
 * support large files on win32 by using native *i64 functions instead of posix
+* when storage is implemented, ensure that no write operations can happen to an account that's opened read-only (BackupStoreCheck without fix)

Modified: box/trunk/lib/backupstore/BackupStoreAccounts.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreAccounts.cpp	2014-02-27 23:35:14 UTC (rev 3279)
+++ box/trunk/lib/backupstore/BackupStoreAccounts.cpp	2014-02-27 23:35:24 UTC (rev 3280)
@@ -601,7 +601,8 @@
 	std::auto_ptr<UnixUser> user; // used to reset uid when we return
 	NamedLock writeLock;
 
-	if(!OpenAccount(ID, rootDir, discSetNum, user, &writeLock))
+	if(!OpenAccount(ID, rootDir, discSetNum, user,
+		FixErrors ? &writeLock : NULL)) // don't need a write lock if not making changes
 	{
 		BOX_ERROR("Failed to open account " << BOX_FORMAT_ACCOUNT(ID)
 			<< " for checking.");

Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-02-27 23:35:14 UTC (rev 3279)
+++ box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-02-27 23:35:24 UTC (rev 3280)
@@ -92,9 +92,12 @@
 // --------------------------------------------------------------------------
 void BackupStoreCheck::Check()
 {
-	std::string writeLockFilename;
-	StoreStructure::MakeWriteLockFilename(mStoreRoot, mDiscSetNumber, writeLockFilename);
-	ASSERT(FileExists(writeLockFilename));
+	if(mFixErrors)
+	{
+		std::string writeLockFilename;
+		StoreStructure::MakeWriteLockFilename(mStoreRoot, mDiscSetNumber, writeLockFilename);
+		ASSERT(FileExists(writeLockFilename));
+	}
 
 	if(!mQuiet && mFixErrors)
 	{




More information about the Boxbackup-commit mailing list