Commit 2bc2f62b authored by Zardosht Kasheff's avatar Zardosht Kasheff

refs #61, fix locking bug, add write list lock before reintegrating PAIRs into...

refs #61, fix locking bug, add write list lock before reintegrating PAIRs into  the cachetable on a open
parent 8af8d5be
...@@ -428,11 +428,13 @@ int toku_cachetable_openfd_with_filenum (CACHEFILE *cfptr, CACHETABLE ct, int fd ...@@ -428,11 +428,13 @@ int toku_cachetable_openfd_with_filenum (CACHEFILE *cfptr, CACHETABLE ct, int fd
bjm_init(&existing_cf->bjm); bjm_init(&existing_cf->bjm);
// now we need to move all the PAIRs in it back into the cachetable // now we need to move all the PAIRs in it back into the cachetable
ct->list.write_list_lock();
for (PAIR curr_pair = existing_cf->cf_head; curr_pair; curr_pair = curr_pair->cf_next) { for (PAIR curr_pair = existing_cf->cf_head; curr_pair; curr_pair = curr_pair->cf_next) {
pair_lock(curr_pair); pair_lock(curr_pair);
ct->list.add_to_cachetable_only(curr_pair); ct->list.add_to_cachetable_only(curr_pair);
pair_unlock(curr_pair); pair_unlock(curr_pair);
} }
ct->list.write_list_unlock();
// move the cachefile back to the list of active cachefiles // move the cachefile back to the list of active cachefiles
ct->cf_list.remove_stale_cf_unlocked(existing_cf); ct->cf_list.remove_stale_cf_unlocked(existing_cf);
ct->cf_list.add_cf_unlocked(existing_cf); ct->cf_list.add_cf_unlocked(existing_cf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment