OSDN Git Service

gfs2: Fix sign extension bug in gfs2_update_stats
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 17 May 2019 18:18:43 +0000 (19:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:48:12 +0000 (06:48 -0700)
commitf22537fe00c1bd7d42214a86ac433f67567da96e
tree4ffc6a618ec290ef8a537ae793d18ed4f6a3623c
parent235aeafb93e96b7540338952dc62d893a00dc7f6
gfs2: Fix sign extension bug in gfs2_update_stats

commit 5a5ec83d6ac974b12085cd99b196795f14079037 upstream.

Commit 4d207133e9c3 changed the types of the statistic values in struct
gfs2_lkstats from s64 to u64.  Because of that, what should be a signed
value in gfs2_update_stats turned into an unsigned value.  When shifted
right, we end up with a large positive value instead of a small negative
value, which results in an incorrect variance estimate.

Fixes: 4d207133e9c3 ("gfs2: Make statistics unsigned, suitable for use with do_div()")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/lock_dlm.c