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 86C97C6FA82 for ; Fri, 23 Sep 2022 13:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231916AbiIWNsh (ORCPT ); Fri, 23 Sep 2022 09:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231551AbiIWNsg (ORCPT ); Fri, 23 Sep 2022 09:48:36 -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 627B0E7431 for ; Fri, 23 Sep 2022 06:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663940914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c25qKkQtr8eg0uMGbc/9kUwAiXIlPBy7C//4rh/Zkj4=; b=dTh8lF2+VOjh5qoquiyVC+QNU+61N0dstkNax/6y/G0sgN2cLvccUsVHnZNvLVA4MjSrKt OgbNka4D843wNf3n8X3wh3BxqQgFbELpBf6fO47qFLZ3amYenykYViNPepy0KcNPoscfRo zwDou/IO/WUaoGkV8CBE2BiYJCBxsrs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-464-bL9OT4CAPrKPz1CnLhjiWA-1; Fri, 23 Sep 2022 09:48:25 -0400 X-MC-Unique: bL9OT4CAPrKPz1CnLhjiWA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 796A985A59D; Fri, 23 Sep 2022 13:48:25 +0000 (UTC) Received: from T590 (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BCD840E0426; Fri, 23 Sep 2022 13:48:20 +0000 (UTC) Date: Fri, 23 Sep 2022 21:48:15 +0800 From: Ming Lei To: ZiyangZhang Cc: axboe@kernel.dk, xiaoguang.wang@linux.alibaba.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com Subject: Re: [RESEND PATCH V5 4/7] ublk_drv: consider recovery feature in aborting mechanism Message-ID: References: <20220923061505.52007-1-ZiyangZhang@linux.alibaba.com> <20220923061505.52007-5-ZiyangZhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923061505.52007-5-ZiyangZhang@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Fri, Sep 23, 2022 at 02:15:02PM +0800, ZiyangZhang wrote: > With USER_RECOVERY feature enabled, the monitor_work schedules > quiesce_work after finding a dying ubq_daemon. The monitor_work > should also abort all rqs issued to userspace before the ubq_daemon is > dying. The quiesce_work's job is to: > (1) quiesce request queue. > (2) check if there is any INFLIGHT rq. If so, we retry until all these > rqs are requeued and become IDLE. These rqs should be requeued by > ublk_queue_rq(), task work, io_uring fallback wq or monitor_work. > (3) complete all ioucmds by calling io_uring_cmd_done(). We are safe to > do so because no ioucmd can be referenced now. > (5) set ub's state to UBLK_S_DEV_QUIESCED, which means we are ready for > recovery. This state is exposed to userspace by GET_DEV_INFO. > > The driver can always handle STOP_DEV and cleanup everything no matter > ub's state is LIVE or QUIESCED. After ub's state is UBLK_S_DEV_QUIESCED, > user can recover with new process. > > Note: we do not change the default behavior with reocvery feature > disabled. monitor_work still schedules stop_work and abort inflight > rqs. And finally ublk_device is released. > > Signed-off-by: ZiyangZhang Looks fine, Reviewed-by: Ming Lei Thanks, Ming