Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1013493rwb; Fri, 23 Sep 2022 07:11:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62FweYKe2RUG9ASadsNe3I+geD5RcIuW4Rfc35aiR9uUKEJLosEtVKBgh4h9Coq8IZ1c43 X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr8558287edb.249.1663942279604; Fri, 23 Sep 2022 07:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663942279; cv=none; d=google.com; s=arc-20160816; b=oTobVVat8dDGjr6Awf/+e0TtWtowxkh/4sEjfaS80NgoKGXx4GMUJIPfZhfdjpL6me 0cqLDBkVCeREJouSqhgmH+3S+S6xnZaXfQR1XmjY8RyWID4qZgj0EN+SGTKxOg1Ku6mW 8x0Za0kjtJxOOQi+q+3tSf3dXrtnPS2/j1ZFHWrnPJrN4O3UzK5upiRgkytG+VWQG+Re HdrKgPWgRaXZk17hcsT83WiPr5lvMl9ZiB3d8X/AHKTIpCoCNRbDh7un0uEz4/3YrqE/ ypYv92VayxrbRFEDInelOYv/HcwQSbzjoNN50FXL4X9vrqg8TvkhfFPMLhi0VuR+dozE HnvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1UCrnIiJHXHNqsN3S35cn3dnzyzc2EF3aYigy2M2Wvk=; b=S1S7f8rFTq4JbUhX+7MNV/6cQAo08GSiXP5o6/xFP1YCIdYSp3fCpQoIuqKg7jStZi NZ7ptJohzYBtV/U9JbCRYP3XiZpI5EHmSn0qjSPJK9YaaFdJNWaPfqXAxWS149q69Bpg +WbnRflRETmuoDFM3fl22q9dmbeO3NPwlyBHfNrNv6PXRdpPz4bVRhlH3wCpfobnREsW qSDyLE3avlgziy7mwqAc4Eb69toOYUb0tldqHpiCGt5BT/b4yo0ipBGi9bcDjTHZNuoO V8xJPOfYLCW2vlHe+j/wwioIDVV11EkmRBWXSeD44N6HQuY3jBuAkR2nUycbPd1M91WJ YU6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=arjjdcK4; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s27-20020a50d49b000000b0045154448cc3si7657992edi.573.2022.09.23.07.10.54; Fri, 23 Sep 2022 07:11:19 -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=arjjdcK4; 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 S232482AbiIWNuz (ORCPT + 99 others); Fri, 23 Sep 2022 09:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232493AbiIWNuu (ORCPT ); Fri, 23 Sep 2022 09:50:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BD38132D66 for ; Fri, 23 Sep 2022 06:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663941041; 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=1UCrnIiJHXHNqsN3S35cn3dnzyzc2EF3aYigy2M2Wvk=; b=arjjdcK4rEnrwb8fv2I/JMPHJBjDh8GmWC1XZsNxCoemIGjT0Ok33wlr1k5zPsg02FKbGZ sHmpWoAYbvk7/xV+vnI9v028d4FvzKMmJ1Pq1WimUzTeh2li7UgI/yhi8FgBs9pz08axwr smXiOODn4H174PfJKVyokrFt6Maa4e8= 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-77-7c4uVgBeMyysQ2vmI9n-Mw-1; Fri, 23 Sep 2022 09:50:39 -0400 X-MC-Unique: 7c4uVgBeMyysQ2vmI9n-Mw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56FB3101E157; Fri, 23 Sep 2022 13:50:39 +0000 (UTC) Received: from T590 (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA81E2166B40; Fri, 23 Sep 2022 13:50:34 +0000 (UTC) Date: Fri, 23 Sep 2022 21:50:29 +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 6/7] ublk_drv: add START_USER_RECOVERY and END_USER_RECOVERY support Message-ID: References: <20220923061505.52007-1-ZiyangZhang@linux.alibaba.com> <20220923061505.52007-7-ZiyangZhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923061505.52007-7-ZiyangZhang@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 23, 2022 at 02:15:04PM +0800, ZiyangZhang wrote: > START_USER_RECOVERY and END_USER_RECOVERY are two new control commands > to support user recovery feature. > > After a crash, user should send START_USER_RECOVERY, it will: > (1) check if (a)current ublk_device is UBLK_S_DEV_QUIESCED which was > set by quiesce_work and (b)chardev is released > (2) reinit all ubqs, including: > (a) put the task_struct and reset ->ubq_daemon to NULL. > (b) reset all ublk_io. > (3) reset ub->mm to NULL. > > Then, user should start a new process and send FETCH_REQ on each > ubq_daemon. > > Finally, user should send END_USER_RECOVERY, it will: > (1) wait for all new ubq_daemons getting ready. > (2) update ublksrv_pid > (3) unquiesce the request queue and expect incoming ublk_queue_rq() > (4) convert ub's state to UBLK_S_DEV_LIVE > > Note: we can handle STOP_DEV between START_USER_RECOVERY and > END_USER_RECOVERY. This is helpful to users who cannot start new process > after sending START_USER_RECOVERY ctrl-cmd. > > Signed-off-by: ZiyangZhang Reviewed-by: Ming Lei Thanks, Ming