From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347455; cv=none; d=zohomail.com; s=zohoarc; b=DpsTjlwciI02vxa7dlAx5jzGSWFj9WONTnAzcKWcD0Kd6RSup8cfZAihDHu81s3PWQ6x94Cry5ciisDUji3pWxbAZVVB5dgXJ+d84uUWFW8+4fM6rgNf4lEZpIDjnGIOTcIjj2UDQ7s4MMWDPxHjz+IcuZs7/CYw6Ctnnzj6VrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347455; 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=O5iX5qnRsmgE19cr2YJogWeW0JbFHwetHbj13RNNblU=; b=MqEzu+gtAME/I8XDHl7jOSWUg6AbzadKpOMWDRU1dj+fLBItSVNNz79MAKGMWbQlm1V6GfEC81iTbgXNgWTH1xP8M/3WmeWUtr+64PZ+3cto6Bo+dn5o2JRbhy3eXdq/I6opY/g+xqFg2j4ntJAbFh9a2yLuKotXejr83FQQf3E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347455904354.3042053492791; Mon, 2 Nov 2020 12:04:15 -0800 (PST) Received: from localhost ([::1]:41668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg3q-0003Pl-RJ for importer@patchew.org; Mon, 02 Nov 2020 15:04:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxG-0003Ep-6g for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxA-0002GC-4s for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:25 -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-310-XYcvEgmpPXyJpXUaZzy4VQ-1; Mon, 02 Nov 2020 14:57:10 -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 3BBAF8030DD; Mon, 2 Nov 2020 19:57:09 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id B09D51002C1C; Mon, 2 Nov 2020 19:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347032; 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=O5iX5qnRsmgE19cr2YJogWeW0JbFHwetHbj13RNNblU=; b=CNpsRPTw+ZgoJczyn74n4KF2cQs9brcpPt5KE0nWYd0VEva82CdcChhF2VIxy+YV9CgfsG gsrXcapII1oUb0+Me0xGsKfXB+F6iJ3VWdQN1tVOESbB6cnuIDFkThjsiIKkDGloGlOlqJ Evc9OHkdwHU4eEaTFj5M4Rw63cNyKME= X-MC-Unique: XYcvEgmpPXyJpXUaZzy4VQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 01/12] migration: Unify reset of last_rb on destination node when recover Date: Mon, 2 Nov 2020 19:56:46 +0000 Message-Id: <20201102195657.219501-2-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Peter Xu When postcopy recover happens, we need to reset last_rb after each return of postcopy_pause_fault_thread() because that means we just got the postcopy migration continued. Unify this reset to the place right before we want to kick the fault thread again, when we get the command MIG_CMD_POSTCOPY_RESUME from source. This is actually more than that - because the main thread on destination wi= ll now be able to call migrate_send_rp_req_pages_pending() too, so the fault thread is not the only user of last_rb now. Move the reset earlier will al= low the first call to migrate_send_rp_req_pages_pending() to use the reset value even if called from the main thread. (NOTE: this is not a real fix to 0c26781c09 mentioned below, however it is = just a mark that when picking up 0c26781c09 we'd better have this one too; the = real fix will come later) Fixes: 0c26781c09 ("migration: Sync requested pages after postcopy recovery= ") Tested-by: Christian Schoenebeck Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Message-Id: <20201102153010.11979-2-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- migration/postcopy-ram.c | 2 -- migration/savevm.c | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d3bb3a744b..d99842eb1b 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -903,7 +903,6 @@ static void *postcopy_ram_fault_thread(void *opaque) * the channel is rebuilt. */ if (postcopy_pause_fault_thread(mis)) { - mis->last_rb =3D NULL; /* Continue to read the userfaultfd */ } else { error_report("%s: paused but don't allow to continue", @@ -985,7 +984,6 @@ retry: /* May be network failure, try to wait for recovery */ if (ret =3D=3D -EIO && postcopy_pause_fault_thread(mis)) { /* We got reconnected somehow, try to continue */ - mis->last_rb =3D NULL; goto retry; } else { /* This is a unavoidable fault */ diff --git a/migration/savevm.c b/migration/savevm.c index 21ccba9fb3..e8834991ec 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2061,6 +2061,12 @@ static int loadvm_postcopy_handle_resume(MigrationIn= comingState *mis) return 0; } =20 + /* + * Reset the last_rb before we resend any page req to source again, si= nce + * the source should have it reset already. + */ + mis->last_rb =3D NULL; + /* * This means source VM is ready to resume the postcopy migration. * It's time to switch state and release the fault thread to --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347291; cv=none; d=zohomail.com; s=zohoarc; b=RILgAnzZfMubuFin1yCB+l1xbolE3wbPN3pn8xRdzMX3OWQ7CfbJvC3Nic7tKdlf+o+kqJwmWed8Ndh6YznBNagpVlIO1bofMwX7W/iw+hahCwpHaYWvHuK14Wg3+YNQy445OaZ72WfeYca/6/QweHqzQRPNRYqADUjkdisSjfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347291; 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=b0JhSY5xBg6fuYItqmFjGmYKEGgqRB5m4QGHuXEds/g=; b=NZEBa1NM5+w0txassc89yVdNT+wSTaZhx7Twr28WrhRM9IqFH0soNyK62pAqdPHp+eTpzOmiWD8XCL6bS/n3trvHkoc4/lP2UJ2EVlL0VBks3LoOpOdGtvmVUURBS0ZJfjSFCzpyNevbCGnYYLx14s5gWU2RbcGmJ8/wXPC07vw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347291339646.2309228656251; Mon, 2 Nov 2020 12:01:31 -0800 (PST) Received: from localhost ([::1]:33382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg1A-0008LV-RV for importer@patchew.org; Mon, 02 Nov 2020 15:01:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxF-0003Ef-Pi for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxA-0002Gj-33 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:25 -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-117-bksrdqA7M4mp9jH7Cq6NDw-1; Mon, 02 Nov 2020 14:57:12 -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 1A12C8030C8; Mon, 2 Nov 2020 19:57:11 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 869A11002C0A; Mon, 2 Nov 2020 19:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347036; 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=b0JhSY5xBg6fuYItqmFjGmYKEGgqRB5m4QGHuXEds/g=; b=GVLu4oKUQ9eiCKO5wwU4kJgJHrEfQjaQu4DfGeILWLEkhlYF3AvgElgy7j33SzJCgzlbxo 465x1lbkLgcRlPHFNN/DxlrhRvJYXMOs2uV9/+XYPjER/9MU/0xOXpPcN1oa1KX2gxVrCn KqDnKbnXVdmd9GZarYatwVkXnH/eL18= X-MC-Unique: bksrdqA7M4mp9jH7Cq6NDw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 02/12] migration: Postpone the kick of the fault thread after recover Date: Mon, 2 Nov 2020 19:56:47 +0000 Message-Id: <20201102195657.219501-3-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Peter Xu The new migrate_send_rp_req_pages_pending() call should greatly improve destination responsiveness because it will resync faulted address after postcopy recovery. However it is also the 1st place to initiate the page request from the main thread. One thing is overlooked on that migrate_send_rp_message_req_pages() is not designed to be thread-safe. So if we wake the fault thread before syncing = all the faulted pages in the main thread, it means they can race. Postpone the wake up operation after the sync of faulted addresses. Fixes: 0c26781c09 ("migration: Sync requested pages after postcopy recovery= ") Tested-by: Christian Schoenebeck Signed-off-by: Peter Xu Message-Id: <20201102153010.11979-3-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index e8834991ec..5f937a2762 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2069,12 +2069,9 @@ static int loadvm_postcopy_handle_resume(MigrationIn= comingState *mis) =20 /* * This means source VM is ready to resume the postcopy migration. - * It's time to switch state and release the fault thread to - * continue service page faults. */ migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_RECOVER, MIGRATION_STATUS_POSTCOPY_ACTIVE); - qemu_sem_post(&mis->postcopy_pause_sem_fault); =20 trace_loadvm_postcopy_handle_resume(); =20 @@ -2095,6 +2092,14 @@ static int loadvm_postcopy_handle_resume(MigrationIn= comingState *mis) */ migrate_send_rp_req_pages_pending(mis); =20 + /* + * It's time to switch state and release the fault thread to continue + * service page faults. Note that this should be explicitly after the + * above call to migrate_send_rp_req_pages_pending(). In short: + * migrate_send_rp_message_req_pages() is not thread safe, yet. + */ + qemu_sem_post(&mis->postcopy_pause_sem_fault); + return 0; } =20 --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347144; cv=none; d=zohomail.com; s=zohoarc; b=l0MjZJs7SvDPQpBQ1tZwtlsjLzfL+Z9BPTeLDojOPCPNHFHgHyR5yl2Ts9rjBq/xHbv4fuL2xToYBJO1N2Ik6lVAM/+47QyKSv0gp4EBU8tg/QafJu+vQY0uMb3SEVQOrihfuXnBrIqkSOxi/NdnmHAyzdf0etMZjvs7otXKGDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347144; 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=ZcDcv4vahpW1LHhbriTpogilewy3Nu6go5TJggs+HVI=; b=l7juGUNgwCbPELM7DQpykPynhoJcY+iGGcyXuGUKHfQMa4q/GnTgVonYiwqyys/HZC3cA7txe76IL79fiJCNNvmSouaQPNAmJLYxCNsCiWxHaM0wM107FcEw8coCTqqp1OP2ViYCSCI4h3Lp2AndOlBNXteRa3JfzzA1ZtzQ4+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347144052988.1366315268552; Mon, 2 Nov 2020 11:59:04 -0800 (PST) Received: from localhost ([::1]:53212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZfyo-0004qV-EZ for importer@patchew.org; Mon, 02 Nov 2020 14:59:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxG-0003Es-Bo for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxA-0002Gv-HH for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:26 -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-581-znDK2JrZN7uTodq4SDd0Tw-1; Mon, 02 Nov 2020 14:57:13 -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 E67D41868411; Mon, 2 Nov 2020 19:57:12 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 661531002C0A; Mon, 2 Nov 2020 19:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347039; 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=ZcDcv4vahpW1LHhbriTpogilewy3Nu6go5TJggs+HVI=; b=gVaYitcXMqSh9q2BruhkRoUzYgBJEb7k5UofLS2dPFmBLSxD12JPPf3SblOKnG1vAJzPQn ZOSuFsbTqXnz81pXVa2zc7380FlLEaPrYfuLNoXGKrXC1H7zeE8kbH493mcKOuGFydeFg6 l1wQ+AXDpKJ9m+2fC5lu9hGK83HD+bE= X-MC-Unique: znDK2JrZN7uTodq4SDd0Tw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 03/12] virtiofsd: Seccomp: Add 'send' for syslog Date: Mon, 2 Nov 2020 19:56:48 +0000 Message-Id: <20201102195657.219501-4-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=216.205.24.124; envelope-from=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: "Dr. David Alan Gilbert" On ppc, and some other archs, it looks like syslog ends up using 'send' rather than 'sendto'. Reference: https://github.com/kata-containers/kata-containers/issues/1050 Reported-by: amulmek1@in.ibm.com Signed-off-by: Dr. David Alan Gilbert Message-Id: <20201102150750.34565-1-dgilbert@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/passthrough_seccomp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passth= rough_seccomp.c index eb9af8265f..672fb72a31 100644 --- a/tools/virtiofsd/passthrough_seccomp.c +++ b/tools/virtiofsd/passthrough_seccomp.c @@ -118,6 +118,7 @@ static const int syscall_whitelist[] =3D { =20 /* Syscalls used when --syslog is enabled */ static const int syscall_whitelist_syslog[] =3D { + SCMP_SYS(send), SCMP_SYS(sendto), }; =20 --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347150; cv=none; d=zohomail.com; s=zohoarc; b=kHl9pdUVnrflRvMoOeJ2XnltQf4/R71llT8zID6NHbamZo0d6ZvANimzXSJb1MpuMsfOAVRRXuvKemma3OYGv+CLCUD3LNngYHkCJw6W4x4axQHnG+sbctCI56P4ywVE8ycsrD52p6rSsCPEz9+a38d2tFHthAdoBa8rr0UJBr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347150; 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=kxeYddukYIG9wx6uBE7A6ECu+R5n9URcKomMBVBdZaY=; b=c6OpZhQYHQ3MxmoVM8+W7SU6RHuzbrOIRm039/2dKYVKaDTkvw9aZT9Ukuvg+Ijtad+QhUgtqRZyBM+tygLg7Y9lAEeYEqg4YhrDXTlkHU2ITgm77jSBEujx159sNW2Zo8QBMGIll6yOlFzAMkgpsqjJ1jwcuTcQPiyXG6nE/1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347150264746.539742132095; Mon, 2 Nov 2020 11:59:10 -0800 (PST) Received: from localhost ([::1]:53558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZfyv-0004yo-21 for importer@patchew.org; Mon, 02 Nov 2020 14:59:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxM-0003Gg-84 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxE-0002HZ-2e for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:31 -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-362-PKJLE_pMOKmQF4st_h-YRw-1; Mon, 02 Nov 2020 14:57:15 -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 BDE1157056; Mon, 2 Nov 2020 19:57:14 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DDBF1002C0A; Mon, 2 Nov 2020 19:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347042; 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=kxeYddukYIG9wx6uBE7A6ECu+R5n9URcKomMBVBdZaY=; b=f4ZuWTimlPt2k60GoHHAcvpTRwNalyO9gk0ur/IgqlUZdI7h0flP40NVcrUb0EiC6YHsu9 bwUa/asoCpFp0bJN7knouOCxblwWpcyOtWoIe2l0sDVW8RtpR1FH0JU+eRJDQscPoaxDeI J1bxI8iDjzH5AtE+xXBfUPKO7o5CSKY= X-MC-Unique: PKJLE_pMOKmQF4st_h-YRw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 04/12] tools/virtiofsd: Check vu_init() return value (CID 1435958) Date: Mon, 2 Nov 2020 19:56:49 +0000 Message-Id: <20201102195657.219501-5-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 Since commit 6f5fd837889, vu_init() can fail if malloc() returns NULL. This fixes the following Coverity warning: CID 1435958 (#1 of 1): Unchecked return value (CHECKED_RETURN) Fixes: 6f5fd837889 ("libvhost-user: support many virtqueues") Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20201102092339.2034297-1-philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 324936948d..83ba07c6cd 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -1013,8 +1013,11 @@ int virtio_session_mount(struct fuse_session *se) se->vu_socketfd =3D data_sock; se->virtio_dev->se =3D se; pthread_rwlock_init(&se->virtio_dev->vu_dispatch_rwlock, NULL); - vu_init(&se->virtio_dev->dev, 2, se->vu_socketfd, fv_panic, NULL, - fv_set_watch, fv_remove_watch, &fv_iface); + if (!vu_init(&se->virtio_dev->dev, 2, se->vu_socketfd, fv_panic, NULL, + fv_set_watch, fv_remove_watch, &fv_iface)) { + fuse_log(FUSE_LOG_ERR, "%s: vu_init failed\n", __func__); + return -1; + } =20 return 0; } --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347288; cv=none; d=zohomail.com; s=zohoarc; b=Y7WCXmqyv0eRmioo6acfvoqd33U2LFqOU855IiC2ztVMVRk3EAcmcspC0wMGoaIkLabr5uwzFtL/gJASG1M4r2bV7hDQ1DO+WTWSYlXM6AF1HVS0hmWLMwBOxOqNIbzkimhyJSPaIS1T4nt8cdT1BhciBbZ4ELHsVkG3yKXEEvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347288; 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=2A7BmYSwoqgO+MxWARNx61HoQgC5UFmQDlge8zY+JuI=; b=IAKhmC1NWfjAA+nvhurdWLLXO3NmK90sxdsEZG8wO2aYbEca02O0PNSZNF7xmkZXKN49exxyTTHizzZn8sLeAyGBQ1vZ6CG/aFRBQU3AsCICPxvv7IzkMii7ikboiFRSs2EmMpcRD8qvye2LyxxtW0h/TA2hvMbPfVOaMDDjnBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347288893799.586429388066; Mon, 2 Nov 2020 12:01:28 -0800 (PST) Received: from localhost ([::1]:33276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg18-0008J1-St for importer@patchew.org; Mon, 02 Nov 2020 15:01:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxL-0003Fe-LV for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxB-0002H0-Oh for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:31 -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-250-vFOmU8hKPniJ8YUt0cp-hA-1; Mon, 02 Nov 2020 14:57:17 -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 9A9F21006C99; Mon, 2 Nov 2020 19:57:16 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C58A1002C1F; Mon, 2 Nov 2020 19:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347039; 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=2A7BmYSwoqgO+MxWARNx61HoQgC5UFmQDlge8zY+JuI=; b=A+2RFwdl1SM/oP46OKDmErk7b96T4g0YYKuhLECAdgODLPSkuwMk+ePxG3tILla+ALeEjs 58N4JGyBEEunw+BP0lJnsVv7lNtztEf8F34lL1nSAVVVfalSr4x9HezvKgioYTRPIRKy/t 8BwCSvLnc5KfmHpKvszWdZ2VdxuB+gA= X-MC-Unique: vFOmU8hKPniJ8YUt0cp-hA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 05/12] virtiofsd: Fix the help message of posix lock Date: Mon, 2 Nov 2020 19:56:50 +0000 Message-Id: <20201102195657.219501-6-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Jiachen Zhang The commit 88fc107956a5812649e5918e0c092d3f78bb28ad disabled remote posix locks by default. But the --help message still says it is enabled by default. So fix it to output no_posix_lock. Signed-off-by: Jiachen Zhang Message-Id: <20201027081558.29904-1-zhangjiachen.jaycee@bytedance.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c index 2e181a49b5..ae1b22e4a6 100644 --- a/tools/virtiofsd/helper.c +++ b/tools/virtiofsd/helper.c @@ -161,7 +161,7 @@ void fuse_cmdline_help(void) " allowed (default: 10)\n" " -o posix_lock|no_posix_lock\n" " enable/disable remote posix loc= k\n" - " default: posix_lock\n" + " default: no_posix_lock\n" " -o readdirplus|no_readdirplus\n" " enable/disable readirplus\n" " default: readdirplus except wit= h " --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347596; cv=none; d=zohomail.com; s=zohoarc; b=OPlG/DfDWZmE/IgpsuR2flCnGo4XlxWbaMcCubsVSx829vFIbkSMrPv7+2vROtsic9gfaggx7Zk6luF0ZoiO94rd8ff97HBD8UDsAKSEQBTWe6GGcCRojwmoTzSWdX1K7h6KXmBOXZKEWIdsohrY1jCFN7uHJEB6FkmiB/BVi8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347596; 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=4nqa2wuxEqSEQNPnnV9gO+2UaknUX475HtNarZP9XHU=; b=SxhBNnjvfQa4TsCT2fsgWtZ+eKLB0fntN8Fg2RSyb6LakzGkDcSEult1OTyb0jVsabBYdJbOHWhX5OYtuD8RuohrIEnpXUYXnCqyU+W6egPOxTLnfjzAg+hhSwy1xb73Iou1wmhm3AgSbNhVv7Wc9XKO1EYHW1LxrAFhj3Vw7tE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347596692354.9595171397534; Mon, 2 Nov 2020 12:06:36 -0800 (PST) Received: from localhost ([::1]:47602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg67-0005yo-GK for importer@patchew.org; Mon, 02 Nov 2020 15:06:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxM-0003HA-GH for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxC-0002HP-2b for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:32 -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-433-E4XIHjgBOseIal7HEn9R_w-1; Mon, 02 Nov 2020 14:57:19 -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 6F5BC8030A2; Mon, 2 Nov 2020 19:57:18 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id E56141002C0A; Mon, 2 Nov 2020 19:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347041; 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=4nqa2wuxEqSEQNPnnV9gO+2UaknUX475HtNarZP9XHU=; b=UzU6XKPNhfYv4+ltRjW0U1TuzqaPvkpshqjI6ioY+3k1BbIzJdLqx2ur3IuS9jnGqhuXDK 0tRCfceRPnE/WPPb8sQYE0U+75sT1w6ht7UY+sE2s8Q/aT8oi3sRkBdynhQwHoTIhscJCt sCGtFLGPAQ9YpFHcXXVuvOOnNjnKcvw= X-MC-Unique: E4XIHjgBOseIal7HEn9R_w-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 06/12] virtiofsd: Check FUSE_SUBMOUNTS Date: Mon, 2 Nov 2020 19:56:51 +0000 Message-Id: <20201102195657.219501-7-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz 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 Message-Id: <20201102161859.156603-2-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347454; cv=none; d=zohomail.com; s=zohoarc; b=f66bJkfAMMaF68qLR61ePcxNte8LCQivKo4b+uUhxcgtBkDJ1fyCFk1SOa76Rzwhj7IXs2GXRiyw416YCeckSBAS5xwaEfZ56wSWmvV42fTrplUtzikOc5nXrzczj1aMx6407BdoW91qAWX4bEln+vxX7HGCpicLNMAuCbMfP/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347454; 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=mxaI1nWPWoN6ERfgr/20Oo48cGu6IBeGmyDAXbuXpbE=; b=T31NdcNUytOvtuUAmIhOBE7QZDpj136NWXBdBxsJf8MEuZdu5raRWnFp930LLQ6tjNKvI+uuqpg77dtnUyyiu4PSU6AxbkaEmgQ0nX48Ec77zIXaAXMztZx2sMlL64MazYKlAU5gIWrTrgrP0cYFIG+TO2s3s/5joi9quqqKhVg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347454794968.9177890058611; Mon, 2 Nov 2020 12:04:14 -0800 (PST) Received: from localhost ([::1]:41562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg3p-0003NC-IA for importer@patchew.org; Mon, 02 Nov 2020 15:04:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxO-0003L8-9g for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxL-0002Ii-Lr for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:33 -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-459-OdiGnfJKMM2dv8gLkU91Iw-1; Mon, 02 Nov 2020 14:57:28 -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 79B811074640; Mon, 2 Nov 2020 19:57:26 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC3351002C0A; Mon, 2 Nov 2020 19:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347051; 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=mxaI1nWPWoN6ERfgr/20Oo48cGu6IBeGmyDAXbuXpbE=; b=ImelUIAWuPVxKU+yDpViiNGJ1+o4BqKHlm+rQDb6BuhFzmskRyIkIC2yXO0UxQPLYQvwdJ sKVqDinII6NYqHN0Se2SJe2ocA9gC6oyhnrRI0nGNNRHp6yONEizdd99Pj0izq599wYaYr 4bRLt+GB8AXSAiHkF5TZTMaP2GjIk14= X-MC-Unique: OdiGnfJKMM2dv8gLkU91Iw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 07/12] virtiofsd: Add attr_flags to fuse_entry_param Date: Mon, 2 Nov 2020 19:56:52 +0000 Message-Id: <20201102195657.219501-8-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz 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 Message-Id: <20201102161859.156603-3-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_lowlevel.c | 2 ++ tools/virtiofsd/fuse_lowlevel.h | 5 +++++ 2 files changed, 7 insertions(+) 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 /* 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 /** --=20 2.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347688; cv=none; d=zohomail.com; s=zohoarc; b=DruqPnmAWKM1+fMDsLlTjNoDJmg+/+JwBq7rMPfXC6u9LVgY/ECKSQ6M7fQJZSuY4mxGYuAQbOZurxmlWAc/aHevyjcdANoCtVym4d7G5zHAa34iTVW8Fk5ADWEogbnlFkwwWubsErUdrDoS9s79bKYK7ceSvbz7gm7bOBCpfrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347688; 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=pF86Yc0J9ZIwLKCrD3/np6G0cyJSDkDFvK23bLbLoAo=; b=QewFNPvG9MIFZAvXOaRFL/wLV0gkmfkt9egWdVuqSzLspgNoV8pTuvg3+5Wuhr7P67YlMN80U2XaaGtF2/4aGnRLvdmmvM5jcZTNmkgbEy7Rg4i750CKa+mdRLyVLaEnTNR/YkArNRfXBQdx+I/n31Lw1tY6uS5b0YOQNWm6m94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347688926175.95313283656958; Mon, 2 Nov 2020 12:08:08 -0800 (PST) Received: from localhost ([::1]:50326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg7b-0007CP-SA for importer@patchew.org; Mon, 02 Nov 2020 15:08:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxR-0003Sy-R3 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxN-0002J5-Cm for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:37 -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-464-hJukeewAPx2jaYoydNiCaw-1; Mon, 02 Nov 2020 14:57:29 -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 65A671006C9F; Mon, 2 Nov 2020 19:57:28 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id C68801002C18; Mon, 2 Nov 2020 19:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347052; 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=pF86Yc0J9ZIwLKCrD3/np6G0cyJSDkDFvK23bLbLoAo=; b=YRvAAnswzi9mz1xDG2ZpoxQZ5yJ5SQ8IaqR7yzDVeBpjTaW3XBaLt0fL38CSLXMI4AXnLI foyrdi7zktefCIpLlOLqXzDPgnyoD1aZqLWdPhi4QlAn/F4xFAhwrsiwloBvxldm+h5zKU 0/QMpVstpr85d6h73xsEMYAVgCnX90s= X-MC-Unique: hJukeewAPx2jaYoydNiCaw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 08/12] meson.build: Check for statx() Date: Mon, 2 Nov 2020 19:56:53 +0000 Message-Id: <20201102195657.219501-9-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz Check whether the glibc provides statx() and if so, define CONFIG_STATX. Signed-off-by: Max Reitz Reviewed-by: Stefan Hajnoczi Message-Id: <20201102161859.156603-4-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347810; cv=none; d=zohomail.com; s=zohoarc; b=TWLXaEhrvbN9F3eDiDa0VC83PjU3eIhSxnDoBQLoJyMcTS22VkPsc69E/gJR2M72ElKVMUJYskYtUUgxpRrYWsWSEL71l1JqLvAZtgsBnAzAUbexqTBtWbbfFKsMdXTp8qnjAb0M8Z1N2oQcrGqp4+5706x4+nGfyb+uX9HIx44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347810; 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=E6Y9BewT7To49jm8FriU9NVJb6zHnpzMNeESDl8tBNI=; b=C425GIJMbsqZSF1XqaVTw6yPsz2V/0zZJ+xZzeE7c7f2RWv7qbU3RfhdhVL0RxjM4R7+9BP6ddtcLDn0yDwANQ2dzyUek5v1WCQ3lZVsacZMCxbOkm6CLkAmEwAfiZgdbRSTlk7n0LTQ0nEMHC56t5Bgje5OT7VMQAp7ikvv0sM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347809998234.42148905067108; Mon, 2 Nov 2020 12:10:09 -0800 (PST) Received: from localhost ([::1]:53626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg9Y-0000E6-HM for importer@patchew.org; Mon, 02 Nov 2020 15:10:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxS-0003Uy-Qw for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxP-0002JU-EZ for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:38 -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-364-ChJLBCGWM_uBg1SzaZXBMw-1; Mon, 02 Nov 2020 14:57:31 -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 417B6107465F; Mon, 2 Nov 2020 19:57:30 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id B158A1002C0A; Mon, 2 Nov 2020 19:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347054; 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=E6Y9BewT7To49jm8FriU9NVJb6zHnpzMNeESDl8tBNI=; b=JIcPnME9+21QYpnswj8vXzJkS3UX6iKSLIbtpmPpHUbvRp3zTJOmgf3VBfA+bUVg6eRENo jfcq6MzyAjVqvZ6048g84QU96mZZOlO9qHstXqq5PFYVlNpE73pM5BlBw7dAQ+4DoJyI4u HqvzIJhKS/j6/T3KcMhNUKb2b/HX+jo= X-MC-Unique: ChJLBCGWM_uBg1SzaZXBMw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 09/12] virtiofsd: Add mount ID to the lo_inode key Date: Mon, 2 Nov 2020 19:56:54 +0000 Message-Id: <20201102195657.219501-10-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz 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 Message-Id: <20201102161859.156603-5-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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 672fb72a31..11623f56f2 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.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347294; cv=none; d=zohomail.com; s=zohoarc; b=XWgKYLU9p4cjeNtgIlfFM0iVp5zMVIrvddNiiZeNF5X9nwZEldw+a4t9vBkaraeF2mcF0ZsMz/pDZaJF1FIu4sY6hjP2uV8LzGg102mDRKs78m/fFX4Y8VEPdvSsncYtKRoJTuH8tyf7GCtnJdUZkEAY1P0yI99MlG/IPTyR2gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347294; 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=Dsdj41DT4PLyqjl/hukCgshvrwrFxo0EoUsW+ilKs0o=; b=Fd67enSXx5fqPzRpD/n2V18/E2K/NJqWnMgcGqu5Q7tHHn3Yt4OU6zv6iNm8PmrPd3yIFaP9F6gfziBgjBkdAkvy4nbYrjsR39B89LA6HZHcqsb40L+yHU5e7SVxCNWfDzndfcUjpZa5txz2fsWyFGAlUTtB6Fx4zVKWb8VzgeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347294560431.5299050157229; Mon, 2 Nov 2020 12:01:34 -0800 (PST) Received: from localhost ([::1]:33746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg1E-0008U8-HI for importer@patchew.org; Mon, 02 Nov 2020 15:01:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxT-0003VX-3n for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxP-0002JZ-Hf for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:38 -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-473-Bx-hNxqJNFK2VGofcWafJQ-1; Mon, 02 Nov 2020 14:57:33 -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 23B58805F08; Mon, 2 Nov 2020 19:57:32 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E0CD1002C0A; Mon, 2 Nov 2020 19:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347054; 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=Dsdj41DT4PLyqjl/hukCgshvrwrFxo0EoUsW+ilKs0o=; b=JgN2hjrOsl/SnwdA6rbikTvJgHNkco6ivJ7N6O6RCTLlq1YI8b3KszqxlgkHIerocTI13B 9VQRSCnu4yzGBV8Y49yducfrELyNLES8Jwl93cXRr4CgmhoFDYT8rm+Vjrg2gtPXk2/ttQ eJbN7ThmS+pCJouVNtkwNNqGVFaboOc= X-MC-Unique: Bx-hNxqJNFK2VGofcWafJQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 10/12] virtiofsd: Announce sub-mount points Date: Mon, 2 Nov 2020 19:56:55 +0000 Message-Id: <20201102195657.219501-11-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz 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 Message-Id: <20201102161859.156603-6-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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 ae1b22e4a6..75ac48dec2 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.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347894; cv=none; d=zohomail.com; s=zohoarc; b=ayxQZ6UZQtjM86tB+k03/gtGUOPc2sdimr3R8Qy8Asv+Kwi61Dd1AXxajbq5ECHMQivRga7jqD9k/Ka4ZI2i86yfMgUfULHXiO5YH0DjIZpPjtPXTHjIUkaD5J27/A/k/g64jdzynRK3QOfaa2MGMvi0Gv4R4K3YGKwFB91MQk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347894; 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=8BHEAGo3mMQcmjJE1GTOmm+Cd+aZUSdFcvRra47GUYQ=; b=VtcyOtRYmMYYuF7S6WZ3PI4ojLJSlMhCskdWenQpXtc2NCR6/VZpgWgqhIHMfbhk8Zw9dI7XD6tZRlRrPIqo3jLvPThNkNT5kO1N8o7g9PdnktaWxA+QeBgTWbYqy0ARNlhc11VYvXXfprVn+p0CXYhgAH2cBdEAXovJfw0sDJ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347894592798.4522664296942; Mon, 2 Nov 2020 12:11:34 -0800 (PST) Received: from localhost ([::1]:57210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZgAv-0001sA-Ea for importer@patchew.org; Mon, 02 Nov 2020 15:11:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxa-0003gp-TZ for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxV-0002Ki-Dk for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:46 -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-100-9tPqkuPEPUK1oWLHDrcVpw-1; Mon, 02 Nov 2020 14:57:37 -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 F07871868410; Mon, 2 Nov 2020 19:57:36 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 718F31002C18; Mon, 2 Nov 2020 19:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347060; 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=8BHEAGo3mMQcmjJE1GTOmm+Cd+aZUSdFcvRra47GUYQ=; b=G/S46DzjjhboVmOf/zed/SWqYVHTLhUQBLNwtKhj0UFIbiDS1h1JDBGyWxNMiLtbwdAxMD HWM2bbCw8QEZmyQH+IHaJ49bEaPPp1nDNrHCPHLUygek19h9YhmKz8XrRDsPJf8cvF+7mf 4mH/97lo/Rrh9dx4vH5uTGYh4qMOeDY= X-MC-Unique: 9tPqkuPEPUK1oWLHDrcVpw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 11/12] tests/acceptance/boot_linux: Accept SSH pubkey Date: Mon, 2 Nov 2020 19:56:56 +0000 Message-Id: <20201102195657.219501-12-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Max Reitz 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 Message-Id: <20201102161859.156603-7-mreitz@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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.28.0 From nobody Fri May 17 09:38:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604347395; cv=none; d=zohomail.com; s=zohoarc; b=de6jwrDt6eL6fdjn5W632I9QUv3QmbNtHgMgt/fi9ITmWVfMWYHWe3o50BxTGFXUZp4rnkO0cd90O8xiSGnFbl81vlTFU94Y3Oyo02Y+fcoznZlkrvVpk3nVRYGPU0C371fLAFYfXiFeq7L45Ja/hZ/NBU66pLR28d4igWde8vQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604347395; 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=RGUmk/P/ABv2JcRc2Efas5PCwomr5lPNuqHWZ6mzqaI=; b=lU636MKpp4/FR11nr1lXjlqE/Di66XDzPqdFgfddu58wxmIhSF2M5N4dOVk8YGWLccgq7xOd9YNfGHQCecYeHEIPI9PEeTVAEbMe24T9jiTd2JNUpN+qjAJ6p3sn8uKci7m7x06+4yTZ/0G+8XsWSSG6K8eA+yycvmeXBjf0o5o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1604347395885603.6401730600105; Mon, 2 Nov 2020 12:03:15 -0800 (PST) Received: from localhost ([::1]:37450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZg2s-0001bP-L5 for importer@patchew.org; Mon, 02 Nov 2020 15:03:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZfxf-0003lB-LX for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kZfxa-0002L8-H9 for qemu-devel@nongnu.org; Mon, 02 Nov 2020 14:57:51 -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-43-8yeMdfUQMxC3neNsZr0s_w-1; Mon, 02 Nov 2020 14:57:40 -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 0BE26805F12; Mon, 2 Nov 2020 19:57:39 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B8B81002C0A; Mon, 2 Nov 2020 19:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604347065; 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=RGUmk/P/ABv2JcRc2Efas5PCwomr5lPNuqHWZ6mzqaI=; b=XaOWpIIP6rIU6MDXewkCdZSeT1D866FjvmqPBc9L5B7TtTRcD8NI0DmMJPcEhdeF38yZFL yiTi6nEPcbbEcUWE+77sMc6CFzw3thUROg1vL0CGmYbou4QDA45+F6P09Ow5qQkZXThqgX WRwGkSsxiMM5pBpQ71NZ6A45Cu+4+sQ= X-MC-Unique: 8yeMdfUQMxC3neNsZr0s_w-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, philmd@redhat.com, zhangjiachen.jaycee@bytedance.com, mreitz@redhat.com Subject: [PULL 12/12] tests/acceptance: Add virtiofs_submounts.py Date: Mon, 2 Nov 2020 19:56:57 +0000 Message-Id: <20201102195657.219501-13-dgilbert@redhat.com> In-Reply-To: <20201102195657.219501-1-dgilbert@redhat.com> References: <20201102195657.219501-1-dgilbert@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=dgilbert@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=dgilbert@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: stefanha@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz 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 Message-Id: <20201102161859.156603-8-mreitz@redhat.com> Tested-by: Eduardo Habkost Signed-off-by: Dr. David Alan Gilbert --- 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.28.0