Message ID | 20230324135808.855245-7-ming.lei@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp659606vqo; Fri, 24 Mar 2023 07:16:16 -0700 (PDT) X-Google-Smtp-Source: AKy350YgHNZg1Vr3UoN8bHAsRZpRIFTUVnZw5WxcExEWhhLEogTMzEr0d2iM43gXA1tt6N/QIttn X-Received: by 2002:a05:6402:10d8:b0:4fb:2296:30b3 with SMTP id p24-20020a05640210d800b004fb229630b3mr3322934edu.15.1679667376766; Fri, 24 Mar 2023 07:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679667376; cv=none; d=google.com; s=arc-20160816; b=I3CsFP57eGjj2WyeA9FXc6eSF8jnwD8pOKlfUrEqsTsdPvUpJQsnn63ahMcDGu0J54 7iq234ijHxl4yXSkxY7PPz07C0fAFK2wu0eXnTL+T1yb5mv5qB7M4VGyXea7F+YuFHZ1 pFCLgL4kUH/jUup5prilYV8skujBepylcqK+zOWAOC5VjAdAyBr4BgaKAo/J9zqrN+1y jpFPEs/do+f15Fi4p5b5bRpAfFGnpOSwllQpkP+jNrybM4rpRbXF8pu9YvswBukE4kGe 3Hzs0Uy8tHybo765bCo0QRQJqJ8RVsyLuoU2h73RoUipH//Kl038vWIsZfutPRuEEaHD mbrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5yLNYQmV+u2VRfFCW1SdaEMv1D/RkRV8OgRAz/vRVGU=; b=bSAj7b/DuI03rqyTF8tcQO542hwMYmjqV0spOdOcPwXLw4icJq6OeBWCMODlAd1y3f Ul8bV91ZNUQNuniA5NpUIjgHgW3wEXMPnmoCsYy1zdyJCzZ5JhlwIkCNoIAc5UQ0oXZL CXZ0H9C5+su7ui4exhWm8y5USddu1mEpgfnS6hj/8Ft06iehor4Nj+7OJ4YTcOnOt/WH f/iKbjcTusrSBM2odxyBhoUL4pt7E9flXd7BRKKCSd0kXYIOkWdLmGIOfNUjMIjXMDnI DQbIFDzWnb5lAd/fTsgVQXa8Sr0A+gQhfl1n/3KmnpxexxWIP/a2Vnwbjh3qveV2gb2I gMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLT7GbCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d25-20020aa7d699000000b004fc8943f1ffsi236033edr.211.2023.03.24.07.15.48; Fri, 24 Mar 2023 07:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLT7GbCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232030AbjCXOAZ (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Fri, 24 Mar 2023 10:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbjCXOAG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Mar 2023 10:00:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 187A01ADEC for <linux-kernel@vger.kernel.org>; Fri, 24 Mar 2023 06:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679666327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5yLNYQmV+u2VRfFCW1SdaEMv1D/RkRV8OgRAz/vRVGU=; b=JLT7GbCVy9A7Wv9iygS7SYkC1ZCOHGHQJ7+Ouh3/Z9mbasqlV1LNGkdXV3OjojFNMQbyuu ojHvab8OlwfLojo/Zh8idJvm51Mg5zbEkJDXdXNqDsvwm9X6ttZKLy5gty+BAvynCij+l+ oqP06G020xqkYOttGXbmPYKpQQSAZes= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396-OR_HhzrAOzW_mW1BOzVbcg-1; Fri, 24 Mar 2023 09:58:43 -0400 X-MC-Unique: OR_HhzrAOzW_mW1BOzVbcg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BF851C0A593; Fri, 24 Mar 2023 13:58:42 +0000 (UTC) Received: from localhost (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD331121318; Fri, 24 Mar 2023 13:58:41 +0000 (UTC) From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miklos Szeredi <mszeredi@redhat.com>, ZiyangZhang <ZiyangZhang@linux.alibaba.com>, Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>, Bernd Schubert <bschubert@ddn.com>, Pavel Begunkov <asml.silence@gmail.com>, Stefan Hajnoczi <stefanha@redhat.com>, Ming Lei <ming.lei@redhat.com> Subject: [PATCH V4 06/17] block: ublk_drv: mark device as LIVE before adding disk Date: Fri, 24 Mar 2023 21:57:57 +0800 Message-Id: <20230324135808.855245-7-ming.lei@redhat.com> In-Reply-To: <20230324135808.855245-1-ming.lei@redhat.com> References: <20230324135808.855245-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761258899149420441?= X-GMAIL-MSGID: =?utf-8?q?1761258899149420441?= |
Series |
io_uring/ublk: add IORING_OP_FUSED_CMD
|
|
Commit Message
Ming Lei
March 24, 2023, 1:57 p.m. UTC
IO can be started before add_disk() returns, such as reading parititon table, then the monitor work should work for making forward progress. So mark device as LIVE before adding disk, meantime change to DEAD if add_disk() fails. Reviewed-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/block/ublk_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index d1d1c8d606c8..fb5a557afde8 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1602,17 +1602,18 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd) set_bit(GD_SUPPRESS_PART_SCAN, &disk->state); get_device(&ub->cdev_dev); + ub->dev_info.state = UBLK_S_DEV_LIVE; ret = add_disk(disk); if (ret) { /* * Has to drop the reference since ->free_disk won't be * called in case of add_disk failure. */ + ub->dev_info.state = UBLK_S_DEV_DEAD; ublk_put_device(ub); goto out_put_disk; } set_bit(UB_STATE_USED, &ub->state); - ub->dev_info.state = UBLK_S_DEV_LIVE; out_put_disk: if (ret) put_disk(disk);