3 stable fixes and 1 fix for a regression introduced during 3.19 merge:

- Fix inability to discard used space when the thin-pool target is in
  out-of-data-space mode and also transition the thin-pool back to write
  mode once free space is made available.

- Fix DM core bio-based end_io bug that prevented proper post-processing
  of the error code returned from the block layer.

- Fix crash in DM thin-pool due to thin device being added to the pool's
  active_thins list before properly initializing the thin device's
  refcount.
dm: fix missed error code if .end_io isn't implemented by target_type

In bio-based DM's clone_endio(), when target_type doesn't implement
.end_io (e.g. linear) r will be always be initialized 0.  So if a
WRITE SAME bio fails WRITE SAME will not be disabled as intended.

Fix this by initializing r to error, rather than 0, in clone_endio().

Signed-off-by: Alex Chen <alex.chen@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Fixes: 7eee4ae2db ("dm: disable WRITE SAME if it fails")
Cc: stable@vger.kernel.org
1 file changed