Be sure to release any xShmLock locks held when closing an OTA handle.
FossilOrigin-Name: d0fba72a47f73082ade40a732aab114bc8f6d83e
This commit is contained in:
parent
28b22a0159
commit
5c06dd831f
@ -31,6 +31,7 @@ set ota_sql {
|
||||
}
|
||||
|
||||
do_test 1.0 {
|
||||
db close
|
||||
forcedelete test.db ota.db
|
||||
|
||||
sqlite3 db test.db
|
||||
|
@ -629,6 +629,7 @@ static int otaMPrintfExec(sqlite3ota *p, sqlite3 *db, const char *zFmt, ...){
|
||||
static void *otaMalloc(sqlite3ota *p, int nByte){
|
||||
void *pRet = 0;
|
||||
if( p->rc==SQLITE_OK ){
|
||||
assert( nByte>0 );
|
||||
pRet = sqlite3_malloc(nByte);
|
||||
if( pRet==0 ){
|
||||
p->rc = SQLITE_NOMEM;
|
||||
@ -2845,6 +2846,19 @@ sqlite3_int64 sqlite3ota_progress(sqlite3ota *pOta){
|
||||
** file fail with SQLITE_INTERNAL errors.
|
||||
*/
|
||||
|
||||
static void otaUnlockShm(ota_file *p){
|
||||
if( p->pOta ){
|
||||
int (*xShmLock)(sqlite3_file*,int,int,int) = p->pReal->pMethods->xShmLock;
|
||||
int i;
|
||||
for(i=0; i<SQLITE_SHM_NLOCK;i++){
|
||||
if( (1<<i) & p->pOta->mLock ){
|
||||
xShmLock(p->pReal, i, 1, SQLITE_SHM_UNLOCK|SQLITE_SHM_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
p->pOta->mLock = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Close an ota file.
|
||||
*/
|
||||
@ -2867,6 +2881,7 @@ static int otaVfsClose(sqlite3_file *pFile){
|
||||
for(pp=&p->pOtaVfs->pMain; *pp!=p; pp=&((*pp)->pMainNext));
|
||||
*pp = p->pMainNext;
|
||||
sqlite3_mutex_leave(p->pOtaVfs->mutex);
|
||||
otaUnlockShm(p);
|
||||
p->pReal->pMethods->xShmUnmap(p->pReal, 0);
|
||||
}
|
||||
|
||||
@ -3203,6 +3218,8 @@ static int otaVfsShmUnmap(sqlite3_file *pFile, int delFlag){
|
||||
if( eStage==OTA_STAGE_OAL || eStage==OTA_STAGE_MOVE ){
|
||||
/* no-op */
|
||||
}else{
|
||||
/* Release the checkpointer and writer locks */
|
||||
otaUnlockShm(p);
|
||||
rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
|
||||
}
|
||||
return rc;
|
||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\smismatched\sprintf()\sargument\sand\sformat\sspecifier.\sAdd\sota\sfiles\sto\sMakefile.in.
|
||||
D 2015-04-16T14:33:09.849
|
||||
C Be\ssure\sto\srelease\sany\sxShmLock\slocks\sheld\swhen\sclosing\san\sOTA\shandle.
|
||||
D 2015-04-16T18:49:53.533
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 79b306896135a2305cfb7e6d88990fc4820fb917
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -134,11 +134,11 @@ F ext/ota/ota6.test 3bde7f69a894748b27206b6753462ec3b75b6bb6
|
||||
F ext/ota/ota7.test 1fe2c5761705374530e29f70c39693076028221a
|
||||
F ext/ota/ota8.test cd70e63a0c29c45c0906692827deafa34638feda
|
||||
F ext/ota/ota9.test d3eee95dd836824d07a22e5efcdb7bf6e869358b
|
||||
F ext/ota/otaA.test ef4bfa8cfd4ed814ae86f7457b64aa2f18c90171
|
||||
F ext/ota/otaA.test ab67f7f53670b81c750dcc946c5b704f51c429a4
|
||||
F ext/ota/otacrash.test a078d34e2edbcedac5f894e3e7d08d452a327007
|
||||
F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8
|
||||
F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561
|
||||
F ext/ota/sqlite3ota.c 876445eb19a9d4b53a6c79e604748542d935f528
|
||||
F ext/ota/sqlite3ota.c 424d4b9a010a836003e3eab6d84d37774cb620ed
|
||||
F ext/ota/sqlite3ota.h f1a9dd98b00fa622c7e2eb68e580ee02e194c4d6
|
||||
F ext/ota/test_ota.c e34c801c665d64b4b9e00b71f1acf8c652404b2b
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
@ -1269,7 +1269,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 658c3b0c80b9fe7eaac5982573651dc649a4c53f
|
||||
R 7c644ea03a0ef90234d338e031f21ca5
|
||||
P 5db810a88dac5cbf1f6b321345d01cc0d9d05d31
|
||||
R c5895a3241a2de3944e668930a0eb998
|
||||
U dan
|
||||
Z 85db6025ab0c4250cca566f7a293b04a
|
||||
Z dc29da0591555b6f4d89a9eb4ca47d9d
|
||||
|
@ -1 +1 @@
|
||||
5db810a88dac5cbf1f6b321345d01cc0d9d05d31
|
||||
d0fba72a47f73082ade40a732aab114bc8f6d83e
|
Loading…
x
Reference in New Issue
Block a user