On Sat 25-06-22 17:33:50, Zhang Yi wrote: > > probably we should add: > > > > WARN_ON_ONCE(!list_empty(&inode->i_io_list)); > > > > to the no_delete: case of ext4_evict_inode()? Race like you mention above > > does not seem possible for that case but seeing the complicated > > interactions I'd rather have the assertion in place. > > > > For the no_delete case, I did some tests and IIUC, it's true that the race could > not happen, because inode_lru_isolate() make sure inode->i_data.nrpages is zero > before adding inode into the freeable list, so the evict() procedure could not be > invoked before the page cache have been dropped (it could only happened after > ext4_end_io_end() has been finished). > > We don't have a !list_empty(&inode->i_io_list) check for the no_delete case now. > But I am not quite get the purpose of adding it, do you want to detect inode > use-after-free issue in advance? Yes, I wanted to check that we didn't accidentally dirty the inode somewhere on the eviction path which would cause use-after-free issues which are always hard to debug... Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR