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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR04MB37517AAE0B475F631C81B404E76F0@CY4PR04MB3751.namprd04.prod.outlook.com>
Date:   Tue, 30 Jun 2020 07:52:11 +0000
From:   Damien Le Moal <Damien.LeMoal@....com>
To:     Kanchan Joshi <joshi.k@...sung.com>
CC:     "axboe@...nel.dk" <axboe@...nel.dk>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "bcrl@...ck.org" <bcrl@...ck.org>,
        "asml.silence@...il.com" <asml.silence@...il.com>,
        "hch@...radead.org" <hch@...radead.org>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "mb@...htnvm.io" <mb@...htnvm.io>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-aio@...ck.org" <linux-aio@...ck.org>,
        "io-uring@...r.kernel.org" <io-uring@...r.kernel.org>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "selvakuma.s1@...sung.com" <selvakuma.s1@...sung.com>,
        "nj.shetty@...sung.com" <nj.shetty@...sung.com>,
        "javier.gonz@...sung.com" <javier.gonz@...sung.com>,
        Arnav Dawn <a.dawn@...sung.com>
Subject: Re: [PATCH v2 1/2] fs,block: Introduce RWF_ZONE_APPEND and handling
 in direct IO path

On 2020/06/30 16:43, Kanchan Joshi wrote:
> On Tue, Jun 30, 2020 at 12:37:07AM +0000, Damien Le Moal wrote:
>> On 2020/06/30 3:35, Kanchan Joshi wrote:
>>> On Fri, Jun 26, 2020 at 02:50:20AM +0000, Damien Le Moal wrote:
>>>> On 2020/06/26 2:18, Kanchan Joshi wrote:
>>>>> Introduce RWF_ZONE_APPEND flag to represent zone-append. User-space
>>>>> sends this with write. Add IOCB_ZONE_APPEND which is set in
>>>>> kiocb->ki_flags on receiving RWF_ZONE_APPEND.
>>>>> Make direct IO submission path use IOCB_ZONE_APPEND to send bio with
>>>>> append op. Direct IO completion returns zone-relative offset, in sector
>>>>> unit, to upper layer using kiocb->ki_complete interface.
>>>>> Report error if zone-append is requested on regular file or on sync
>>>>> kiocb (i.e. one without ki_complete).
>>>>>
>>>>> Signed-off-by: Kanchan Joshi <joshi.k@...sung.com>
>>>>> Signed-off-by: SelvaKumar S <selvakuma.s1@...sung.com>
>>>>> Signed-off-by: Arnav Dawn <a.dawn@...sung.com>
>>>>> Signed-off-by: Nitesh Shetty <nj.shetty@...sung.com>
>>>>> Signed-off-by: Javier Gonzalez <javier.gonz@...sung.com>
>>>>> ---
>>>>>  fs/block_dev.c          | 28 ++++++++++++++++++++++++----
>>>>>  include/linux/fs.h      |  9 +++++++++
>>>>>  include/uapi/linux/fs.h |  5 ++++-
>>>>>  3 files changed, 37 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/fs/block_dev.c b/fs/block_dev.c
>>>>> index 47860e5..5180268 100644
>>>>> --- a/fs/block_dev.c
>>>>> +++ b/fs/block_dev.c
>>>>> @@ -185,6 +185,10 @@ static unsigned int dio_bio_write_op(struct kiocb *iocb)
>>>>>  	/* avoid the need for a I/O completion work item */
>>>>>  	if (iocb->ki_flags & IOCB_DSYNC)
>>>>>  		op |= REQ_FUA;
>>>>> +
>>>>> +	if (iocb->ki_flags & IOCB_ZONE_APPEND)
>>>>> +		op |= REQ_OP_ZONE_APPEND;
>>>>
>>>> This is wrong. REQ_OP_WRITE is already set in the declaration of "op". How can
>>>> this work ?
>>> REQ_OP_ZONE_APPEND will override the REQ_WRITE op, while previously set op
>>> flags (REQ_FUA etc.) will be retained. But yes, this can be made to look
>>> cleaner.
>>> V3 will include the other changes you pointed out. Thanks for the review.
>>>
>>
>> REQ_OP_WRITE and REQ_OP_ZONE_APPEND are different bits, so there is no
>> "override". A well formed BIO bi_opf is one op+flags. Specifying multiple OP
>> codes does not make sense.
> 
> one op+flags behavior is retained here. OP is not about bits (op flags are).
> Had it been, REQ_OP_WRITE (value 1) can not be differentiated from
> REQ_OP_ZONE_APPEND (value 13).
> We do not do "bio_op(bio) & REQ_OP_WRITE", rather we look at the
> absolute value "bio_op(bio) == REQ_OP_WRITE".

Sure, the ops are not bits like the flags, but (excluding the flags) doing:

op |= REQ_OP_ZONE_APPEND;

will give you op == (REQ_OP_WRITE | REQ_OP_ZONE_APPEND). That's not what you want...



-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ