xfs
[Top] [All Lists]

Re: [PATCH 37/45] drivers: use req op accessor

To: Shaun Tancheff <shaun.tancheff@xxxxxxxxxxx>
Subject: Re: [PATCH 37/45] drivers: use req op accessor
From: Mike Christie <mchristi@xxxxxxxxxx>
Date: Thu, 4 Aug 2016 00:47:03 -0500
Cc: Ross Zwisler <zwisler@xxxxxxxxx>, Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxx>, linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx, linux-ext4 <linux-ext4@xxxxxxxxxxxxxxx>, konrad.wilk@xxxxxxxxxx, drbd-dev@xxxxxxxxxxxxxxxx, philipp.reisner@xxxxxxxxxx, lars.ellenberg@xxxxxxxxxx, linux-raid@xxxxxxxxxxxxxxx, dm-devel@xxxxxxxxxx, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>, linux-bcache@xxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, LKML <linux-kernel@xxxxxxxxxxxxxxx>, linux-scsi@xxxxxxxxxxxxxxx, linux-mtd@xxxxxxxxxxxxxxxxxxx, target-devel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, osd-dev@xxxxxxxxxxxx, XFS Developers <xfs@xxxxxxxxxxx>, ocfs2-devel@xxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CAJVOszAd9Eu88P2=QoNVArd0jwDH7KRe=OB82tCNMpjfv9B4KA@xxxxxxxxxxxxxx>
References: <1465155145-10812-1-git-send-email-mchristi@xxxxxxxxxx> <1465155145-10812-38-git-send-email-mchristi@xxxxxxxxxx> <CAOxpaSUMsgfTYsL0bL6VCnwxz7bpgpKO-ZfC5J8dFG9PN-hzvg@xxxxxxxxxxxxxx> <87fbe31f-27b3-ff7a-e381-34fc1aad337e@xxxxxxxxxx> <CAJVOszAd9Eu88P2=QoNVArd0jwDH7KRe=OB82tCNMpjfv9B4KA@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
On 08/03/2016 07:30 PM, Shaun Tancheff wrote:
> On Wed, Aug 3, 2016 at 6:47 PM, Mike Christie <mchristi@xxxxxxxxxx> wrote:
>> On 08/03/2016 05:33 PM, Ross Zwisler wrote:
>>> On Sun, Jun 5, 2016 at 1:32 PM,  <mchristi@xxxxxxxxxx> wrote:
>>>> From: Mike Christie <mchristi@xxxxxxxxxx>
>>>>
>>>> The req operation REQ_OP is separated from the rq_flag_bits
>>>> definition. This converts the block layer drivers to
>>>> use req_op to get the op from the request struct.
>>>>
>>>> Signed-off-by: Mike Christie <mchristi@xxxxxxxxxx>
>>>> ---
>>>>  drivers/block/loop.c              |  6 +++---
>>>>  drivers/block/mtip32xx/mtip32xx.c |  2 +-
>>>>  drivers/block/nbd.c               |  2 +-
>>>>  drivers/block/rbd.c               |  4 ++--
>>>>  drivers/block/xen-blkfront.c      |  8 +++++---
>>>>  drivers/ide/ide-floppy.c          |  2 +-
>>>>  drivers/md/dm.c                   |  2 +-
>>>>  drivers/mmc/card/block.c          |  7 +++----
>>>>  drivers/mmc/card/queue.c          |  6 ++----
>>>
>>> Dave Chinner reported a deadlock with XFS + DAX, which I reproduced
>>> and bisected to this commit:
>>>
>>> commit c2df40dfb8c015211ec55f4b1dd0587f875c7b34
>>> Author: Mike Christie <mchristi@xxxxxxxxxx>
>>> Date:   Sun Jun 5 14:32:17 2016 -0500
>>> drivers: use req op accessor
>>>
>>> Here are the steps to reproduce the deadlock with a BRD ramdisk:
>>>
>>> mkfs.xfs -f /dev/ram0
>>> mount -o dax /dev/ram0 /mnt/scratch
>>
>> When using ramdisks, we need the attached patch like in your other bug
>> report. I think it will fix some hangs people are seeing.
>>
>> I do not think that it should cause the failure to run issue you saw
>> when doing generic/008 and ext2.
>>
> 
> I think the translation in loop.c is suspicious here:
> 
>     "if use DIO && not (a flush_flag or discard_flag)"
> should translate to:
>     "if use DIO && not ((a flush_flag) || op == discard)"
> 
> But in the patch I read:
>     "if use DIO && ((not a flush_flag) || op == discard)
> 
> Which would have DIO && discards follow the AIO path?
> 
> So I would humbly suggest something like the following
>     (on top of commit c2df40dfb8c015211ec55f4b1dd0587f875c7b34):
> [Please excuse the messed up patch format ... gmail eats tabs]
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index b9b737c..0754d83 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1659,8 +1659,9 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx,
>         if (lo->lo_state != Lo_bound)
>                 return -EIO;
> 
> -       if (lo->use_dio && (!(cmd->rq->cmd_flags & REQ_FLUSH) ||
> -           req_op(cmd->rq) == REQ_OP_DISCARD))
> +       if (lo->use_dio && !(
> +           (cmd->rq->cmd_flags & REQ_FLUSH) ||
> +            req_op(cmd->rq) == REQ_OP_DISCARD))
>                 cmd->use_aio = true;
>         else
>                 cmd->use_aio = false;
> 

You are right. The translation was bad and your code above is correct.

I think we need my patch in the other mail though too, because for the
rw_page user case if WB_SYNC_ALL is set, then the IO gets sent down as a
read instead of a write.

<Prev in Thread] Current Thread [Next in Thread>