On Tue, Sep 17, 2019 at 03:03:33PM +0800, zhengbin (A) wrote: > > On 2019/9/17 1:16, Al Viro wrote: > > On Sun, Sep 15, 2019 at 08:44:05PM -0700, Linus Torvalds wrote: > >> On Sun, Sep 15, 2019 at 8:04 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > >>> Perhaps lockref_get_nested(struct lockref *lockref, unsigned int subclass)? > >>> With s/spin_lock/spin_lock_nested/ in the body... > >> Sure. Under the usual CONFIG_DEBUG_LOCK_ALLOC, with the non-debug case > >> just turning into a regular lockref_get(). > >> > >> Sounds fine to me. > > Done and force-pushed into vfs.git#fixes > + if (file->f_pos > 2) { > + p = scan_positives(cursor, &dentry->d_subdirs, > + file->f_pos - 2, &to); > + spin_lock(&dentry->d_lock); > + list_move(&cursor->d_child, p); > + spin_unlock(&dentry->d_lock); > + } else { > + spin_lock(&dentry->d_lock); > + list_del_init(&cursor->d_child); > + spin_unlock(&dentry->d_lock); > } > + > + dput(to); > dput(to) should be in if if (file->f_pos > 2)? cause we dget(to) in scan_positives dput(NULL) is a no-op