diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c index 7dd8d7326e0..cec5e155275 100644 --- a/modules/dav/fs/lock.c +++ b/modules/dav/fs/lock.c @@ -295,12 +295,14 @@ static apr_status_t dav_fs_lockdb_cleanup(void *data) { dav_lockdb *lockdb = data; - apr_global_mutex_unlock(lockdb->info->conf->lockdb_mutex); - + /* Close the database before releasing the mutex: closing commits + * pending writes, and the next opener must not overlap it. */ if (lockdb->info->db) { dav_dbm_close(lockdb->info->db); } - + + apr_global_mutex_unlock(lockdb->info->conf->lockdb_mutex); + return APR_SUCCESS; }