From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756170AbeAIDIb (ORCPT + 1 other); Mon, 8 Jan 2018 22:08:31 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:37824 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeAIDI3 (ORCPT ); Mon, 8 Jan 2018 22:08:29 -0500 Subject: Re: [PATCH 5/7] blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq To: Tejun Heo Cc: jbacik@fb.com, jack@suse.cz, axboe@kernel.dk, clm@fb.com, kernel-team@fb.com, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, peterz@infradead.org, Bart.VanAssche@wdc.com References: <20171216120726.517153-1-tj@kernel.org> <20171216120726.517153-6-tj@kernel.org> <64dfa760-d433-1537-9bc6-b12cda3c9dc6@oracle.com> <20171221135051.GE1084507@devbig577.frc2.facebook.com> <4e5aa629-f341-d077-961b-c778ceb31154@oracle.com> <20180108172723.GY3668920@devbig577.frc2.facebook.com> From: "jianchao.wang" Message-ID: <9b367cee-ecd8-cd45-9bdb-e79c29d956dd@oracle.com> Date: Tue, 9 Jan 2018 11:08:04 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180108172723.GY3668920@devbig577.frc2.facebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8768 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=922 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801090039 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi tejun Many thanks for you kindly response. On 01/09/2018 01:27 AM, Tejun Heo wrote: > Hello, Jianchao. > > On Fri, Dec 22, 2017 at 12:02:20PM +0800, jianchao.wang wrote: >>> On Thu, Dec 21, 2017 at 11:56:49AM +0800, jianchao.wang wrote: >>>> It's worrying that even though the blk_mark_rq_complete() here is >>>> intended to synchronize with timeout path, but it indeed give the >>>> blk_mq_complete_request() the capability to exclude with >> >> There could be scenario where the driver itself stop a request >> itself with blk_mq_complete_request() or some other interface that >> will invoke it, races with the normal completion path where a same >> request comes. > > But what'd prevent the completion reinitializing the request and then > the actual completion path coming in and completing the request again? > blk_mark_rq_complete() will gate and ensure there will be only one __blk_mq_complete_request() to be invoked. >> For example: >> a reset could be triggered through sysfs on nvme-rdma >> Then the driver will cancel all the reqs, including in-flight ones. >> nvme_rdma_reset_ctrl_work() >> nvme_rdma_shutdown_ctrl() >> >>>> >> if (ctrl->ctrl.queue_count > 1) { >> nvme_stop_queues(&ctrl->ctrl); //quiesce the queue >> blk_mq_tagset_busy_iter(&ctrl->tag_set, >> nvme_cancel_request, &ctrl->ctrl); //invoke blk_mq_complete_request() >> nvme_rdma_destroy_io_queues(ctrl, shutdown); >> } >> >>>> >> >> These operations could race with the normal completion path of in-flight ones. >> It should drain all the in-flight ones first here. But there maybe some other >> places similar with this. > > If there are any such places, they should be using an interface which > is propelry synchronized like blk_abort_request(), which btw is what > libata already does. Otherwise, it's racy with or without these > patches. Yes, it is that. Thanks for you kindly response again. Jianchao