dm thin: stay in out-of-data-space mode once no_space_timeout expires
authorMike Snitzer <snitzer@redhat.com>
Wed, 15 Jul 2015 20:52:04 +0000 (16:52 -0400)
committerMike Snitzer <snitzer@redhat.com>
Thu, 16 Jul 2015 14:23:49 +0000 (10:23 -0400)
commitbcc696fac11fe13e59dda5aaec6322a25b7c9a3a
tree956a9236835e48e108c0547eca1da8b0e8a1e2e9
parentb06075a98d595b761881fb2d7b8a557ea2f8b7ac
dm thin: stay in out-of-data-space mode once no_space_timeout expires

This fixes an issue where running out of data space would cause the
thin-pool's metadata to become read-only.  There was no reason to make
metadata read-only -- calling set_pool_mode() with PM_READ_ONLY was a
misguided way to error all queued and future write IOs.  We can
accomplish the same by degrading from PM_OUT_OF_DATA_SPACE to
PM_OUT_OF_DATA_SPACE with error_if_no_space enabled.

Otherwise, the use of PM_READ_ONLY could cause a race where commit() was
started before the PM_READ_ONLY transition but dm_pool_commit_metadata()
would go on to fail because the block manager had transitioned to
read-only.  The return of -EPERM from dm_pool_commit_metadata(), due to
attempting to commit while in read-only mode, caused the thin-pool to
set 'needs_check' because a metadata_operation_failed().  This needless
cascade of failures makes life for users more difficult than needed.

Reported-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-thin.c