From nobody Thu Apr 9 15:01:23 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C65839DBD9 for ; Tue, 7 Apr 2026 16:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775577786; cv=none; b=COc35E+i2qQrkgwQGuP69b6/zFpDPVROiWjRrleH//YuZ/OA3tMgqMClu3Kr+D3DJ9GCG3U0r/hFku2VFMdM+goyTZp3jpwpYKMaiB4XR5D/Du6JGS8OhKVGAl8PNSQCQ18CeKkbbfIHjb+rhoCtOvC7NkA9Xr191n5LMmMe3Zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775577786; c=relaxed/simple; bh=DBmG70Xr4+Z1t3xjsxbRIErkOrffXvoW6wckmtG8CM4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RvHvZQUqnrM+zX9bomA13QTtw5rIs48uhHDIapS7rYTZkCo5qz/y/CaLiPummsNt2pMwdc4aisv8KXuBeZWK6RsRt+J1xdLT5rYRZ3tG5eASXOVIZynjBP5RHQuB0nUmyqogRkvku2U9bz00Fw6jG4C1HHHhei3QPAYYqVojhQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eqXnlTVc; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eqXnlTVc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775577779; x=1807113779; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DBmG70Xr4+Z1t3xjsxbRIErkOrffXvoW6wckmtG8CM4=; b=eqXnlTVcbQHiNpp4+78lHN6h78qnovyyK81YkEx19ESTey7U74MurEZu pyfeI1PpeQ8+CaNhatYT4vd+3g6mP3k5ah9jjZhAdW1WBOVNOMpW7WD2T JTd3XeECwjXsThtEf+yj53zsnrnDQXzkXcJmXwVLG2MmqTP/Qw2AaDrJU OmIvrOqIpQkXq3VjqXpHnYmteSXroeEKd+FYRDoaV2uCDvNE5PNA4+oLJ 23bapmJl9Nb8Y0C9IPykzU3dHTes0fMxdB6gJesx5SMR3A3qvH5IYC2yQ wYMj8URbBVHGMLcdzj7SpforaAHCH9n1VxMem8RrLGe4ynqZbLn48rJLo Q==; X-CSE-ConnectionGUID: rXH7KQ/vSNO01nLrDj0M+A== X-CSE-MsgGUID: IW+veAxQQpe/DTllrroIKA== X-IronPort-AV: E=McAfee;i="6800,10657,11752"; a="80432717" X-IronPort-AV: E=Sophos;i="6.23,165,1770624000"; d="scan'208";a="80432717" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 09:02:19 -0700 X-CSE-ConnectionGUID: BSgNVgdgT+ml23rXCqpn/g== X-CSE-MsgGUID: SJZQJCeKT6WR5TCpc7f0bQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,165,1770624000"; d="scan'208";a="228119059" Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 09:02:18 -0700 From: Reinette Chatre To: tony.luck@intel.com, james.morse@arm.com, Dave.Martin@arm.com, babu.moger@amd.com, bp@alien8.de, tglx@linutronix.de, dave.hansen@linux.intel.com Cc: x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fustini@kernel.org, fenghuay@nvidia.com, peternewman@google.com, linux-kernel@vger.kernel.org, patches@lists.linux.dev, reinette.chatre@intel.com Subject: [PATCH v3 10/13] fs/resctrl: Use accurate and symmetric exit flows Date: Tue, 7 Apr 2026 09:02:07 -0700 Message-ID: <1762225e701717c34ba544e9d92bc1af9f453f7e.1775576382.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" During schemata file write handling there is one error exit path labeled "out" that handles all cleanup and unlocking needed on exit. The staged configs cleared during an error exit may not have been used at the time of exit making the clearing of the staged configs unnecessary. Access the exit code using two labels and only clear the staged configuration if it was in use at the time of exit. Doing so makes the code flow obvious and simplifies upcoming changes that improve the handling of failures during early input parsing. Signed-off-by: Reinette Chatre --- fs/resctrl/ctrlmondata.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 9a7dfc48cb2e..8a43efe67a95 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -331,7 +331,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file= *of, if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKED) { ret =3D -EINVAL; rdt_last_cmd_puts("Resource group is pseudo-locked\n"); - goto out; + goto out_unlock; } =20 rdt_staged_configs_clear(); @@ -341,16 +341,16 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_fi= le *of, if (!tok) { rdt_last_cmd_puts("Missing ':'\n"); ret =3D -EINVAL; - goto out; + goto out_clear_staged; } if (tok[0] =3D=3D '\0') { rdt_last_cmd_printf("Missing '%s' value\n", resname); ret =3D -EINVAL; - goto out; + goto out_clear_staged; } ret =3D rdtgroup_parse_resource(resname, tok, rdtgrp); if (ret) - goto out; + goto out_clear_staged; } =20 list_for_each_entry(s, &resctrl_schema_all, list) { @@ -365,7 +365,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file= *of, =20 ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); if (ret) - goto out; + goto out_clear_staged; } =20 if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP) { @@ -378,8 +378,9 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file= *of, ret =3D rdtgroup_pseudo_lock_create(rdtgrp); } =20 -out: +out_clear_staged: rdt_staged_configs_clear(); +out_unlock: rdtgroup_kn_unlock(of->kn); return ret ?: nbytes; } --=20 2.50.1