On Wed, Nov 24, 2021 at 05:43:16PM +0800, Gang Li wrote: > +move_back: > + /* inodes that are on @list and will not be deleted must be moved back to > + * global list before iput for two reasons: > + * 1. iput in lock: iput call shmem_evict_inode, then cause deadlock. > + * 2. iput before lock: shmem_evict_inode may grab the inode on @list, > + * which will cause race. > + */ > + spin_lock(&sbinfo->shrinklist_lock); > + list_move(&info->shrinklist, &sbinfo->shrinklist); > + sbinfo->shrinklist_len++; > + spin_unlock(&sbinfo->shrinklist_lock); > +put: > iput(inode); > } > > - spin_lock(&sbinfo->shrinklist_lock); > - list_splice_tail(&list, &sbinfo->shrinklist); > - sbinfo->shrinklist_len -= removed; > - spin_unlock(&sbinfo->shrinklist_lock); > - > return split; > } Okay, I guess it works. Locking is not pretty, but well.. Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> -- Kirill A. Shutemov