lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZMrvaE4FjdYya72P@fedora>
Date:   Thu, 3 Aug 2023 08:06:00 +0800
From:   Ming Lei <ming.lei@...hat.com>
To:     "Andreas Hindborg (Samsung)" <nmi@...aspace.dk>
Cc:     Niklas Cassel <Niklas.Cassel@....com>,
        Matias Bjørling <Matias.Bjorling@....com>,
        open list <linux-kernel@...r.kernel.org>,
        Damien Le Moal <dlemoal@...nel.org>,
        Jens Axboe <axboe@...nel.dk>,
        "gost.dev@...sung.com" <gost.dev@...sung.com>,
        "hch@...radead.org" <hch@...radead.org>,
        Johannes Thumshirn <jth@...nel.org>,
        Aravind Ramesh <Aravind.Ramesh@....com>,
        "open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
        Hans Holmberg <Hans.Holmberg@....com>,
        Minwoo Im <minwoo.im.dev@...il.com>
Subject: Re: [PATCH v9 2/2] ublk: enable zoned storage support

On Wed, Aug 02, 2023 at 11:09:56AM +0200, Andreas Hindborg (Samsung) wrote:
> 
> Ming Lei <ming.lei@...hat.com> writes:
> 
> > On Tue, Aug 01, 2023 at 02:11:56PM +0200, Andreas Hindborg (Samsung) wrote:
> >> 
> >> Niklas Cassel <Niklas.Cassel@....com> writes:
> >> 
> >> > On Fri, Jul 14, 2023 at 09:25:10AM +0200, Andreas Hindborg wrote:
> >> >> From: Andreas Hindborg <a.hindborg@...sung.com>
> >> >
> >> > Hello Andreas!
> >> >
> >> 
> >> <snip>
> >> 
> >> >>  	/* for READ request, writing data in iod->addr to rq buffers */
> >> >> @@ -1120,6 +1404,11 @@ static void ublk_commit_completion(struct ublk_device *ub,
> >> >>  	/* find the io request and complete */
> >> >>  	req = blk_mq_tag_to_rq(ub->tag_set.tags[qid], tag);
> >> >>  
> >> >> +	if (io->flags & UBLK_IO_FLAG_ZONE_APPEND) {
> >> >
> >> > Do we really need to introduce a completely new flag just for this?
> >> >
> >> > if (req_op(req) == REQ_OP_ZONE_APPEND)
> >> >
> >> > should work just as well, no?
> >> 
> >> Makes sense, thanks.
> >
> > The above one can be replaced with req_op().
> >
> > But extra cost is added when retrieving request for the check in
> > __ublk_ch_uring_cmd().
> >
> 
> How about this (diff to v9):
> 
> @@ -1709,7 +1702,7 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
>  		goto out;
>  
>  	if (ublk_support_user_copy(ubq) &&
> -	    !(io->flags & UBLK_IO_FLAG_ZONE_APPEND) && ub_cmd->addr) {
> +	    _IOC_NR(cmd_op) != UBLK_IO_COMMIT_AND_FETCH_REQ && ub_cmd->addr) {
>  		ret = -EINVAL;
>  		goto out;
>  	}

Let's merge the above original user_copy check into 'case UBLK_IO_FETCH_REQ' &
'case UBLK_IO_COMMIT_AND_FETCH_REQ' first, then this patch can be cleaner, which
can be done as one prep change for zoned support.

> @@ -1751,6 +1744,12 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
>  		if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
>  			goto out;
>  
> +		if (ublk_support_user_copy(ubq) &&
> +		    req_op(req) != REQ_OP_ZONE_APPEND && ub_cmd->addr) {
> +			ret = -EINVAL;
> +			goto out;
> +		}
> +

Given request is available for UBLK_IO_COMMIT_AND_FETCH_REQ, this approach is
good, and UBLK_IO_FETCH_REQ cmd doesn't have OP.


Thanks,
Ming

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ