From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334074; cv=none; d=zohomail.com; s=zohoarc; b=U89k1deEZv9ToAJTuYqNUiW+rkKr3+ZcWjzKFlgqlOfngIOZ9U18O1DrfPpTwuEKeOHSk6y6bEa/CDD68RNC0htNWbw7EwitVavmEJJLlgxsznU0n8Wu2c/ddUu1dP6dF9UxJFZ4G55PjjIEEJOnyRlyGYPPEq58Ud3IzifONH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334074; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aK31IVXcYabDSzO2x9PaEEhSpQQyBFgF1S0CplRRuNM=; b=D6vyfMv0LL1m5pq6zK8m4GytuoKWeIw+rAyU8RgZK8xzUflTb3/sYMgtJMVkcgmYGWjpdxTULyuX2Jixi9c/0sQ9eG0xEpU9m2ERu3TW4vTRcgBq3eXuO5RWYw8rArbRK8q5+bJzqrtYr0uig0bzmI+049BDXzIj6CsALGhkylA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334074263404.6297482661048; Mon, 2 Nov 2020 08:21:14 -0800 (PST) Received: from localhost ([::1]:49034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcZz-0000Ch-NY for importer@patchew.org; Mon, 02 Nov 2020 11:21:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYf-0007Se-QP for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYd-0007Xl-DQ for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-JuuqFNjXOzeZI2O6_8GBHg-1; Mon, 02 Nov 2020 11:19:42 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5885876E3B for ; Mon, 2 Nov 2020 16:19:36 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3380D1E8; Mon, 2 Nov 2020 16:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aK31IVXcYabDSzO2x9PaEEhSpQQyBFgF1S0CplRRuNM=; b=UrW81fwbGGae+P1xqdavzVainE3V1I1BG5BhwZ1n6mEUH6bUk5DKJwMvwMOcqiT6/KNMoy Vnifj0Ly1+ABV2z5zP4hMViPrTP8MPy3RzVkGCqAevjCsNhjeDDylwf0rPNjl+aZlYV9Tz TZ5eEhx2+BvMUhlYBYrhIfrJ6o7YQw0= X-MC-Unique: JuuqFNjXOzeZI2O6_8GBHg-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 1/7] virtiofsd: Check FUSE_SUBMOUNTS Date: Mon, 2 Nov 2020 17:18:53 +0100 Message-Id: <20201102161859.156603-2-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 01:33:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" FUSE_SUBMOUNTS is a pure indicator by the kernel to signal that it supports submounts. It does not check its state in the init reply, so there is nothing for fuse_lowlevel.c to do but to check its existence and copy it into fuse_conn_info.capable. Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- tools/virtiofsd/fuse_common.h | 7 +++++++ tools/virtiofsd/fuse_lowlevel.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h index 686c42c0a5..5aee5193eb 100644 --- a/tools/virtiofsd/fuse_common.h +++ b/tools/virtiofsd/fuse_common.h @@ -352,6 +352,13 @@ struct fuse_file_info { */ #define FUSE_CAP_NO_OPENDIR_SUPPORT (1 << 24) =20 +/** + * Indicates that the kernel supports the FUSE_ATTR_SUBMOUNT flag. + * + * Setting (or unsetting) this flag in the `want` field has *no effect*. + */ +#define FUSE_CAP_SUBMOUNTS (1 << 27) + /** * Ioctl flags * diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowleve= l.c index 4d1ba2925d..370222339b 100644 --- a/tools/virtiofsd/fuse_lowlevel.c +++ b/tools/virtiofsd/fuse_lowlevel.c @@ -1988,6 +1988,9 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, bufsize =3D max_bufsize; } } + if (arg->flags & FUSE_SUBMOUNTS) { + se->conn.capable |=3D FUSE_CAP_SUBMOUNTS; + } #ifdef HAVE_SPLICE #ifdef HAVE_VMSPLICE se->conn.capable |=3D FUSE_CAP_SPLICE_WRITE | FUSE_CAP_SPLICE_MOVE; --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334159; cv=none; d=zohomail.com; s=zohoarc; b=OBJj+9PRX33HPNzG3LJd3bU4oHZx0RbLpOaxksuyjSOvETGfjkb/C6+gLzMBqLex7Ae7ZpSF3bWrY+U3vgbH/amfuKO18lZSZxeu98cOBZIOE1TUVa5c9HLG6ebOUZG7FWaShIzbjUMV0kM2CI0grAXLpbXT/B1FHXqLTT63gfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334159; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ej39XcH50MbgN33ompzeLPdwRqw3x3zamyjeQHkfz8Y=; b=W1hJ/reTKWZTkt0abbqWPfgID2t5g8ZWn3k2Bmlh7Gi+4CKIDRsq4D+a54zAJhfDIZQha+jfCBTgo7XwZwUHi0RxksY18euPaapX0H0A7rAO7ASlCGJokkrcKOlyQdxXdY5L+Bl6xonabsp3X8zM737l23e5QqOgIOIoo3U2NH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334159117856.9520268860139; Mon, 2 Nov 2020 08:22:39 -0800 (PST) Received: from localhost ([::1]:54554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcbN-0002SX-Sc for importer@patchew.org; Mon, 02 Nov 2020 11:22:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYj-0007Vu-34 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYh-0007YM-J5 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-mkbW6RwsPUuhMKizJv7leg-1; Mon, 02 Nov 2020 11:19:47 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77DBE108E1A2 for ; Mon, 2 Nov 2020 16:19:39 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA1BB1002C28; Mon, 2 Nov 2020 16:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ej39XcH50MbgN33ompzeLPdwRqw3x3zamyjeQHkfz8Y=; b=SPbo6Ko8FNZR3yO0KJFaSAxC2op5VzxlReTh/VlU/vhi0DgCrQT8FlCNEuek+KChuXrKFe k9FJ7+P+eGlmhBeKIZU29fl+mbTe+qc4OpNVlxEo1qs625ytD1jMdiaCdmuScz8Q9mxJeS W3Jx3RLN9zvVilZJYFh+Lb6Im98gXeo= X-MC-Unique: mkbW6RwsPUuhMKizJv7leg-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 2/7] virtiofsd: Add attr_flags to fuse_entry_param Date: Mon, 2 Nov 2020 17:18:54 +0100 Message-Id: <20201102161859.156603-3-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 01:33:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" fuse_entry_param is converted to fuse_attr on the line (by fill_entry()), so it should have a member that mirrors fuse_attr.flags. fill_entry() should then copy this fuse_entry_param.attr_flags to fuse_attr.flags. Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- tools/virtiofsd/fuse_lowlevel.h | 5 +++++ tools/virtiofsd/fuse_lowlevel.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowleve= l.h index 562fd5241e..9c06240f9e 100644 --- a/tools/virtiofsd/fuse_lowlevel.h +++ b/tools/virtiofsd/fuse_lowlevel.h @@ -102,6 +102,11 @@ struct fuse_entry_param { * large value. */ double entry_timeout; + + /** + * Flags for fuse_attr.flags that do not fit into attr. + */ + uint32_t attr_flags; }; =20 /** diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowleve= l.c index 370222339b..c70fb16a9a 100644 --- a/tools/virtiofsd/fuse_lowlevel.c +++ b/tools/virtiofsd/fuse_lowlevel.c @@ -341,6 +341,8 @@ static void fill_entry(struct fuse_entry_out *arg, .attr_valid_nsec =3D calc_timeout_nsec(e->attr_timeout), }; convert_stat(&e->attr, &arg->attr); + + arg->attr.flags =3D e->attr_flags; } =20 /* --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334219; cv=none; d=zohomail.com; s=zohoarc; b=byb5UNy+TprBW3X1J6LTmXCoGnIfClqbZqWQDird1tZwgN4UDtUhfFfzaXM3AjCbSxBTWhABF7ywOr/HcNr4Rr8D29CvppU2xg+uzOAQ4vQh5+Sa3jYa3rWwOR3FNCBtQRiyZnR7fB6FAjH82/aOO4P6HZ0KNbccpHk+PkApHu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334219; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tSs/fF2vJ+XmomqVGy1BSiw3GVKqorgi9TmtIO5OVsw=; b=EBnQzKwnMpDYAV2JxGhdpTN6oBZkOr+7CTS/9WD5Fg64aT/qa8JIBP0rZ27Ta3qNhODQmbcDvmfbUi3QWSE4bz3kP1zWtaARCveSk6r+h1Tr1iWeHazC5y0fGgsA/AJyf3bFjrduCzGVT5DIkCeQIunawxykTyGrLfUVMmMzJq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334219779460.7051998697033; Mon, 2 Nov 2020 08:23:39 -0800 (PST) Received: from localhost ([::1]:57850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZccM-0003o6-OE for importer@patchew.org; Mon, 02 Nov 2020 11:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYm-0007aR-Ov for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYl-0007Yl-1f for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-ip8uuORHOImARpK-a4-Zuw-1; Mon, 02 Nov 2020 11:19:50 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D9E1080EF8B for ; Mon, 2 Nov 2020 16:19:41 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 674B01E8; Mon, 2 Nov 2020 16:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tSs/fF2vJ+XmomqVGy1BSiw3GVKqorgi9TmtIO5OVsw=; b=Q5YgaSjgDd3gnTgedlKCcF+17RmmqOXf4Edw9/uIvWyf30gNSst3sn+lTaBjuTJT7/DP8w y2+BCu4EIPAHWlaa2HF9dWMnMBEiwjqixONzqSq5xnSpPL/dvN8ODnQXxJQ00Uu5a2+hCT z3baXk4yOoEl8uCg6AfvLSScKi7esio= X-MC-Unique: ip8uuORHOImARpK-a4-Zuw-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 3/7] meson.build: Check for statx() Date: Mon, 2 Nov 2020 17:18:55 +0100 Message-Id: <20201102161859.156603-4-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 03:02:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Check whether the glibc provides statx() and if so, define CONFIG_STATX. Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meson.build b/meson.build index 47e32e1fcb..39ac5cf6d8 100644 --- a/meson.build +++ b/meson.build @@ -736,6 +736,21 @@ if not has_malloc_trim and get_option('malloc_trim').e= nabled() endif endif =20 +# Check whether the glibc provides statx() + +statx_test =3D ''' + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif + #include + int main(void) { + struct statx statxbuf; + statx(0, "", 0, STATX_BASIC_STATS, &statxbuf); + return 0; + }''' + +has_statx =3D cc.links(statx_test) + ################# # config-host.h # ################# @@ -768,6 +783,7 @@ config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.foun= d()) config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) config_host_data.set('CONFIG_GETTID', has_gettid) config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) +config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version(= ))) config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('= .')[0]) config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('= .')[1]) --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334390; cv=none; d=zohomail.com; s=zohoarc; b=kgu5Y/zbfJFOf1u73DCP2B2W5yJD5x4bFtRs8Rpy+JIPtdXZ9U5uS7F/gGjbzHrxvBxOYZp6lOOXsvLB9TS+GJ40hO+77TDXqIbAElkJpQbGIkokx5B+a5RearyIjlaHJCaYoUXRfAoiK5xnEAyLhMibdpHjvIQIVqbayATIRT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334390; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=np1wcj3Xrtf2RFaeSPyrqu5vbK7YYOVbRAU+EJELevE=; b=UNKbSpwMzMTGiqeMr82oUv5jEZnlZh2wZU8ZlRu7bGoNX2ITVSRCrp7YhLlxQwoWIjElTvEZv1e+yEjQh34jftynKQgiae51d4fP6e8pLSGyzhTZBHJ5jq0slY4Ezg/UVHYO4eIkKMk70/zBNG2wVfyQTtRm3c7kphEUG6hCL3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334390597217.0222486793781; Mon, 2 Nov 2020 08:26:30 -0800 (PST) Received: from localhost ([::1]:34452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcf7-0005wx-7k for importer@patchew.org; Mon, 02 Nov 2020 11:26:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYq-0007ev-Cn for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:20:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYn-0007ZI-N0 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:20:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-mT3p98M8OEi-mp5nmZDtbA-1; Mon, 02 Nov 2020 11:19:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8A968030CE for ; Mon, 2 Nov 2020 16:19:44 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EEE55D9D2; Mon, 2 Nov 2020 16:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=np1wcj3Xrtf2RFaeSPyrqu5vbK7YYOVbRAU+EJELevE=; b=hB+7cjHrN18eQGkdtm4egpN8isPqG2yX86EiN13QgmdAV6Dvmfta+vs27OQtgdkToS1vDC gsMZGlmbRYFAcmh08zHg0C7+f8gvZ70/KGJWYo9LV5E3pYMfWKwR1hfiO5zEEFRUfebLxN MFPje9sSHpGDyCSLt9Im4PvkuE9NGSY= X-MC-Unique: mT3p98M8OEi-mp5nmZDtbA-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 4/7] virtiofsd: Add mount ID to the lo_inode key Date: Mon, 2 Nov 2020 17:18:56 +0100 Message-Id: <20201102161859.156603-5-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 01:33:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Using st_dev is not sufficient to uniquely identify a mount: You can mount the same device twice, but those are still separate trees, and e.g. by mounting something else inside one of them, they may differ. Using statx(), we can get a mount ID that uniquely identifies a mount. If that is available, add it to the lo_inode key. Most of this patch is taken from Miklos's mail here: https://marc.info/?l=3Dfuse-devel&m=3D160062521827983 (virtiofsd-use-mount-id.patch attachment) Suggested-by: Miklos Szeredi Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- tools/virtiofsd/passthrough_ll.c | 95 ++++++++++++++++++++++++--- tools/virtiofsd/passthrough_seccomp.c | 1 + 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough= _ll.c index a0beb986f3..34d107975f 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -94,6 +94,7 @@ struct lo_map { struct lo_key { ino_t ino; dev_t dev; + uint64_t mnt_id; }; =20 struct lo_inode { @@ -166,6 +167,7 @@ struct lo_data { int readdirplus_set; int readdirplus_clear; int allow_direct_io; + bool use_statx; struct lo_inode root; GHashTable *inodes; /* protected by lo->mutex */ struct lo_map ino_map; /* protected by lo->mutex */ @@ -219,7 +221,8 @@ static struct { /* That we loaded cap-ng in the current thread from the saved */ static __thread bool cap_loaded =3D 0; =20 -static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st); +static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st, + uint64_t mnt_id); =20 static int is_dot_or_dotdot(const char *name) { @@ -741,12 +744,14 @@ out_err: fuse_reply_err(req, saverr); } =20 -static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st) +static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st, + uint64_t mnt_id) { struct lo_inode *p; struct lo_key key =3D { .ino =3D st->st_ino, .dev =3D st->st_dev, + .mnt_id =3D mnt_id, }; =20 pthread_mutex_lock(&lo->mutex); @@ -774,6 +779,60 @@ static void posix_locks_value_destroy(gpointer data) free(plock); } =20 +static int do_statx(struct lo_data *lo, int dirfd, const char *pathname, + struct stat *statbuf, int flags, uint64_t *mnt_id) +{ + int res; + +#if defined(CONFIG_STATX) && defined(STATX_MNT_ID) + if (lo->use_statx) { + struct statx statxbuf; + + res =3D statx(dirfd, pathname, flags, STATX_BASIC_STATS | STATX_MN= T_ID, + &statxbuf); + if (!res) { + memset(statbuf, 0, sizeof(*statbuf)); + statbuf->st_dev =3D makedev(statxbuf.stx_dev_major, + statxbuf.stx_dev_minor); + statbuf->st_ino =3D statxbuf.stx_ino; + statbuf->st_mode =3D statxbuf.stx_mode; + statbuf->st_nlink =3D statxbuf.stx_nlink; + statbuf->st_uid =3D statxbuf.stx_uid; + statbuf->st_gid =3D statxbuf.stx_gid; + statbuf->st_rdev =3D makedev(statxbuf.stx_rdev_major, + statxbuf.stx_rdev_minor); + statbuf->st_size =3D statxbuf.stx_size; + statbuf->st_blksize =3D statxbuf.stx_blksize; + statbuf->st_blocks =3D statxbuf.stx_blocks; + statbuf->st_atim.tv_sec =3D statxbuf.stx_atime.tv_sec; + statbuf->st_atim.tv_nsec =3D statxbuf.stx_atime.tv_nsec; + statbuf->st_mtim.tv_sec =3D statxbuf.stx_mtime.tv_sec; + statbuf->st_mtim.tv_nsec =3D statxbuf.stx_mtime.tv_nsec; + statbuf->st_ctim.tv_sec =3D statxbuf.stx_ctime.tv_sec; + statbuf->st_ctim.tv_nsec =3D statxbuf.stx_ctime.tv_nsec; + + if (statxbuf.stx_mask & STATX_MNT_ID) { + *mnt_id =3D statxbuf.stx_mnt_id; + } else { + *mnt_id =3D 0; + } + return 0; + } else if (errno !=3D ENOSYS) { + return -1; + } + lo->use_statx =3D false; + /* fallback */ + } +#endif + res =3D fstatat(dirfd, pathname, statbuf, flags); + if (res =3D=3D -1) { + return -1; + } + *mnt_id =3D 0; + + return 0; +} + /* * Increments nlookup and caller must release refcount using * lo_inode_put(&parent). @@ -784,6 +843,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t pare= nt, const char *name, int newfd; int res; int saverr; + uint64_t mnt_id; struct lo_data *lo =3D lo_data(req); struct lo_inode *inode =3D NULL; struct lo_inode *dir =3D lo_inode(req, parent); @@ -811,12 +871,13 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t pa= rent, const char *name, goto out_err; } =20 - res =3D fstatat(newfd, "", &e->attr, AT_EMPTY_PATH | AT_SYMLINK_NOFOLL= OW); + res =3D do_statx(lo, newfd, "", &e->attr, AT_EMPTY_PATH | AT_SYMLINK_N= OFOLLOW, + &mnt_id); if (res =3D=3D -1) { goto out_err; } =20 - inode =3D lo_find(lo, &e->attr); + inode =3D lo_find(lo, &e->attr, mnt_id); if (inode) { close(newfd); } else { @@ -838,6 +899,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t pare= nt, const char *name, inode->fd =3D newfd; inode->key.ino =3D e->attr.st_ino; inode->key.dev =3D e->attr.st_dev; + inode->key.mnt_id =3D mnt_id; pthread_mutex_init(&inode->plock_mutex, NULL); inode->posix_locks =3D g_hash_table_new_full( g_direct_hash, g_direct_equal, NULL, posix_locks_value_destroy= ); @@ -1090,15 +1152,23 @@ static struct lo_inode *lookup_name(fuse_req_t req,= fuse_ino_t parent, const char *name) { int res; + uint64_t mnt_id; struct stat attr; + struct lo_data *lo =3D lo_data(req); + struct lo_inode *dir =3D lo_inode(req, parent); =20 - res =3D fstatat(lo_fd(req, parent), name, &attr, - AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW); + if (!dir) { + return NULL; + } + + res =3D do_statx(lo, dir->fd, name, &attr, + AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, &mnt_id); + lo_inode_put(lo, &dir); if (res =3D=3D -1) { return NULL; } =20 - return lo_find(lo_data(req), &attr); + return lo_find(lo, &attr, mnt_id); } =20 static void lo_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name) @@ -3266,6 +3336,7 @@ static void setup_root(struct lo_data *lo, struct lo_= inode *root) { int fd, res; struct stat stat; + uint64_t mnt_id; =20 fd =3D open("/", O_PATH); if (fd =3D=3D -1) { @@ -3273,7 +3344,8 @@ static void setup_root(struct lo_data *lo, struct lo_= inode *root) exit(1); } =20 - res =3D fstatat(fd, "", &stat, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW); + res =3D do_statx(lo, fd, "", &stat, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLO= W, + &mnt_id); if (res =3D=3D -1) { fuse_log(FUSE_LOG_ERR, "fstatat(%s): %m\n", lo->source); exit(1); @@ -3283,6 +3355,7 @@ static void setup_root(struct lo_data *lo, struct lo_= inode *root) root->fd =3D fd; root->key.ino =3D stat.st_ino; root->key.dev =3D stat.st_dev; + root->key.mnt_id =3D mnt_id; root->nlookup =3D 2; g_atomic_int_set(&root->refcount, 2); } @@ -3291,7 +3364,7 @@ static guint lo_key_hash(gconstpointer key) { const struct lo_key *lkey =3D key; =20 - return (guint)lkey->ino + (guint)lkey->dev; + return (guint)lkey->ino + (guint)lkey->dev + (guint)lkey->mnt_id; } =20 static gboolean lo_key_equal(gconstpointer a, gconstpointer b) @@ -3299,7 +3372,7 @@ static gboolean lo_key_equal(gconstpointer a, gconstp= ointer b) const struct lo_key *la =3D a; const struct lo_key *lb =3D b; =20 - return la->ino =3D=3D lb->ino && la->dev =3D=3D lb->dev; + return la->ino =3D=3D lb->ino && la->dev =3D=3D lb->dev && la->mnt_id = =3D=3D lb->mnt_id; } =20 static void fuse_lo_data_cleanup(struct lo_data *lo) @@ -3445,6 +3518,8 @@ int main(int argc, char *argv[]) exit(1); } =20 + lo.use_statx =3D true; + se =3D fuse_session_new(&args, &lo_oper, sizeof(lo_oper), &lo); if (se =3D=3D NULL) { goto err_out1; diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passth= rough_seccomp.c index eb9af8265f..751e15fa39 100644 --- a/tools/virtiofsd/passthrough_seccomp.c +++ b/tools/virtiofsd/passthrough_seccomp.c @@ -76,6 +76,7 @@ static const int syscall_whitelist[] =3D { SCMP_SYS(mremap), SCMP_SYS(munmap), SCMP_SYS(newfstatat), + SCMP_SYS(statx), SCMP_SYS(open), SCMP_SYS(openat), SCMP_SYS(ppoll), --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334085; cv=none; d=zohomail.com; s=zohoarc; b=Z4Nq1DM7BOeDZ3xfG2lfq4iyGBKFqfsxKNp0BXrXLRRCk6g6b3r/nhSsuiMwbGesEU3+fnBlxwoKzYKyCCUEFKcZa4MZT74f4bqrBalq/gb/JFtwLpoimIlAjA47AKJ1fPzJM52wjKktKFF20uw9//ITblnLJQsHKkxUtzu/pb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334085; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5cb9eigB01K0h9pef671lAJN9aVVE2X1PhLZNZ7RoqM=; b=iCGjiash2e7AXvIiO0foyU5G9KKpPCIxEX1+k+iH0VjBAZ5Ub1hVemu89j2cd6HSOxuoyQXr2Op976Bn0d/7p1GZNGrfWa36xjoeogIjC/JbaO4bBazvl4b1cX3u1O2rsx0uVaurHF4IPSH3O33ht4zUDNsC8eprnO+eBIWf5zs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334085650120.59044216088421; Mon, 2 Nov 2020 08:21:25 -0800 (PST) Received: from localhost ([::1]:49990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcaB-0000bi-Pc for importer@patchew.org; Mon, 02 Nov 2020 11:21:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYo-0007cu-Ru for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYm-0007Yw-TJ for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:58 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-LVlDYdjbO1Wt2NiC2IZnKA-1; Mon, 02 Nov 2020 11:19:53 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 891111016CE4 for ; Mon, 2 Nov 2020 16:19:47 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FF485D9DD; Mon, 2 Nov 2020 16:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5cb9eigB01K0h9pef671lAJN9aVVE2X1PhLZNZ7RoqM=; b=K5Ffo3WSRiQwUAhykYlkeBFBStZAU500+D96wqLlEKDPPYGiuYj82YhtN8HHxIcMSkNdcr pTBiT2bKayJ49SrqL2fM76KRivT1tfUmY8Coyi4fNt6v0AONZN1XUE4ytRE0nQlL2Q3ok1 pR/gLFPm0GvwkjdfQ4jQKyN9esRYYcU= X-MC-Unique: LVlDYdjbO1Wt2NiC2IZnKA-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 5/7] virtiofsd: Announce sub-mount points Date: Mon, 2 Nov 2020 17:18:57 +0100 Message-Id: <20201102161859.156603-6-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 03:02:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Whenever we encounter a directory with an st_dev or mount ID that differs from that of its parent, we set the FUSE_ATTR_SUBMOUNT flag so the guest can create a submount for it. We only need to do so in lo_do_lookup(). The following functions return a fuse_attr object: - lo_create(), though fuse_reply_create(): Calls lo_do_lookup(). - lo_lookup(), though fuse_reply_entry(): Calls lo_do_lookup(). - lo_mknod_symlink(), through fuse_reply_entry(): Calls lo_do_lookup(). - lo_link(), through fuse_reply_entry(): Creating a link cannot create a submount, so there is no need to check for it. - lo_getattr(), through fuse_reply_attr(): Announcing submounts when the node is first detected (at lookup) is sufficient. We do not need to return the submount attribute later. - lo_do_readdir(), through fuse_add_direntry_plus(): Calls lo_do_lookup(). Make announcing submounts optional, so submounts are only announced to the guest with the announce_submounts option. Some users may prefer the current behavior, so that the guest learns nothing about the host mount structure. (announce_submounts is force-disabled when the guest does not present the FUSE_SUBMOUNTS capability, or when there is no statx().) Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- tools/virtiofsd/helper.c | 1 + tools/virtiofsd/passthrough_ll.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c index 2e181a49b5..4433724d3a 100644 --- a/tools/virtiofsd/helper.c +++ b/tools/virtiofsd/helper.c @@ -190,6 +190,7 @@ void fuse_cmdline_help(void) " retain/discard O_DIRECT flags p= assed down\n" " to virtiofsd from guest applica= tions.\n" " default: no_allow_direct_io\n" + " -o announce_submounts Announce sub-mount points to th= e guest\n" ); } =20 diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough= _ll.c index 34d107975f..ec1008bceb 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -40,6 +40,7 @@ #include "fuse_virtio.h" #include "fuse_log.h" #include "fuse_lowlevel.h" +#include "standard-headers/linux/fuse.h" #include #include #include @@ -167,6 +168,7 @@ struct lo_data { int readdirplus_set; int readdirplus_clear; int allow_direct_io; + int announce_submounts; bool use_statx; struct lo_inode root; GHashTable *inodes; /* protected by lo->mutex */ @@ -207,6 +209,7 @@ static const struct fuse_opt lo_opts[] =3D { { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 }, { "allow_direct_io", offsetof(struct lo_data, allow_direct_io), 1 }, { "no_allow_direct_io", offsetof(struct lo_data, allow_direct_io), 0 }, + { "announce_submounts", offsetof(struct lo_data, announce_submounts), = 1 }, FUSE_OPT_END }; static bool use_syslog =3D false; @@ -601,6 +604,20 @@ static void lo_init(void *userdata, struct fuse_conn_i= nfo *conn) fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n"); conn->want &=3D ~FUSE_CAP_READDIRPLUS; } + + if (!(conn->capable & FUSE_CAP_SUBMOUNTS) && lo->announce_submounts) { + fuse_log(FUSE_LOG_WARNING, "lo_init: Cannot announce submounts, cl= ient " + "does not support it\n"); + lo->announce_submounts =3D false; + } + +#ifndef CONFIG_STATX + if (lo->announce_submounts) { + fuse_log(FUSE_LOG_WARNING, "lo_init: Cannot announce submounts, th= ere " + "is no statx()\n"); + lo->announce_submounts =3D false; + } +#endif } =20 static void lo_getattr(fuse_req_t req, fuse_ino_t ino, @@ -877,6 +894,11 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t par= ent, const char *name, goto out_err; } =20 + if (S_ISDIR(e->attr.st_mode) && lo->announce_submounts && + (e->attr.st_dev !=3D dir->key.dev || mnt_id !=3D dir->key.mnt_id))= { + e->attr_flags |=3D FUSE_ATTR_SUBMOUNT; + } + inode =3D lo_find(lo, &e->attr, mnt_id); if (inode) { close(newfd); --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334289; cv=none; d=zohomail.com; s=zohoarc; b=FoMmxvK7LgUWSxXFezPNlpbr4+Cyi55YNbxuRaMkv5fajLs0p+rdcK3Pc8g+oZnD1e7ioZ7wtpmr58h2SwmlhncK31j3Y2xwIWRFS2NJ9R+e50wBB/lk4FITGK0r3Jc1wlre9lurOmbmF+UroDNAXpv7jaQP6WXKiTQEBtijrWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334289; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/aWKbAAhu9frPZQrNWey5VyZKlxANhwMMHb0/A+kqlg=; b=EJVN/yJ1+23EFPKBkWPOHC8G4/Qw3iF4hjwQ2LvgdNbIeZHqYPOpFb9KBWuDEh2DwFGENtBigXOEMuo8g3CqA1tOFD6RSnXpj9H8D4OHk83ONzgmubDnhwzo4yCa5u95oDz53wPl18gJRJKFk08haaR8TG05a80JBsJ4px82Cjw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160433428931010.009344157537726; Mon, 2 Nov 2020 08:24:49 -0800 (PST) Received: from localhost ([::1]:59966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcdU-0004hB-3U for importer@patchew.org; Mon, 02 Nov 2020 11:24:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYo-0007c9-AU for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYm-0007Yt-JV for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:19:57 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-74-19WoXifrPwizNbeucR3UwQ-1; Mon, 02 Nov 2020 11:19:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2030880403C for ; Mon, 2 Nov 2020 16:19:50 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A29915C3E0; Mon, 2 Nov 2020 16:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604333995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/aWKbAAhu9frPZQrNWey5VyZKlxANhwMMHb0/A+kqlg=; b=Fbs6FscnQkMhG1qoJXZkL635se7BG3sOhW7oVq+vxvxMD1yOU/mQt9Ly39vpHCzdU7ICWK ZNrIuGqFSMQLVQBM28bZhnVhldILl9WAUVCbj7TUzOsNDf0tp/P8ekoon1l39LY0bSnBVr +WXnmXWBd998ieCbVu2c4eS6J542Pqk= X-MC-Unique: 19WoXifrPwizNbeucR3UwQ-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 6/7] tests/acceptance/boot_linux: Accept SSH pubkey Date: Mon, 2 Nov 2020 17:18:58 +0100 Message-Id: <20201102161859.156603-7-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 03:02:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Let download_cloudinit() take an optional pubkey, which subclasses of BootLinux can pass through setUp(). Signed-off-by: Max Reitz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo Reviewed-by: Stefan Hajnoczi Reviewed-by: Miklos Szeredi --- tests/acceptance/boot_linux.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py index c743e231f4..1da4a53d6a 100644 --- a/tests/acceptance/boot_linux.py +++ b/tests/acceptance/boot_linux.py @@ -57,7 +57,7 @@ class BootLinuxBase(Test): self.cancel('Failed to download/prepare boot image') return boot.path =20 - def download_cloudinit(self): + def download_cloudinit(self, ssh_pubkey=3DNone): self.log.info('Preparing cloudinit image') try: cloudinit_iso =3D os.path.join(self.workdir, 'cloudinit.iso') @@ -67,7 +67,8 @@ class BootLinuxBase(Test): password=3D'password', # QEMU's hard coded usermode router address phone_home_host=3D'10.0.2.2', - phone_home_port=3Dself.phone_home_port) + phone_home_port=3Dself.phone_home_port, + authorized_key=3Dssh_pubkey) except Exception: self.cancel('Failed to prepared cloudinit image') return cloudinit_iso @@ -80,19 +81,19 @@ class BootLinux(BootLinuxBase): timeout =3D 900 chksum =3D None =20 - def setUp(self): + def setUp(self, ssh_pubkey=3DNone): super(BootLinux, self).setUp() self.vm.add_args('-smp', '2') self.vm.add_args('-m', '1024') self.prepare_boot() - self.prepare_cloudinit() + self.prepare_cloudinit(ssh_pubkey) =20 def prepare_boot(self): path =3D self.download_boot() self.vm.add_args('-drive', 'file=3D%s' % path) =20 - def prepare_cloudinit(self): - cloudinit_iso =3D self.download_cloudinit() + def prepare_cloudinit(self, ssh_pubkey=3DNone): + cloudinit_iso =3D self.download_cloudinit(ssh_pubkey) self.vm.add_args('-drive', 'file=3D%s,format=3Draw' % cloudinit_is= o) =20 def launch_and_wait(self): --=20 2.26.2 From nobody Tue May 14 21:56:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604334470; cv=none; d=zohomail.com; s=zohoarc; b=G/DoWqaYWQYhjEKakJvEfPj4B+04rsO1036B0Hm7bTi+ALNGfcquqhanO8Z9buMkl0/hl4r64MGmrd9iWh1/PpFp/E5NPGRJonWjc9BD8iR9qjweIlchCwxskDa+G8o8mqE91aZPdm067A/XpXsCbb9MJuq6euM56OJOLIw32w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604334470; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6oiNeJZqq+jU1clYjNRL/GSX/JWpd5rPcAMLWNAap2Y=; b=Ap7l3NwlNPBn7Hk7xdJ+kXZx2rOFm1YigJXhzWHBJEna5o+rN8idRq1FnBXN+OboM2wVxJ8ehcrqwb3kWnPPnvA76xMDs50jg015GfcC6RH5oIoNniE7mBz12R45s2V5dOXKDCUQLGcb89rLE3Dx82Dvov5C6ZHeY7vvyZy5yoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604334470523932.7423998468493; Mon, 2 Nov 2020 08:27:50 -0800 (PST) Received: from localhost ([::1]:37506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcgP-0007Es-8r for importer@patchew.org; Mon, 02 Nov 2020 11:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcYx-0007kT-Bf for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:20:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZcYt-0007bF-A5 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 11:20:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-U8oDERj1Mm6nKmaRyDNBfA-1; Mon, 02 Nov 2020 11:19:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 398D2100854A for ; Mon, 2 Nov 2020 16:19:53 +0000 (UTC) Received: from localhost (unknown [10.40.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 575A15D9D2; Mon, 2 Nov 2020 16:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604334002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6oiNeJZqq+jU1clYjNRL/GSX/JWpd5rPcAMLWNAap2Y=; b=WjMO6dITIkW0ZlcKkCycI2NEVcfjWoWTy7oyFl8VMnmzZXvDzEDyF056eQpS3bje3EHP39 9Lo0Uf48CnY8RIxTeqiqJ8culZVnzVpXbBUk62DxDZUf9QEl6ll6KTuD+49BHptFnYRZ5L dyrHN3HR8LQxczRVq4bCCAH7uB3dU/E= X-MC-Unique: U8oDERj1Mm6nKmaRyDNBfA-1 From: Max Reitz To: qemu-devel@nongnu.org Subject: [PATCH v3 7/7] tests/acceptance: Add virtiofs_submounts.py Date: Mon, 2 Nov 2020 17:18:59 +0100 Message-Id: <20201102161859.156603-8-mreitz@redhat.com> In-Reply-To: <20201102161859.156603-1-mreitz@redhat.com> References: <20201102161859.156603-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 03:02:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Szeredi , Eduardo Habkost , "Dr . David Alan Gilbert" , Max Reitz , virtio-fs@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This test invokes several shell scripts to create a random directory tree full of submounts, and then check in the VM whether every submount has its own ID and the structure looks as expected. (Note that the test scripts must be non-executable, so Avocado will not try to execute them as if they were tests on their own, too.) Because at this commit's date it is unlikely that the Linux kernel on the image provided by boot_linux.py supports submounts in virtio-fs, the test will be cancelled if no custom Linux binary is provided through the vmlinuz parameter. (The on-image kernel can be used by providing an empty string via vmlinuz=3D.) So, invoking the test can be done as follows: $ avocado run \ tests/acceptance/virtiofs_submounts.py \ -p vmlinuz=3D/path/to/linux/build/arch/x86/boot/bzImage This test requires root privileges (through passwordless sudo -n), because at this point, virtiofsd requires them. (If you have a timestamp_timeout period for sudoers (e.g. the default of 5 min), you can provide this by executing something like "sudo true" before invoking Avocado.) Signed-off-by: Max Reitz Reviewed-by: Miklos Szeredi Tested-by: Eduardo Habkost --- tests/acceptance/virtiofs_submounts.py | 321 ++++++++++++++++++ .../virtiofs_submounts.py.data/cleanup.sh | 46 +++ .../guest-cleanup.sh | 30 ++ .../virtiofs_submounts.py.data/guest.sh | 138 ++++++++ .../virtiofs_submounts.py.data/host.sh | 127 +++++++ 5 files changed, 662 insertions(+) create mode 100644 tests/acceptance/virtiofs_submounts.py create mode 100644 tests/acceptance/virtiofs_submounts.py.data/cleanup.sh create mode 100644 tests/acceptance/virtiofs_submounts.py.data/guest-clean= up.sh create mode 100644 tests/acceptance/virtiofs_submounts.py.data/guest.sh create mode 100644 tests/acceptance/virtiofs_submounts.py.data/host.sh diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virt= iofs_submounts.py new file mode 100644 index 0000000000..361e5990b6 --- /dev/null +++ b/tests/acceptance/virtiofs_submounts.py @@ -0,0 +1,321 @@ +import logging +import re +import os +import subprocess +import time + +from avocado import skipUnless +from avocado_qemu import Test, BUILD_DIR +from avocado_qemu import wait_for_console_pattern +from avocado.utils import ssh + +from qemu.accel import kvm_available + +from boot_linux import BootLinux + + +def run_cmd(args): + subp =3D subprocess.Popen(args, + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.PIPE, + universal_newlines=3DTrue) + stdout, stderr =3D subp.communicate() + ret =3D subp.returncode + + return (stdout, stderr, ret) + +def has_cmd(name, args=3DNone): + """ + This function is for use in a @avocado.skipUnless decorator, e.g.: + + @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) + def test_something_that_needs_sudo(self): + ... + """ + + if args is None: + args =3D ('which', name) + + try: + _, stderr, exitcode =3D run_cmd(args) + except Exception as e: + exitcode =3D -1 + stderr =3D str(e) + + if exitcode !=3D 0: + cmd_line =3D ' '.join(args) + err =3D f'{name} required, but "{cmd_line}" failed: {stderr.strip(= )}' + return (False, err) + else: + return (True, '') + +def has_cmds(*cmds): + """ + This function is for use in a @avocado.skipUnless decorator and + allows checking for the availability of multiple commands, e.g.: + + @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), + 'cmd2', 'cmd3')) + def test_something_that_needs_cmd1_and_cmd2(self): + ... + """ + + for cmd in cmds: + if isinstance(cmd, str): + cmd =3D (cmd,) + + ok, errstr =3D has_cmd(*cmd) + if not ok: + return (False, errstr) + + return (True, '') + + +class VirtiofsSubmountsTest(BootLinux): + """ + :avocado: tags=3Darch:x86_64 + """ + + def get_portfwd(self): + port =3D None + + res =3D self.vm.command('human-monitor-command', + command_line=3D'info usernet') + for line in res.split('\r\n'): + match =3D \ + re.search(r'TCP.HOST_FORWARD.*127\.0\.0\.1\s*(\d+)\s+10\.', + line) + if match is not None: + port =3D match[1] + break + + self.assertIsNotNone(port) + self.log.debug('sshd listening on port: ' + port) + return port + + def ssh_connect(self, username, keyfile): + self.ssh_logger =3D logging.getLogger('ssh') + port =3D self.get_portfwd() + self.ssh_session =3D ssh.Session('127.0.0.1', port=3Dint(port), + user=3Dusername, key=3Dkeyfile) + for i in range(10): + try: + self.ssh_session.connect() + return + except: + time.sleep(4) + pass + self.fail('sshd timeout') + + def ssh_command(self, command): + self.ssh_logger.info(command) + result =3D self.ssh_session.cmd(command) + stdout_lines =3D [line.rstrip() for line + in result.stdout_text.splitlines()] + for line in stdout_lines: + self.ssh_logger.info(line) + stderr_lines =3D [line.rstrip() for line + in result.stderr_text.splitlines()] + for line in stderr_lines: + self.ssh_logger.warning(line) + + self.assertEqual(result.exit_status, 0, + f'Guest command failed: {command}') + return stdout_lines, stderr_lines + + def run(self, args, ignore_error=3DFalse): + stdout, stderr, ret =3D run_cmd(args) + + if ret !=3D 0: + cmdline =3D ' '.join(args) + if not ignore_error: + self.fail(f'{cmdline}: Returned {ret}: {stderr}') + else: + self.log.warn(f'{cmdline}: Returned {ret}: {stderr}') + + return (stdout, stderr, ret) + + def set_up_shared_dir(self): + atwd =3D os.getenv('AVOCADO_TEST_WORKDIR') + self.shared_dir =3D os.path.join(atwd, 'virtiofs-shared') + + os.mkdir(self.shared_dir) + + self.run(('cp', self.get_data('guest.sh'), + os.path.join(self.shared_dir, 'check.sh'))) + + self.run(('cp', self.get_data('guest-cleanup.sh'), + os.path.join(self.shared_dir, 'cleanup.sh'))) + + def set_up_virtiofs(self): + attmp =3D os.getenv('AVOCADO_TESTS_COMMON_TMPDIR') + self.vfsdsock =3D os.path.join(attmp, 'vfsdsock') + + self.run(('sudo', '-n', 'rm', '-f', self.vfsdsock), ignore_error= =3DTrue) + + self.virtiofsd =3D \ + subprocess.Popen(('sudo', '-n', + 'tools/virtiofsd/virtiofsd', + f'--socket-path=3D{self.vfsdsock}', + '-o', f'source=3D{self.shared_dir}', + '-o', 'cache=3Dalways', + '-o', 'xattr', + '-o', 'announce_submounts', + '-f'), + stdout=3Dsubprocess.DEVNULL, + stderr=3Dsubprocess.PIPE, + universal_newlines=3DTrue) + + while not os.path.exists(self.vfsdsock): + if self.virtiofsd.poll() is not None: + self.fail('virtiofsd exited prematurely: ' + + self.virtiofsd.communicate()[1]) + time.sleep(0.1) + + self.run(('sudo', '-n', 'chmod', 'go+rw', self.vfsdsock)) + + self.vm.add_args('-chardev', + f'socket,id=3Dvfsdsock,path=3D{self.vfsdsock}', + '-device', + 'vhost-user-fs-pci,queue-size=3D1024,chardev=3Dvf= sdsock' \ + ',tag=3Dhost', + '-object', + 'memory-backend-file,id=3Dmem,size=3D1G,' \ + 'mem-path=3D/dev/shm,share=3Don', + '-numa', + 'node,memdev=3Dmem') + + def launch_vm(self): + self.launch_and_wait() + self.ssh_connect('root', self.ssh_key) + + def set_up_nested_mounts(self): + scratch_dir =3D os.path.join(self.shared_dir, 'scratch') + try: + os.mkdir(scratch_dir) + except FileExistsError: + pass + + args =3D ['bash', self.get_data('host.sh'), scratch_dir] + if self.seed: + args +=3D [self.seed] + + out, _, _ =3D self.run(args) + seed =3D re.search(r'^Seed: \d+', out) + self.log.info(seed[0]) + + def mount_in_guest(self): + self.ssh_command('mkdir -p /mnt/host') + self.ssh_command('mount -t virtiofs host /mnt/host') + + def check_in_guest(self): + self.ssh_command('bash /mnt/host/check.sh /mnt/host/scratch/share') + + def live_cleanup(self): + self.ssh_command('bash /mnt/host/cleanup.sh /mnt/host/scratch') + + # It would be nice if the above was sufficient to make virtiofsd c= lear + # all references to the mounted directories (so they can be unmoun= ted + # on the host), but unfortunately it is not. To do so, we have to + # resort to a remount. + self.ssh_command('mount -o remount /mnt/host') + + scratch_dir =3D os.path.join(self.shared_dir, 'scratch') + self.run(('bash', self.get_data('cleanup.sh'), scratch_dir)) + + @skipUnless(*has_cmds(('sudo -n', ('sudo', '-n', 'true')), + 'ssh-keygen', 'bash', 'losetup', 'mkfs.xfs', 'mo= unt')) + def setUp(self): + vmlinuz =3D self.params.get('vmlinuz') + if vmlinuz is None: + self.cancel('vmlinuz parameter not set; you must point it to a= ' + 'Linux kernel binary to test (to run this test wit= h ' \ + 'the on-image kernel, set it to an empty string)') + + self.seed =3D self.params.get('seed') + + atwd =3D os.getenv('AVOCADO_TEST_WORKDIR') + self.ssh_key =3D os.path.join(atwd, 'id_ed25519') + + self.run(('ssh-keygen', '-t', 'ed25519', '-f', self.ssh_key)) + + pubkey =3D open(self.ssh_key + '.pub').read() + + super(VirtiofsSubmountsTest, self).setUp(pubkey) + + if len(vmlinuz) > 0: + self.vm.add_args('-kernel', vmlinuz, + '-append', 'console=3DttyS0 root=3D/dev/sda1') + + # Allow us to connect to SSH + self.vm.add_args('-netdev', 'user,id=3Dvnet,hostfwd=3D:127.0.0.1:0= -:22', + '-device', 'e1000,netdev=3Dvnet') + + if not kvm_available(self.arch, self.qemu_bin): + self.cancel(KVM_NOT_AVAILABLE) + self.vm.add_args('-accel', 'kvm') + + def tearDown(self): + try: + self.vm.shutdown() + except: + pass + + scratch_dir =3D os.path.join(self.shared_dir, 'scratch') + self.run(('bash', self.get_data('cleanup.sh'), scratch_dir), + ignore_error=3DTrue) + + def test_pre_virtiofsd_set_up(self): + self.set_up_shared_dir() + + self.set_up_nested_mounts() + + self.set_up_virtiofs() + self.launch_vm() + self.mount_in_guest() + self.check_in_guest() + + def test_pre_launch_set_up(self): + self.set_up_shared_dir() + self.set_up_virtiofs() + + self.set_up_nested_mounts() + + self.launch_vm() + self.mount_in_guest() + self.check_in_guest() + + def test_post_launch_set_up(self): + self.set_up_shared_dir() + self.set_up_virtiofs() + self.launch_vm() + + self.set_up_nested_mounts() + + self.mount_in_guest() + self.check_in_guest() + + def test_post_mount_set_up(self): + self.set_up_shared_dir() + self.set_up_virtiofs() + self.launch_vm() + self.mount_in_guest() + + self.set_up_nested_mounts() + + self.check_in_guest() + + def test_two_runs(self): + self.set_up_shared_dir() + + self.set_up_nested_mounts() + + self.set_up_virtiofs() + self.launch_vm() + self.mount_in_guest() + self.check_in_guest() + + self.live_cleanup() + self.set_up_nested_mounts() + + self.check_in_guest() diff --git a/tests/acceptance/virtiofs_submounts.py.data/cleanup.sh b/tests= /acceptance/virtiofs_submounts.py.data/cleanup.sh new file mode 100644 index 0000000000..2a6579a0fe --- /dev/null +++ b/tests/acceptance/virtiofs_submounts.py.data/cleanup.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +function print_usage() +{ + if [ -n "$2" ]; then + echo "Error: $2" + echo + fi + echo "Usage: $1 " +} + +scratch_dir=3D$1 +if [ -z "$scratch_dir" ]; then + print_usage "$0" 'Scratch dir not given' >&2 + exit 1 +fi + +cd "$scratch_dir/share" || exit 1 +mps=3D(mnt*) +mp_i=3D0 +for mp in "${mps[@]}"; do + mp_i=3D$((mp_i + 1)) + printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}" + + sudo umount -R "$mp" + rm -rf "$mp" +done +echo + +rm some-file +cd .. +rmdir share + +imgs=3D(fs*.img) +img_i=3D0 +for img in "${imgs[@]}"; do + img_i=3D$((img_i + 1)) + printf "Detaching and deleting %i/%i...\r" "$img_i" "${#imgs[@]}" + + dev=3D$(losetup -j "$img" | sed -e 's/:.*//') + sudo losetup -d "$dev" + rm -f "$img" +done +echo + +echo 'Done.' diff --git a/tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh b= /tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh new file mode 100644 index 0000000000..729cb2d1a5 --- /dev/null +++ b/tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function print_usage() +{ + if [ -n "$2" ]; then + echo "Error: $2" + echo + fi + echo "Usage: $1 " +} + +scratch_dir=3D$1 +if [ -z "$scratch_dir" ]; then + print_usage "$0" 'Scratch dir not given' >&2 + exit 1 +fi + +cd "$scratch_dir/share" || exit 1 + +mps=3D(mnt*) +mp_i=3D0 +for mp in "${mps[@]}"; do + mp_i=3D$((mp_i + 1)) + printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}" + + sudo umount -R "$mp" +done +echo + +echo 'Done.' diff --git a/tests/acceptance/virtiofs_submounts.py.data/guest.sh b/tests/a= cceptance/virtiofs_submounts.py.data/guest.sh new file mode 100644 index 0000000000..59ba40fde1 --- /dev/null +++ b/tests/acceptance/virtiofs_submounts.py.data/guest.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +function print_usage() +{ + if [ -n "$2" ]; then + echo "Error: $2" + echo + fi + echo "Usage: $1 " + echo '(The shared directory is the "share" directory in the scratch' \ + 'directory)' +} + +shared_dir=3D$1 +if [ -z "$shared_dir" ]; then + print_usage "$0" 'Shared dir not given' >&2 + exit 1 +fi + +cd "$shared_dir" + +# FIXME: This should not be necessary, but it is. In order for all +# submounts to be proper mount points, we need to visit them. +# (Before we visit them, they will not be auto-mounted, and so just +# appear as normal directories, with the catch that their st_ino will +# be the st_ino of the filesystem they host, while the st_dev will +# still be the st_dev of the parent.) +# `find` does not work, because it will refuse to touch the mount +# points as long as they are not mounted; their st_dev being shared +# with the parent and st_ino just being the root node's inode ID +# will practically ensure that this node exists elsewhere on the +# filesystem, and `find` is required to recognize loops and not to +# follow them. +# Thus, we have to manually visit all nodes first. + +mnt_i=3D0 + +function recursively_visit() +{ + pushd "$1" >/dev/null + for entry in *; do + if [[ "$entry" =3D=3D mnt* ]]; then + mnt_i=3D$((mnt_i + 1)) + printf "Triggering auto-mount $mnt_i...\r" + fi + + if [ -d "$entry" ]; then + recursively_visit "$entry" + fi + done + popd >/dev/null +} + +recursively_visit . +echo + + +if [ -n "$(find -name not-mounted)" ]; then + echo "Error: not-mounted files visible on mount points:" >&2 + find -name not-mounted >&2 + exit 1 +fi + +if [ ! -f some-file -o "$(cat some-file)" !=3D 'root' ]; then + echo "Error: Bad file in the share root" >&2 + exit 1 +fi + +shopt -s nullglob + +function check_submounts() +{ + local base_path=3D$1 + + for mp in mnt*; do + printf "Checking submount %i...\r" "$((${#devs[@]} + 1))" + + mp_i=3D$(echo "$mp" | sed -e 's/mnt//') + dev=3D$(stat -c '%D' "$mp") + + if [ -n "${devs[mp_i]}" ]; then + echo "Error: $mp encountered twice" >&2 + exit 1 + fi + devs[mp_i]=3D$dev + + pushd "$mp" >/dev/null + path=3D"$base_path$mp" + while true; do + expected_content=3D"$(printf '%s\n%s\n' "$mp_i" "$path")" + if [ ! -f some-file ]; then + echo "Error: $PWD/some-file does not exist" >&2 + exit 1 + fi + + if [ "$(cat some-file)" !=3D "$expected_content" ]; then + echo "Error: Bad content in $PWD/some-file:" >&2 + echo '--- found ---' + cat some-file + echo '--- expected ---' + echo "$expected_content" + exit 1 + fi + if [ "$(stat -c '%D' some-file)" !=3D "$dev" ]; then + echo "Error: $PWD/some-file has the wrong device ID" >&2 + exit 1 + fi + + if [ -d sub ]; then + if [ "$(stat -c '%D' sub)" !=3D "$dev" ]; then + echo "Error: $PWD/some-file has the wrong device ID" >= &2 + exit 1 + fi + cd sub + path=3D"$path/sub" + else + if [ -n "$(echo mnt*)" ]; then + check_submounts "$path/" + fi + break + fi + done + popd >/dev/null + done +} + +root_dev=3D$(stat -c '%D' some-file) +devs=3D() +check_submounts '' +echo + +reused_devs=3D$(echo "$root_dev ${devs[@]}" | tr ' ' '\n' | sort | uniq -d) +if [ -n "$reused_devs" ]; then + echo "Error: Reused device IDs: $reused_devs" >&2 + exit 1 +fi + +echo "Test passed for ${#devs[@]} submounts." diff --git a/tests/acceptance/virtiofs_submounts.py.data/host.sh b/tests/ac= ceptance/virtiofs_submounts.py.data/host.sh new file mode 100644 index 0000000000..d8a9afebdb --- /dev/null +++ b/tests/acceptance/virtiofs_submounts.py.data/host.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +mount_count=3D128 + +function print_usage() +{ + if [ -n "$2" ]; then + echo "Error: $2" + echo + fi + echo "Usage: $1 [seed]" + echo "(If no seed is given, it will be randomly generated.)" +} + +scratch_dir=3D$1 +if [ -z "$scratch_dir" ]; then + print_usage "$0" 'No scratch dir given' >&2 + exit 1 +fi + +if [ ! -d "$scratch_dir" ]; then + print_usage "$0" "$scratch_dir is not a directory" >&2 + exit 1 +fi + +seed=3D$2 +if [ -z "$seed" ]; then + seed=3D$RANDOM +fi +RANDOM=3D$seed + +echo "Seed: $seed" + +set -e +shopt -s nullglob + +cd "$scratch_dir" +if [ -d share ]; then + echo 'Error: This directory seems to be in use already' >&2 + exit 1 +fi + +for ((i =3D 0; i < $mount_count; i++)); do + printf "Setting up fs %i/%i...\r" "$((i + 1))" "$mount_count" + + rm -f fs$i.img + truncate -s 512M fs$i.img + mkfs.xfs -q fs$i.img + devs[i]=3D$(sudo losetup -f --show fs$i.img) +done +echo + +top_level_mounts=3D$((RANDOM % mount_count + 1)) + +mkdir -p share +echo 'root' > share/some-file + +for ((i =3D 0; i < $top_level_mounts; i++)); do + printf "Mounting fs %i/%i...\r" "$((i + 1))" "$mount_count" + + mkdir -p share/mnt$i + touch share/mnt$i/not-mounted + sudo mount "${devs[i]}" share/mnt$i + sudo chown "$(id -u):$(id -g)" share/mnt$i + + pushd share/mnt$i >/dev/null + path=3Dmnt$i + nesting=3D$((RANDOM % 4)) + for ((j =3D 0; j < $nesting; j++)); do + cat > some-file < some-file </dev/null +done + +for ((; i < $mount_count; i++)); do + printf "Mounting fs %i/%i...\r" "$((i + 1))" "$mount_count" + + mp_i=3D$((i % top_level_mounts)) + + pushd share/mnt$mp_i >/dev/null + path=3Dmnt$mp_i + while true; do + sub_mp=3D"$(echo mnt*)" + if cd sub 2>/dev/null; then + path=3D"$path/sub" + elif [ -n "$sub_mp" ] && cd "$sub_mp" 2>/dev/null; then + path=3D"$path/$sub_mp" + else + break + fi + done + mkdir mnt$i + touch mnt$i/not-mounted + sudo mount "${devs[i]}" mnt$i + sudo chown "$(id -u):$(id -g)" mnt$i + + cd mnt$i + path=3D"$path/mnt$i" + nesting=3D$((RANDOM % 4)) + for ((j =3D 0; j < $nesting; j++)); do + cat > some-file < some-file </dev/null +done +echo + +echo 'Done.' --=20 2.26.2