From nobody Mon Apr 6 09:20:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 1572A37F8C1 for ; Fri, 20 Mar 2026 22:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774044245; cv=none; b=H6lCvLlKx+q+ECmL2ZKxTvHu/SanpviOuZ7VT6hXjUQQn4jsl7A+9tb/XGwPE3SYnIn7K0LFuOt8/qxaMp0DdQSbK4jkritw16smE2CJrWuG3pEZE7hvESUmxkTTXCe2eeg37o/e2BZVBdzU5O9ft3r8DuObXlk+gBhlD7yyP1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774044245; c=relaxed/simple; bh=WuOr17rmOeSXijSalpBw2VvgVcngOVpjuie0BTD4cHE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R4B1P5S92m8P9BjzUGKPyZnr5A/Ouk6obXUXX48u8J7GwSxFIAI1rCWNp9v4V9u6N9iszpw2pQxBrtS4vdsOOE0PMX45Trq1YIbUTGoth29OFSubHvE47H1XXqfQmvFF9XEFfqpy4DZeG6WclDw7bBy2Hi6GufN5Fi/yubTB/ws= 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=hZxhQ3Dc; arc=none smtp.client-ip=198.175.65.9 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="hZxhQ3Dc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774044243; x=1805580243; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WuOr17rmOeSXijSalpBw2VvgVcngOVpjuie0BTD4cHE=; b=hZxhQ3DcWoigMgyNlvEG3VjD4eTnnDLPWwCm5tApQjGNJakNMgdkNqWI 9rSv930FTvG3Tzh5bfjdLNDXgU40TDy5IoJjPHFQxxywZd304TEXBWXlz fI73pyYUzoVCBcwiuItwq9k33qDFe0irI1+47YfUI9E0EhYLkEFu+4YGg q9mIUXdEAsj8+5KRFJEjaa7REmbnJ8OXCXlndyqsXFcumVCZdlEFjv5QI DpwkgjRlHEUZKioXHestSZdhOGCKTbhp5JXfvK7OwSd0206iIb5TjDLEn WioOGN0CBahxvVR1rRWHZT3txETHjAbJzMoCEJ41zj7VAmjfCdTdMCzT+ g==; X-CSE-ConnectionGUID: Lgo2ZT2BROe9T0/bG1yAqw== X-CSE-MsgGUID: Lh7P/w0GRo6pX4z465jTSg== X-IronPort-AV: E=McAfee;i="6800,10657,11735"; a="97758428" X-IronPort-AV: E=Sophos;i="6.23,132,1770624000"; d="scan'208";a="97758428" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2026 15:03:56 -0700 X-CSE-ConnectionGUID: zSK5T1MTT2Gc7XBDpdDXkA== X-CSE-MsgGUID: ribkLN90S4Cj7R8E95sgwA== X-ExtLoop1: 1 Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2026 15:03:56 -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 v2 10/14] fs/resctrl: Use accurate and symmetric exit flows Date: Fri, 20 Mar 2026 15:03:20 -0700 Message-ID: <445ac564270970f5736f39f892c9997728fc9bc0.1774043709.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 cc4237c57cbe..a8e7cdcfec6e 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