Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp309321ybe; Thu, 5 Sep 2019 23:03:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/zuyPo1PSw/oe0K9bsRVZdXRhvOU++Uo0AwSYUUVlLXwM6F02v9R4GvCrI/6SvMo+MDRi X-Received: by 2002:a63:d30f:: with SMTP id b15mr6451955pgg.341.1567749789957; Thu, 05 Sep 2019 23:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567749789; cv=none; d=google.com; s=arc-20160816; b=dOtexHZPH+PDiZhFavR79ZpDcZHnzMPRYyBLZUw/PUSTTaIFHXZDgp9OqdSRx0ssLO XlGoY4jSW6q1CqyxDpfNheYNdSBhXDE1KcqBVhwOYd481XA8Gk0Dtomq37qUqloP5G2L RvkaIV5ylWvn71h8qv8AK2TUgDgKia8i2y4krUqkkoj/8OBlqgXyIz5q5/rZ5w0OYOWP bfoG/W3eHW3SMg8YxXowFyjRHNR/1EALBQuXuksSJ+pAxqzQJtgLGCAE67M+J/ZNEqZC 7UFUpBH3yPv2uglVj6D50vdClZ5+oHGRIc3slud7JvO5ai36Ze7+31STj38FjPyjwtBI gHxQ== 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=kNO8mYCF/dauNiArpmz2ciYOWXcq+OZ7YT4h9nGV2r4=; b=gZuAHbogIe2rxln5QQS0TB2p07aPix1QpRaflYzGCTQPZQy/Mr2dxRD6dfmIhHFkLU 3bA69GtwtgHG6UcsoNTtqToc0brlP4kdQWPbB5fnobDzTnt6aaOfCLNLoAGoTujK9Dwl JtYdPhBnBhw5VoWWHlSX+gza1O/cVo4C8hjARoOHlgIDr4jjjbEPLaNp/vJSNuNqsl3V ZpgiBpQpZbByqBJMH6/lLAMUAXsnMIOhE7WvQ2WUS/NXrlRd+kaeOYYfC0c2w5BsL82L tCJoBAWo9NhNcTKQDAOfsX8jaLiatQ3mkGgIddQsruNNT6g7MZZwewLIk1dTR/1fYihj 1DHA== 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 j2si3811364plt.349.2019.09.05.23.02.40; Thu, 05 Sep 2019 23:03:09 -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 S2391533AbfIETuz (ORCPT + 99 others); Thu, 5 Sep 2019 15:50:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60344 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732510AbfIETt0 (ORCPT ); Thu, 5 Sep 2019 15:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F071E3175295; Thu, 5 Sep 2019 19:49:25 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44F1B100194E; Thu, 5 Sep 2019 19:49:18 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id D06FE22539C; 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 04/18] virtiofs: Check connected state for VQ_REQUEST queue as well Date: Thu, 5 Sep 2019 15:48:45 -0400 Message-Id: <20190905194859.16219-5-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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); 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 Right now we are checking ->connected state only for VQ_HIPRIO. Now we want to make use of this method for all queues. So check it for VQ_REQUEST as well. This will be helpful if device has been removed and virtqueue is gone. In that case ->connected will be false and request can't be submitted anymore and user space will see error -ENOTCONN. Signed-off-by: Vivek Goyal --- fs/fuse/virtio_fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 9d30530e3ca9..c46dd4d284d6 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -755,6 +755,12 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, spin_lock(&fsvq->lock); + if (!fsvq->connected) { + spin_unlock(&fsvq->lock); + ret = -ENOTCONN; + goto out; + } + vq = fsvq->vq; ret = virtqueue_add_sgs(vq, sgs, out_sgs, in_sgs, req, GFP_ATOMIC); if (ret < 0) { -- 2.20.1