From: Mike Snitzer <snitzer@redhat.com>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>,
dm-devel@redhat.com, Alasdair Kergon <agk@redhat.com>
Subject: Re: dm-zoned: Fix overflow in exposed capacity
Date: Fri, 9 Jun 2017 08:03:39 -0400 [thread overview]
Message-ID: <20170609120339.GB11110@redhat.com> (raw)
In-Reply-To: <20170609040605.4340-1-damien.lemoal@wdc.com>
On Fri, Jun 09 2017 at 12:06am -0400,
Damien Le Moal <damien.lemoal@wdc.com> wrote:
> Cast unsigned int to sector_t before shifting. Otherwise, the target
> length overflows and becomes incorrect.
>
> Also fix an incorrect setting of the target suspend
> operation.
>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
> drivers/md/dm-zoned-target.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
> index 4438f30..f947166 100644
> --- a/drivers/md/dm-zoned-target.c
> +++ b/drivers/md/dm-zoned-target.c
> @@ -773,7 +773,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)
> ti->split_discard_bios = true;
>
> /* The exposed capacity is the number of chunks that can be mapped */
> - ti->len = dmz_nr_chunks(dmz->metadata) << dev->zone_nr_sectors_shift;
> + ti->len = (sector_t)dmz_nr_chunks(dmz->metadata) << dev->zone_nr_sectors_shift;
>
> /* Zone BIO */
> dmz->bio_set = bioset_create_nobvec(DMZ_MIN_BIOS, 0);
I folded this in, thanks.
> @@ -944,7 +944,8 @@ static struct target_type dmz_type = {
> .end_io = dmz_end_io,
> .io_hints = dmz_io_hints,
> .prepare_ioctl = dmz_prepare_ioctl,
> - .suspend = dmz_suspend,
> + .presuspend = dmz_suspend,
> + .presuspend_undo = dmz_resume,
> .resume = dmz_resume,
> .iterate_devices = dmz_iterate_devices,
> };
I've switched from .presuspend to .postsuspend, and eliminated the
.presuspend_undo
I'm not seeing any reason for .presuspend_undo
See dm-cache-target.c for a .postsuspend that is pretty comparable to
what dm-zoned's is doing.
As for .presuspend_undo, dm-thinp has a need for it but most target do
not. And I'm not seeing why dm-zoned needs it.
I've pushed to linux-dm.git's 'for-next' to get more test coverage;
doesn't mean that I consider dm-zoned's review complete.
Thanks,
Mike
next prev parent reply other threads:[~2017-06-09 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 4:06 [PATCH] dm-zoned: Fix overflow in exposed capacity Damien Le Moal
2017-06-09 12:03 ` Mike Snitzer [this message]
2017-06-09 14:41 ` Damien Le Moal
2017-06-12 21:28 ` rebased dm-zoned changes on jens/for-4.13/block [was: Re: dm-zoned: Fix overflow in exposed capacity] Mike Snitzer
2017-06-13 23:30 ` Damien Le Moal
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=20170609120339.GB11110@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=bart.vanassche@sandisk.com \
--cc=damien.lemoal@wdc.com \
--cc=dm-devel@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.