*** db/db_am.c.orig Sun Jan 3 13:12:26 1999 --- db/db_am.c Tue Jan 5 09:39:30 1999 *************** *** 173,183 **** ret = 0; ! /* Release the lock. */ ! if (F_ISSET(dbc->dbp, DB_AM_CDB) && dbc->mylock != LOCK_INVALID) { ! ret = lock_put(dbc->dbp->dbenv->lk_info, dbc->mylock); ! dbc->mylock = LOCK_INVALID; ! } /* Remove the cursor from the active queue. */ DB_THREAD_LOCK(dbp); --- 173,183 ---- ret = 0; ! /* ! * We cannot release the lock until after we've called the ! * access method specific routine, since btrees may have pending ! * deletes. ! */ /* Remove the cursor from the active queue. */ DB_THREAD_LOCK(dbp); *************** *** 188,193 **** --- 188,199 ---- if ((t_ret = dbc->c_am_close(dbc)) != 0 && ret == 0) t_ret = ret; + /* Release the lock. */ + if (F_ISSET(dbc->dbp, DB_AM_CDB) && dbc->mylock != LOCK_INVALID) { + ret = lock_put(dbc->dbp->dbenv->lk_info, dbc->mylock); + dbc->mylock = LOCK_INVALID; + } + /* Clean up the cursor. */ dbc->flags = 0;