Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2052849ybe; Tue, 3 Sep 2019 07:20:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQez6ldgCMbYI4NdMInzepov03NN5FqEDUZrRgwj3K4J7SuXhCGgOq/9jPZllks0aT9tPt X-Received: by 2002:a62:b416:: with SMTP id h22mr1243367pfn.180.1567520418970; Tue, 03 Sep 2019 07:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520418; cv=none; d=google.com; s=arc-20160816; b=xwCMk1hzuAhrgs75W18h7pNOPvndimsSdwAoP1L4vrIYryX6EK/xMr+1TyIkJ48tDx jCrV5bnvw5+VZtqcSRKQLCx+dcOgrQAop2pHl58CY4j87UPYJIvQicqUOgEN+8LVkc80 ehbEgzCIcL0prC09GyW6XExzx/9wSv85IPjfYMrvvtRRpv0ns5VFS7SQJJ1vRcN7sZu6 xmb/nELQ5CLBkcEVVUCyPOVta00c3tMOGjQ5PNtaXFwKB+zeXR7i9YJJouxb9Jm9hFcg Nj6WU/JmOqQToLXGOvpO1Jaqsifi5ZuVyFMkpb4cqWd1/3vTG6Uu7tMcgzLkl51L+B9c C1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jPaV3o5A9gVOzebKUkSF5ANSGh47cSASIYrcPjN3VKQ=; b=Bzq/gb8uJ2ycERHRviKUjnHfVAdydtxASneBiKqjpDrDmdvrsqUVWNem/PZxZWtzBk KujUqvEcxw1nKa06CXJH3jk3AgC3G7dqCiuvzh3iBtKYRp1FWmYIO/p/2xnD4vf2sv5o 9bMlSyZUGXbNu/bk7m4OMmMvncHG0uz9SngacPLWnN1K1FvZ5PtFfgKjb4ilAMKHTVwo Q8hp8qFefF5UmYW3Hjx/Z6vHtkCsyd8vbgxJL4ZhQSb8oRNVKP8DlbjcJ2cqq/6ls0C1 rDcn9fObOXKqVGOSiUu/rieDm5n3VAP00sWcJAugBQatx0XKFrVdcTgzHr/u0Iar8i9x 1fig== 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 o19si14456056pgj.120.2019.09.03.07.20.02; Tue, 03 Sep 2019 07:20:18 -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 S1729417AbfICOTA (ORCPT + 99 others); Tue, 3 Sep 2019 10:19:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfICOTA (ORCPT ); Tue, 3 Sep 2019 10:19:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87477302C060; Tue, 3 Sep 2019 14:19:00 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id E858060CCE; Tue, 3 Sep 2019 14:18:51 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 762BB220292; Tue, 3 Sep 2019 10:18:51 -0400 (EDT) Date: Tue, 3 Sep 2019 10:18:51 -0400 From: Vivek Goyal To: "Michael S. Tsirkin" 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: <20190903141851.GC10983@redhat.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190903101001-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 03 Sep 2019 14:19:00 +0000 (UTC) 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: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