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: <54E54579.1060007@oracle.com>
Date:	Thu, 19 Feb 2015 10:07:53 +0800
From:	Bob Liu <bob.liu@...cle.com>
To:	Christoph Hellwig <hch@...radead.org>
CC:	xen-devel@...ts.xen.org, david.vrabel@...rix.com,
	linux-kernel@...r.kernel.org, roger.pau@...rix.com,
	konrad.wilk@...cle.com, felipe.franciosi@...rix.com, axboe@...com,
	avanzini.arianna@...il.com
Subject: Re: [PATCH 03/10] xen/blkfront: reorg info->io_lock after using blk-mq
 API


On 02/19/2015 01:05 AM, Christoph Hellwig wrote:
> On Sun, Feb 15, 2015 at 04:18:58PM +0800, Bob Liu wrote:
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 3589436..5a90a51 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -614,25 +614,28 @@ static int blk_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
>>  	blk_mq_start_request(qd->rq);
>>  	spin_lock_irq(&info->io_lock);
>>  	if (RING_FULL(&info->ring)) {
>> +		spin_unlock_irq(&info->io_lock);
>>  		blk_mq_stop_hw_queue(hctx);
>>  		ret = BLK_MQ_RQ_QUEUE_BUSY;
>>  		goto out;
>>  	}
>>  
>>  	if (blkif_request_flush_invalid(qd->rq, info)) {
>> +		spin_unlock_irq(&info->io_lock);
>>  		ret = BLK_MQ_RQ_QUEUE_ERROR;
>>  		goto out;
>>  	}
>>  
>>  	if (blkif_queue_request(qd->rq)) {
>> +		spin_unlock_irq(&info->io_lock);
>>  		blk_mq_stop_hw_queue(hctx);
>>  		ret = BLK_MQ_RQ_QUEUE_BUSY;
>>  		goto out;
>>  	}
>>  
>>  	flush_requests(info);
>> -out:
>>  	spin_unlock_irq(&info->io_lock);
>> +out:
>>  	return ret;
>>  }
> 
> I'd rather write the function something like:
> 
>  	spin_lock_irq(&info->io_lock);
>  	if (RING_FULL(&info->ring))
> 		goto out_busy;
>  	if (blkif_request_flush_invalid(qd->rq, info))
> 		goto out_error;
>   
> 	if (blkif_queue_request(qd->rq))
> 		goto out_busy;
> 
>   	flush_requests(info);
>   	spin_unlock_irq(&info->io_lock);
>   	return BLK_MQ_RQ_QUEUE_OK;
> out_error:
> 	spin_unlock_irq(&info->io_lock);
> 	return BLK_MQ_RQ_QUEUE_ERROR;
> out_busy:
> 	spin_unlock_irq(&info->io_lock);
> 	blk_mq_stop_hw_queue(hctx);
> 	return BLK_MQ_RQ_QUEUE_BUSY;
> }
> 

Thank you! Will be updated.

> Also this really should be merged into the first patch.
> 

I thought it would be easier for people to review by split into three
patches.
Anyway, I can merge them into the first one.

-- 
Regards,
-Bob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ