[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180529162627.GH1351649@devbig577.frc2.facebook.com>
Date: Tue, 29 May 2018 09:26:27 -0700
From: "'tj@...nel.org'" <tj@...nel.org>
To: "Hatayama, Daisuke" <d.hatayama@...fujitsu.com>
Cc: "'gregkh@...uxfoundation.org'" <gregkh@...uxfoundation.org>,
"Okajima, Toshiyuki" <toshi.okajima@...fujitsu.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"'ebiederm@...stanetworks.com'" <ebiederm@...stanetworks.com>
Subject: Re: [RESEND PATCH v2] kernfs: fix dentry unexpected skip
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
Powered by blists - more mailing lists