[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201020235126.1871815-17-fenghua.yu@intel.com>
Date: Tue, 20 Oct 2020 23:51:21 +0000
From: Fenghua Yu <fenghua.yu@...el.com>
To: "Shuah Khan" <shuah@...nel.org>,
"Reinette Chatre" <reinette.chatre@...el.com>,
"Tony Luck" <tony.luck@...el.com>,
"Babu Moger" <babu.moger@....com>,
"James Morse" <james.morse@....com>,
"Borislav Petkov" <bp@...en8.de>,
"Thomas Gleixner" <tglx@...utronix.de>,
"Ravi V Shankar" <ravi.v.shankar@...el.com>
Cc: "linux-kselftest" <linux-kselftest@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: [PATCH v3 16/21] selftests/resctrl: Umount resctrl FS only if mounted
umount_resctrlfs() directly attempts to unmount resctrl file system without
checking if resctrl FS is already mounted or not. It returns 0 on success
and on failure it prints an error message and returns an error status.
Calling umount_resctrlfs() when resctrl FS isn't mounted will return an
error status.
There could be situations where-in the caller might not know if resctrl
FS is already mounted or not and the caller might still want to unmount
resctrl FS if it's already mounted (For example during teardown).
To support above use cases, change umount_resctrlfs() such that it now
first checks if resctrl FS is already mounted or not and unmounts resctrl
FS only if it's already mounted.
Fixes: 591a6e8588fc ("selftests/resctrl: Add basic resctrl file system operations and data")
Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
---
tools/testing/selftests/resctrl/resctrlfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 05956319d9ce..21281fd895b7 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -92,6 +92,9 @@ int remount_resctrlfs(bool mum_resctrlfs)
int umount_resctrlfs(void)
{
+ if (find_resctrl_mount(NULL))
+ return 0;
+
if (umount(RESCTRL_PATH)) {
perror("# Unable to umount resctrl");
--
2.29.0
Powered by blists - more mailing lists