[PATCH V2 16/19] selftests/resctrl: Umount resctrl FS only if mounted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, umount_resctrlfs() directly attempts to unmount resctrl FS
without checking if resctrl FS is already mounted or not. But, there
could be situations where-in the caller might not know if resctrl FS is
already mounted or not. The caller might want to unmount resctrl FS _only_
if it's already mounted.

Hence, change umount_resctrlfs() such that it now first checks if resctrl
FS is mounted or not and unmounts resctrl FS only if it's already mounted
and does nothing if it's not mounted.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@xxxxxxxxx>
---
 tools/testing/selftests/resctrl/resctrlfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 83cd3b026c52..ebc8e3b4f7ff 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -92,8 +92,10 @@ int remount_resctrlfs(bool mum_resctrlfs)
 
 void umount_resctrlfs(void)
 {
-	if (umount(RESCTRL_PATH))
-		perror("# Unable to umount resctrl");
+	if (!find_resctrl_mount(NULL)) {
+		if (umount(RESCTRL_PATH))
+			perror("# Unable to umount resctrl");
+	}
 }
 
 /*
-- 
2.19.1




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux