]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drbd: fix bogus resync stats in /proc/drbd
authorLars Ellenberg <lars.ellenberg@linbit.com>
Tue, 11 Mar 2014 12:47:55 +0000 (13:47 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Jul 2014 16:34:59 +0000 (18:34 +0200)
commita5655dac75b6c572e1ef430b61ad55245fffd523
tree50636b7490394d34029daed62e4d023eccadcbf5
parentcaa3db0e14cc301f07e758f4cadc36d4dead145a
drbd: fix bogus resync stats in /proc/drbd

We intentionally do not serialize /proc/drbd access with
internal state changes or statistic updates.

Because of that, cat /proc/drbd  may race with resync just being
finished, still see the sync state, and find information about
number of blocks still to go, but then find the total number
of blocks within this resync has just been reset to 0
when accessing it.

This now produces bogus numbers in the resync speed estimates.

Fix by accessing all relevant data only once,
and fixing it up if "still to go" happens to be more than "total".

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_proc.c