gfs2: Fix missed wakeups in find_insert_glock
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 6 Mar 2019 14:41:57 +0000 (15:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:02:40 +0000 (14:02 -0700)
commit4f5a4c8881064c2eac658528390a6f2e7253c9b5
treec490d7f0d09d39e5d3971bf58c69c5806d17ec9b
parente6e00017910cadeace868ebe3bb6369accc486a4
gfs2: Fix missed wakeups in find_insert_glock

commit 605b0487f0bc1ae9963bf52ece0f5c8055186f81 upstream.

Mark Syms has reported seeing tasks that are stuck waiting in
find_insert_glock.  It turns out that struct lm_lockname contains four padding
bytes on 64-bit architectures that function glock_waitqueue doesn't skip when
hashing the glock name.  As a result, we can end up waking up the wrong
waitqueue, and the waiting tasks may be stuck forever.

Fix that by using ht_parms.key_len instead of sizeof(struct lm_lockname) for
the key length.

Reported-by: Mark Syms <mark.syms@citrix.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/glock.c