add: mutex_lock(&cache->ref->lock);
context: vm_page_write_modified(vm_cache *cache){	vm_page *page = cache->page_list;	// ToDo: join adjacent pages into one vec list	for (; page; page = page->cache_next) {		status_t status;		bool gotPage = false;		cpu_status state = disable_interrupts();		acquire_spinlock(&page_lock);		if (page->state == PAGE_STATE_MODIFIED) {			remove_page_from_queue(&page_modified_queue, page);			page->state = PAGE_STATE_BUSY;			gotPage = true;			// ToDo: just setting PAGE_STAGE_BUSY is not enough, we would also			//	need to remove all mappings of this page - else, you could still			//	write to this page.		}		release_spinlock(&page_lock);		restore_interrupts(state);		if (!gotPage)			continue;		// got modified page, let's write it back		status = write_page(page);		if (status == B_OK) {			vm_area *area;			// It's written back now, so we can clear the modified flag in all mappings			for (area = page->cache->ref->areas; area; area = area->cache_next) {				if (page->offset >= area->cache_offset					&& page->offset < area->cache_offset + area->size) {					vm_translation_map *map = &area->aspace->translation_map;					map->ops->lock(map);					map->ops->clear_flags(map, page->offset - area->cache_offset + area->base,						PAGE_MODIFIED);					map->ops->unlock(map);				}			}			// put it into the active queue			state = disable_interrupts();			acquire_spinlock(&page_lock);			if (page->ref_count > 0)				page->state = PAGE_STATE_ACTIVE;			else				page->state = PAGE_STATE_INACTIVE;			enqueue_page(&page_active_queue, page);			release_spinlock(&page_lock);			restore_interrupts(state);		}	}	return B_OK;}