Skip to content

Commit

Permalink
dm writecache: correct uncommitted_block when discarding uncommitted …
Browse files Browse the repository at this point in the history
…entry

commit 39495b1 upstream.

When uncommitted entry has been discarded, correct wc->uncommitted_block
for getting the exact number.

Fixes: 48debaf ("dm: add writecache target")
Cc: stable@vger.kernel.org
Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Huaisheng Ye authored and Sasha Levin committed Jun 30, 2020
1 parent 301cca2 commit 22551da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/dm-writecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
writecache_wait_for_ios(wc, WRITE);
discarded_something = true;
}
if (!writecache_entry_is_committed(wc, e))
wc->uncommitted_blocks--;
writecache_free_entry(wc, e);
}

Expand Down

0 comments on commit 22551da

Please sign in to comment.