From nobody Tue May 21 17:38:44 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=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1647284768; cv=none; d=zohomail.com; s=zohoarc; b=ScxnS31bKTJ3nfURBwRpIGEezn3bf1+CwPsHGCpz7uES1rezM0g2juK0QewVWfmeSkxYy+HlE6s/u45XedMPIhHWNxF2N2tWw1+UuFzXN5otLJKPRgMs4jWkb4xGrhzQHqXKUYmHD8YtgAPPq10C+2Un3H7WvPzNHTkBNkr0aAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647284768; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=M6ewKKtFxas3C9txmsGWiOoZhKeVCxeGfx7klVYpVMk=; b=E+bcVKGcu91tMlMWSEI5a3Av3c5DyfXhMlInc208JqKhWk5vrIPZjDMICWqFLBiHpkWi4I5VOFSs2KiB0l/3gURcKYgOWupl0TzUsUpcq67HM0g2uQwXwS1i0P/Xn+P67jSzFZc2QNxhkF/PW39jXHJS9VeIuOqqjTSaatZ8IlY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16472847684215.562698200252498; Mon, 14 Mar 2022 12:06:08 -0700 (PDT) Received: from localhost ([::1]:33180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTq1A-00017v-5u for importer@patchew.org; Mon, 14 Mar 2022 15:06:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <8053872006a4f18068bfb1825f21a108643f242e@lizzy.crudebyte.com>) id 1nTpzW-00008N-WA for qemu-devel@nongnu.org; Mon, 14 Mar 2022 15:04:27 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:56821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <8053872006a4f18068bfb1825f21a108643f242e@lizzy.crudebyte.com>) id 1nTpzV-0004ig-1s for qemu-devel@nongnu.org; Mon, 14 Mar 2022 15:04:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Message-Id:Cc:To:Subject:Date:From:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Content-ID: Content-Description; bh=M6ewKKtFxas3C9txmsGWiOoZhKeVCxeGfx7klVYpVMk=; b=P013M F6u2rwjyWyhc00yEW/vRzTiqKlgwfZDuys7EcVUyDd+16X7CATCQ41CAPd1u5AXU49TfQQEaimHTa UvT0RHFxTWkErAl1onZDEv+2wEekJ7+G1XZNowXB3/5BeMV2SOZhP6ongTzB7CgRlJN+ITfP7Rq+h FdcbUHhz5qOZ8nmF6eJGbcFvc65f8V5hVGjcbVjxMRzGhe69XYsx8Ge9IOe5/N1iz0xLMRQ7JpzBQ HDqraKF9w07IDUYUF3ikH2kBfvpTpn32a2mXhiIZ8TDdoFNaZuyjwjR4xK8rnQgbf2UEti0L9hyr6 9QzrnQckGIpPaZ8FkDp8W8+owkqGQ==; From: Christian Schoenebeck Date: Mon, 14 Mar 2022 19:58:11 +0100 Subject: [PATCH] 9pfs: fix inode sequencing in 'synth' driver To: qemu-devel@nongnu.org Cc: Greg Kurz Message-Id: 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: none client-ip=91.194.90.13; envelope-from=8053872006a4f18068bfb1825f21a108643f242e@lizzy.crudebyte.com; helo=lizzy.crudebyte.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1647284775044100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The 'synth' driver's root node and the 'synth' driver's first subdirectory node falsely share the same inode number (zero), which makes it impossible for 9p clients (i.e. 9p test cases) to distinguish root node and first subdirectory from each other by comparing their QIDs (which are derived by 9p server from driver's inode numbers). Fix this issue by using prefix-increment instead of postfix-increment operator while generating new inode numbers for subdirectories and files. Link: https://lore.kernel.org/qemu-devel/3859307.hTDP4D0zbi@silver/ Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz --- hw/9pfs/9p-synth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index b3080e415b..f3c73d3b0b 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -92,7 +92,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode, } } /* Add the name */ - node =3D v9fs_add_dir_node(parent, mode, name, NULL, synth_node_count+= +); + node =3D v9fs_add_dir_node(parent, mode, name, NULL, ++synth_node_coun= t); v9fs_add_dir_node(node, parent->attr->mode, "..", parent->attr, parent->attr->inode); v9fs_add_dir_node(node, node->attr->mode, ".", @@ -130,7 +130,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int= mode, mode =3D ((mode & 0777) | S_IFREG); node =3D g_malloc0(sizeof(V9fsSynthNode)); node->attr =3D &node->actual_attr; - node->attr->inode =3D synth_node_count++; + node->attr->inode =3D ++synth_node_count; node->attr->nlink =3D 1; node->attr->read =3D read; node->attr->write =3D write; --=20 2.30.2