Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp904249ybe; Fri, 6 Sep 2019 09:01:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQzze57MFRxMTe+bv+GGf53ql08IOFUfBy7Ahhk6VhdGjKNFbP3Hd1AwxTkiqtQg1m4IDU X-Received: by 2002:a17:902:7246:: with SMTP id c6mr10064241pll.190.1567785714911; Fri, 06 Sep 2019 09:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567785714; cv=none; d=google.com; s=arc-20160816; b=HOiZbNXupNFAFJzJH2/XiXk2YwfflKSmUoOa0MArXVtsuew06L+zTLnvSoruNGAMeh LAGPa/LCAX2v0HnLYWB1dRDAFeNYJlW8nLXt3jnKhQPmRX/aHA/LuuPF4fKx19BhCJ9q uo0Qibwr6S4K4h7XnUZHzjBq5oy3frhcg/A7HqJ1s6cZJ5ckhXt1yIcZn34EJNFxCJ+8 kIRdgm/uB9Tw39n4ewZwGT/p08npMHhk21iGzruC70dShCJndztOsnO3yz2zrKh0oJYN bFyY9rOhuHcuMOa7uMsAUga+tvHAxb7Oj4kQ2s57RGxU5NQ1sw16LIS4CKIKmU9zJfQ0 GR7g== 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=m2LMOHkInNP9m+ffqiHuL4Dvz22GomD/Bi7Wsq+/aAM=; b=rHEv+L+WaTp5AsBXvuNtqJ3lmfF2wVGf3914Tj1j/1KH97wCcEuLOVeWByGaQzbGA+ fwQDbPiJ0itl5Wqn2g28svwyJMDI01ayzOLIxYj2Aaf6O2YCgtpcjPeY1lcLb6B3KNiU cWr8xsQnkTqkRV4J0pPNd1iSG4pO6Swc589rSpJcxo0SLjsbxv/7Ou4NpBpLLWeXFmPq 2c3ZLx4JUGrELP4WZB2jC0SO12kNTpiaMbXl7yQ6tzcI4UOQYRiheHix5fYVciwEDfFZ pV0+87oLpXO9js9jT9DXKZeuimeDfRKT5+YUo8HtYKykZ6uv8epLJzn03mPjl45noznq z6aA== 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 t1si4894006plo.8.2019.09.06.09.01.38; Fri, 06 Sep 2019 09:01:54 -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 S2391162AbfIFKwR (ORCPT + 99 others); Fri, 6 Sep 2019 06:52:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725946AbfIFKwR (ORCPT ); Fri, 6 Sep 2019 06:52:17 -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 B8532800DD4; Fri, 6 Sep 2019 10:52:16 +0000 (UTC) Received: from localhost (ovpn-117-208.ams2.redhat.com [10.36.117.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id C21C460BF1; Fri, 6 Sep 2019 10:52:11 +0000 (UTC) Date: Fri, 6 Sep 2019 11:52:10 +0100 From: Stefan Hajnoczi To: Vivek Goyal Cc: linux-fsdevel@vger.kernel.org, virtualization@lists.linux-foundation.org, miklos@szeredi.hu, linux-kernel@vger.kernel.org, virtio-fs@redhat.com, dgilbert@redhat.com, mst@redhat.com Subject: Re: [PATCH 08/18] virtiofs: Drain all pending requests during ->remove time Message-ID: <20190906105210.GP5900@stefanha-x1.localdomain> References: <20190905194859.16219-1-vgoyal@redhat.com> <20190905194859.16219-9-vgoyal@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4IFtMBbmeqbTM/ox" Content-Disposition: inline In-Reply-To: <20190905194859.16219-9-vgoyal@redhat.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Fri, 06 Sep 2019 10:52:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4IFtMBbmeqbTM/ox Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 05, 2019 at 03:48:49PM -0400, Vivek Goyal wrote: > +static void virtio_fs_drain_queue(struct virtio_fs_vq *fsvq) > +{ > + WARN_ON(fsvq->in_flight < 0); > + > + /* Wait for in flight requests to finish.*/ > + while (1) { > + spin_lock(&fsvq->lock); > + if (!fsvq->in_flight) { > + spin_unlock(&fsvq->lock); > + break; > + } > + spin_unlock(&fsvq->lock); > + usleep_range(1000, 2000); > + } I think all contexts that call this allow sleeping so we could avoid usleep here. --4IFtMBbmeqbTM/ox Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl1yOloACgkQnKSrs4Gr c8gmeQgAoJQJeQAjTj+aeNGzBdb4oLsqKKM6Q+4z3dqyaIM7pOTsdgiPZ/q1DA5U 3/e2c4UFDTEg+r9xvEx5FFgBiPFrpwGU3N8mroPEUY9yueCllNsIZmS0y8n76YDb dCAPCksGMF4o9AWlHAMnxFoao+EfbsJd1mNU/7f7hFqFQoAuCu64321mwhqtOO+V PXUqk6wTZtWxPAzvZCO93D4DuUfrW7jzHRNyvCvgPiJLCTU43uptr1PDJKuDCxAp Sqpb5jJevhxuwbc84hIEnKY/0ERKxjky+XWBsHHc1Yy/CWAdNCyU0tW8OuUaG5+k FF9UbW4BK3wqyzMhWOd/4jDbTz6oyA== =x8L/ -----END PGP SIGNATURE----- --4IFtMBbmeqbTM/ox--