From: Joe Thornber <thornber@redhat.com>
To: Mike Snitzer <snitzer@redhat.com>
Cc: sandeen@redhat.com, dm-devel@redhat.com, ejt@redhat.com
Subject: Re: [PATCH] dm thin: return ENOSPC instead of EIO when error_if_no_space enabled
Date: Fri, 23 May 2014 09:50:29 +0100 [thread overview]
Message-ID: <20140523085028.GA3283@debian> (raw)
In-Reply-To: <1400782364-6537-1-git-send-email-snitzer@redhat.com>
ack
On Thu, May 22, 2014 at 02:12:44PM -0400, Mike Snitzer wrote:
> Update the DM thin provisioning target's allocation failure error to be
> consistent with commit a9d6ceb8 ("[SCSI] return ENOSPC on thin
> provisioning failure").
>
> The DM thin target now returns -ENOSPC rather than -EIO when
> block allocation fails due to the pool being out of data space (and
> the 'error_if_no_space' thin-pool feature is enabled).
>
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
> drivers/md/dm-thin.c | 16 +++++++++-------
> 1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index c31f5f1..b77e919 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -1021,7 +1021,7 @@ static void retry_on_resume(struct bio *bio)
> spin_unlock_irqrestore(&tc->lock, flags);
> }
>
> -static bool should_error_unserviceable_bio(struct pool *pool)
> +static int should_error_unserviceable_bio(struct pool *pool)
> {
> enum pool_mode m = get_pool_mode(pool);
>
> @@ -1029,25 +1029,27 @@ static bool should_error_unserviceable_bio(struct pool *pool)
> case PM_WRITE:
> /* Shouldn't get here */
> DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode");
> - return true;
> + return -EIO;
>
> case PM_OUT_OF_DATA_SPACE:
> - return pool->pf.error_if_no_space;
> + return pool->pf.error_if_no_space ? -ENOSPC : 0;
>
> case PM_READ_ONLY:
> case PM_FAIL:
> - return true;
> + return -EIO;
> default:
> /* Shouldn't get here */
> DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode");
> - return true;
> + return -EIO;
> }
> }
>
> static void handle_unserviceable_bio(struct pool *pool, struct bio *bio)
> {
> - if (should_error_unserviceable_bio(pool))
> - bio_io_error(bio);
> + int error = should_error_unserviceable_bio(pool);
> +
> + if (error)
> + bio_endio(bio, error);
> else
> retry_on_resume(bio);
> }
> --
> 1.7.4.4
>
prev parent reply other threads:[~2014-05-23 8:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 18:12 [PATCH] dm thin: return ENOSPC instead of EIO when error_if_no_space enabled Mike Snitzer
2014-05-22 18:32 ` [PATCH v2] " Mike Snitzer
2014-05-23 20:52 ` Mike Snitzer
2014-05-23 8:50 ` Joe Thornber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140523085028.GA3283@debian \
--to=thornber@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ejt@redhat.com \
--cc=sandeen@redhat.com \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.