]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm: fix double accounting of flush with data
authorMike Snitzer <snitzer@redhat.com>
Fri, 18 Feb 2022 04:39:57 +0000 (23:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:57:23 +0000 (13:57 +0200)
commitd46e304ef8c3381b1776beafdf0bdaf153ae5e70
tree098a91e8c8939230c8f690307e8bf367c4d35b8c
parentbe18d3b08299f1b78c59bdffeb510118a04f6a12
dm: fix double accounting of flush with data

commit 8d394bc4adf588ca4a0650745167cb83f86c18c9 upstream.

DM handles a flush with data by first issuing an empty flush and then
once it completes the REQ_PREFLUSH flag is removed and the payload is
issued.  The problem fixed by this commit is that both the empty flush
bio and the data payload will account the full extent of the data
payload.

Fix this by factoring out dm_io_acct() and having it wrap all IO
accounting to set the size of  bio with REQ_PREFLUSH to 0, account the
IO, and then restore the original size.

Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-stats.c
drivers/md/dm-stats.h
drivers/md/dm.c