Skip to content

Commit 651bae9

Browse files
committed
Merge tag 'gfs2-5.1.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 fix from Andreas Gruenbacher: "Fix a gfs2 sign extension bug introduced in v4.3" * tag 'gfs2-5.1.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Fix sign extension bug in gfs2_update_stats
2 parents f75b6f3 + 5a5ec83 commit 651bae9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/gfs2/lock_dlm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
* @delta is the difference between the current rtt sample and the
3232
* running average srtt. We add 1/8 of that to the srtt in order to
3333
* update the current srtt estimate. The variance estimate is a bit
34-
* more complicated. We subtract the abs value of the @delta from
35-
* the current variance estimate and add 1/4 of that to the running
36-
* total.
34+
* more complicated. We subtract the current variance estimate from
35+
* the abs value of the @delta and add 1/4 of that to the running
36+
* total. That's equivalent to 3/4 of the current variance
37+
* estimate plus 1/4 of the abs of @delta.
3738
*
3839
* Note that the index points at the array entry containing the smoothed
3940
* mean value, and the variance is always in the following entry
@@ -49,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index,
4950
s64 delta = sample - s->stats[index];
5051
s->stats[index] += (delta >> 3);
5152
index++;
52-
s->stats[index] += ((abs(delta) - s->stats[index]) >> 2);
53+
s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2;
5354
}
5455

5556
/**

0 commit comments

Comments
 (0)