Hello, On Mon, May 28, 2018 at 12:54:03PM +0000, Hatayama, Daisuke wrote: > diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c > index 89d1dc1..3aeeb7a 100644 > --- a/fs/kernfs/dir.c > +++ b/fs/kernfs/dir.c > @@ -1621,8 +1621,10 @@ static int kernfs_dir_fop_release(struct inode *inode, > struct file *filp) > static struct kernfs_node *kernfs_dir_next_pos(const void *ns, > struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos) > { > + struct kernfs_node *orig = pos; > + > pos = kernfs_dir_pos(ns, parent, ino, pos); > - if (pos) { > + if (pos && kernfs_sd_compare(pos, orig) <= 0) {
Hmm... the code seems a bit unintuitive to me and I wonder whether it's because there are two identical skipping loops in kernfs_dir_pos() and kernfs_dir_next_pos() and we're now trying to selectively disable one of them. Wouldn't it make more sense to get rid of it from kernfs_dir_pos() and skip explicitly only when necessary? Thanks. -- tejun