Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1457492ybe; Thu, 5 Sep 2019 16:04:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2feVqKB8plJ2bcwj8fBqLjjZPYcxTMBE0f/xknyHXfR9l3yCNtRieHwuta+yo3PmkzdsW X-Received: by 2002:a63:dd0c:: with SMTP id t12mr5199593pgg.82.1567724666195; Thu, 05 Sep 2019 16:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567724666; cv=none; d=google.com; s=arc-20160816; b=o3vOpmfv+PwpjssOaVImamdgobFJ/kAjzEUKqgYX+yQCJ2Fkjg4bC9t69hMsEgEOL+ jrYooW/JID1LPGV+Sm1Q4grygPKMnX90YVGfcOH6LYhILhuKA4hp6atcNkQjsAyYFfkZ ebf/PnH6+FbRC9AjHWaDC9AR9AH/JwnRbOWz2NCkNcV1PPgqNBgMbpv7l4yRqjPUpA12 FuUql9QL9CgbHHMVFmiENMht9m1YJPDz1isIWJv/tS7nnpV2a+besWQ6SWPMlAvLhhWX nLfYSIlo2r7NVUa0k/MyTU239K5hL2hufmPsWL8dkAOnqPeB5rCRBbB7ZLnmCkTrfy3D yywA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=12iqOPnlu429HHJxHualDchWJWD+Asqk8leXM8GavHI=; b=IGGKmZIOnea5KTAQnVpis0Qq9YLTGyiNfGxKnkyh+ixkZxbVvFtiivLi8ofljOAc8x 0EkKIUM5hNf9IZGjuw878Me81DvYl/HiVneaWYjz19Y1jxN4kJ4oiJrCgZ1bJP9odZ1v 0YUqJHR7IuqoWf0JvnXSTa/h+ZIZ4Unb0uQYSjdp8EKeHdAvxaVf+QkClOQuJWPlTPbR VlT1p+CyJ3UYgEE0+ax+sJ76FBM9TQukN4WDGdMTLHJAYCAp6hWnYKeUvizW+hl09tFd eEL7rZOBFnb1reMAc4RoOmNY2FsPIqNF3gfwJ67D6wnCZJseNbiwEYJoxxUkoxUyQ/7H eVig== 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 x28si3894244pfr.36.2019.09.05.16.04.10; Thu, 05 Sep 2019 16:04:26 -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 S2390112AbfIETtc (ORCPT + 99 others); Thu, 5 Sep 2019 15:49:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732060AbfIETt0 (ORCPT ); Thu, 5 Sep 2019 15:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DE2F18C4266; Thu, 5 Sep 2019 19:49:26 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 668FF600F8; Thu, 5 Sep 2019 19:49:26 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id E279922539F; Thu, 5 Sep 2019 15:49:17 -0400 (EDT) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, virtualization@lists.linux-foundation.org, miklos@szeredi.hu Cc: linux-kernel@vger.kernel.org, virtio-fs@redhat.com, vgoyal@redhat.com, stefanha@redhat.com, dgilbert@redhat.com, mst@redhat.com Subject: [PATCH 07/18] virtiofs: Stop virtiofs queues when device is being removed Date: Thu, 5 Sep 2019 15:48:48 -0400 Message-Id: <20190905194859.16219-8-vgoyal@redhat.com> In-Reply-To: <20190905194859.16219-1-vgoyal@redhat.com> References: <20190905194859.16219-1-vgoyal@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 05 Sep 2019 19:49:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stop all the virt queues when device is going away. This will ensure that no new requests are submitted to virtqueue and and request will end with error -ENOTCONN. Signed-off-by: Vivek Goyal --- fs/fuse/virtio_fs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index f68a25ca9e9d..90e7b2f345e5 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -493,10 +493,24 @@ static int virtio_fs_probe(struct virtio_device *vdev) return ret; } +static void virtio_fs_stop_all_queues(struct virtio_fs *fs) +{ + struct virtio_fs_vq *fsvq; + int i; + + for (i = 0; i < fs->nvqs; i++) { + fsvq = &fs->vqs[i]; + spin_lock(&fsvq->lock); + fsvq->connected = false; + spin_unlock(&fsvq->lock); + } +} + static void virtio_fs_remove(struct virtio_device *vdev) { struct virtio_fs *fs = vdev->priv; + virtio_fs_stop_all_queues(fs); vdev->config->reset(vdev); virtio_fs_cleanup_vqs(vdev, fs); -- 2.20.1