From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Fri, 16 Dec 2016 08:22:50 -0500 (EST) Subject: [Cluster-devel] [patch] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next In-Reply-To: <20161214142638.GA10918@elgon.mountain> References: <20161214142638.GA10918@elgon.mountain> Message-ID: <1419257657.13004439.1481894570815.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Dan, ----- Original Message ----- | If rhashtable_walk_next() returned PTR_ERR(-EAGAIN) then that would | cause an Oops. | | Fixes: 88ffbf3e037e ("GFS2: Use resizable hash table for glocks") | Signed-off-by: Dan Carpenter | --- | Is the comment in the right place? If not then please just fix it and | give me Reported-by credit. | | diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c | index 14cbf60167a7..2928f1209b67 100644 | --- a/fs/gfs2/glock.c | +++ b/fs/gfs2/glock.c | @@ -1802,16 +1802,18 @@ void gfs2_glock_exit(void) | | static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi) | { | - do { | - gi->gl = rhashtable_walk_next(&gi->hti); | + while ((gi->gl = rhashtable_walk_next(&gi->hti))) { | if (IS_ERR(gi->gl)) { | if (PTR_ERR(gi->gl) == -EAGAIN) | continue; | gi->gl = NULL; | + return; | } | - /* Skip entries for other sb and dead entries */ | - } while ((gi->gl) && ((gi->sdp != gi->gl->gl_name.ln_sbd) || | - __lockref_is_dead(&gi->gl->gl_lockref))); | + /* Skip entries for other sb and dead entries */ | + if (gi->sdp == gi->gl->gl_name.ln_sbd && | + !__lockref_is_dead(&gi->gl->gl_lockref)) | + return; | + } | } | | static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos) | Thanks. This is now applied to the for-next branch of the linux-gfs2 tree: https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/?h=for-next&id=14d37564fa3dc4e5d4c6828afcd26ac14e6796c5 Regards, Bob Peterson Red Hat File Systems