Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2270379ybe; Tue, 3 Sep 2019 10:17:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0xMyDAjLKRqi+LhGuFNkF0zT9cg0H2sE47stuFhHasOUww6MucUNA7OVG4Imy2rhrd1Zs X-Received: by 2002:a62:642:: with SMTP id 63mr41825366pfg.257.1567531041248; Tue, 03 Sep 2019 10:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567531041; cv=none; d=google.com; s=arc-20160816; b=rrSXJY07Y/Ll24+CvwRUPuyTag5aaW9eCmstLyo2M2YrRwha8BLy4fvvA8YXSzwnbh /4hA9v8+dxw5+ALkynTiNs/UidxwdzVXrYNfRZesNjCbjpH5c21JA64NZ7JCRx/+7QMz iC3TY60851Wo1QwgoIEE3jOnL0sMSs1o+AeZRbvP2IR9+K65NNaSTB/twC5EDNpDJ5VR PmyEsAX95nFuBwaPNthpL/XhjiHiJZeRFbHYXBCal2WOOif/rDhBDsvZkR8D3ZHgwuuE 2Y6f8fyXDA5ThcNr90twZxHMUAP9e1neuK//BrbDrdn/fu9nWlMf8CVhBq1ubB/WjVVR Pn4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=t6tGfYo/dTj24n3kyKLuufR3DdwgMhB7RVSFb+mWOVs=; b=BrZ0qyB8yckqVI1sfDPsgVlN4PurecPwuw95HxWnOApAk0ek54+yVseYHHxBZjT4iz AxoSEg3K1gDf9Dfl7K1JI8VJBwp3zT0RSVcwYw6JHLU/ww7GT8EMuusHMdghK93x5I75 vaSPFatKCciRw748GVGnZAl2L0zBLGTpyzvr+nEECk0QtUr43FUx6IflPA0fOXneGtdE wpcgYpbsnbIDAUf0N7/wFwMRxl8m7CYaEhg6ZwgAGxEV5ieB4x+uLbnKXDdj0pxxgw3s i5uAR9UP7wRlKbniJBlu/UcNfIrsOEbnbg+15uQkQ0m9avLSQLGVScjbf4NboHUozNYE V/Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si15246190plf.350.2019.09.03.10.17.03; Tue, 03 Sep 2019 10:17:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730135AbfICRPY (ORCPT + 99 others); Tue, 3 Sep 2019 13:15:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729602AbfICRPY (ORCPT ); Tue, 3 Sep 2019 13:15:24 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFE543C919 for ; Tue, 3 Sep 2019 17:15:23 +0000 (UTC) Received: by mail-qt1-f200.google.com with SMTP id b9so19649351qti.20 for ; Tue, 03 Sep 2019 10:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=t6tGfYo/dTj24n3kyKLuufR3DdwgMhB7RVSFb+mWOVs=; b=B8fqPY1dFDCXnlKLHefS+kCTRYWc3EeK2cQRRdOR6n+bCbTdq5JDdSnBMwCvbiihB2 ksafcW727ZCCEtJblBlZssy0DHsvFSJfVywlFuWst+OMN8NpsPeFRWS4Puce6o3rZq9o g/h56iNX4e0zSSR+rIJElIJo2zpsx/nN4scIt9NHc3+LupTCOJ0v6tDlZifUbUwwTfzL X4mBVZhFMZxGBdgtkZlX0xJzgfBI+rTgtyDrET99AvXPckVQDAt9QBXsazVRNRXMGiNl UWNvy0U7Ju0rzM+jstkeIaB5CQTrS8fooLVso+JFdWxcuquK+Bl6YcP8DG734vp6W6KL jc9A== X-Gm-Message-State: APjAAAValTZT3zWVfgDNfS0gBvisVlPbnlIXmaQl7CHfpumV1B97/uD/ M/oEm3ECb1xy3aFqMTrX+fQQC0RieoP884BpuICI+Jwr7MiJleK7QyapWzWFrDRLf2SlfyFSK9C jFBLO3AnptHGu20os3ZYaFIM+ X-Received: by 2002:a05:620a:15cc:: with SMTP id o12mr12890167qkm.140.1567530923144; Tue, 03 Sep 2019 10:15:23 -0700 (PDT) X-Received: by 2002:a05:620a:15cc:: with SMTP id o12mr12890124qkm.140.1567530922908; Tue, 03 Sep 2019 10:15:22 -0700 (PDT) Received: from redhat.com (bzq-79-180-62-110.red.bezeqint.net. [79.180.62.110]) by smtp.gmail.com with ESMTPSA id t2sm8561495qkm.34.2019.09.03.10.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 10:15:21 -0700 (PDT) Date: Tue, 3 Sep 2019 13:15:16 -0400 From: "Michael S. Tsirkin" To: Vivek Goyal Cc: Miklos Szeredi , Jason Wang , virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, virtio-fs@redhat.com, Stefan Hajnoczi , "Dr. David Alan Gilbert" Subject: Re: [PATCH v3 00/13] virtio-fs: shared file system for virtual machines Message-ID: <20190903111628-mutt-send-email-mst@kernel.org> References: <20190821173742.24574-1-vgoyal@redhat.com> <20190903041507-mutt-send-email-mst@kernel.org> <20190903140752.GA10983@redhat.com> <20190903101001-mutt-send-email-mst@kernel.org> <20190903141851.GC10983@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190903141851.GC10983@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 10:18:51AM -0400, Vivek Goyal wrote: > On Tue, Sep 03, 2019 at 10:12:16AM -0400, Michael S. Tsirkin wrote: > > On Tue, Sep 03, 2019 at 10:07:52AM -0400, Vivek Goyal wrote: > > > On Tue, Sep 03, 2019 at 04:31:38AM -0400, Michael S. Tsirkin wrote: > > > > > > [..] > > > > + /* TODO lock */ > > > > give me pause. > > > > > > > > Cleanup generally seems broken to me - what pauses the FS > > > > > > I am looking into device removal aspect of it now. Thinking of adding > > > a reference count to virtiofs device and possibly also a bit flag to > > > indicate if device is still alive. That way, we should be able to cleanup > > > device more gracefully. > > > > Generally, the way to cleanup things is to first disconnect device from > > linux so linux won't send new requests, wait for old ones to finish. > > I was thinking of following. > > - Set a flag on device to indicate device is dead and not queue new > requests. Device removal call can set this flag. > > - Return errors when fs code tries to queue new request. > > - Drop device creation reference in device removal path. If device is > mounted at the time of removal, that reference will still be active > and device state will not be cleaned up in kernel yet. > > - User unmounts the fs, and that will drop last reference to device and > will lead to cleanup of in kernel state of the device. > > Does that sound reasonable. > > Vivek Just we aware of the fact that virtio device, all vqs etc will be gone by the time remove returns. -- MST