From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A89DC433EF for ; Thu, 17 Feb 2022 18:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238405AbiBQSqx (ORCPT ); Thu, 17 Feb 2022 13:46:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235553AbiBQSqw (ORCPT ); Thu, 17 Feb 2022 13:46:52 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C443CFCD; Thu, 17 Feb 2022 10:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=s56TtY8DxMR7zBFoRRt9eI9KXJDyEEH2IYtgCwy2sC8=; b=a249VHjfyQYY9fpZ9TV8pJzxRO veDARkv1Wr6CPTEB0/uMLIGiIgggQ1XI/Q4O2iw6UyUj8G2xA2aiM2FZHabWv4XPOSYE/tdpHHpVA YFrTqSZs2BeGEQgkQe4AA+5LO2mMzg+6bRxn8dq8oG/BI7kjAS/XrJallZmXcQjRikEBm2a9l3HH6 EtwF1qQoZTK5xXdWyb44BkGvhJJD+xzRlNfi4l8hvuNQaV++47QDnanD9AzaN1ttfy/0J5BqWKavu VvPc2ThkJ+O6+KozhzBDnCT9Vpay4kAjR5/czaUtuelASEdH5X8V6jhidJNfkjBhLuN925nY9pCiM 85wtsH5Q==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKlnY-00BmkR-7h; Thu, 17 Feb 2022 18:46:36 +0000 Date: Thu, 17 Feb 2022 10:46:36 -0800 From: Luis Chamberlain To: Jens Axboe Cc: Kanchan Joshi , Kanchan Joshi , io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Christoph Hellwig , Keith Busch , Javier =?iso-8859-1?Q?Gonz=E1lez?= , Anuj Gupta , Pankaj Raghav Subject: Re: [RFC 01/13] io_uring: add infra for uring_cmd completion in submitter-task Message-ID: References: <20211220141734.12206-1-joshi.k@samsung.com> <20211220141734.12206-2-joshi.k@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Thu, Feb 17, 2022 at 08:50:59AM -0700, Jens Axboe wrote: > On 2/17/22 8:39 AM, Kanchan Joshi wrote: > > On Thu, Feb 17, 2022 at 7:43 AM Luis Chamberlain wrote: > >> > >> On Mon, Dec 20, 2021 at 07:47:22PM +0530, Kanchan Joshi wrote: > >>> Completion of a uring_cmd ioctl may involve referencing certain > >>> ioctl-specific fields, requiring original submitter context. > >>> Export an API that driver can use for this purpose. > >>> The API facilitates reusing task-work infra of io_uring, while driver > >>> gets to implement cmd-specific handling in a callback. > >>> > >>> Signed-off-by: Kanchan Joshi > >>> Signed-off-by: Anuj Gupta > >>> --- > >>> fs/io_uring.c | 16 ++++++++++++++++ > >>> include/linux/io_uring.h | 8 ++++++++ > >>> 2 files changed, 24 insertions(+) > >>> > >>> diff --git a/fs/io_uring.c b/fs/io_uring.c > >>> index e96ed3d0385e..246f1085404d 100644 > >>> --- a/fs/io_uring.c > >>> +++ b/fs/io_uring.c > >>> @@ -2450,6 +2450,22 @@ static void io_req_task_submit(struct io_kiocb *req, bool *locked) > >>> io_req_complete_failed(req, -EFAULT); > >>> } > >>> > >>> +static void io_uring_cmd_work(struct io_kiocb *req, bool *locked) > >>> +{ > >>> + req->uring_cmd.driver_cb(&req->uring_cmd); > >> > >> If the callback memory area is gone, boom. > > > > Why will the memory area be gone? > > Module removal is protected because try_module_get is done anyway when > > the namespace was opened. > > And the req isn't going away before it's completed. Just to be clear, I was thinking outside of the block layer context too. Does this still hold true? Luis