Skip to contentSkip to conversation

mountns01: wait for umount completed in thread_b

PATCH In review Li Wang 2 participants 3 messages Jul 7, 2022 – Jul 8, 2022

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 mountns01: wait for umount completed in thread_b

To get rid of race condition (occurs with umount_folders):

mountns01.c:42: TPASS: shared mount in parent passed mountns01.c:83: TPASS: shared mount in child passed tst_device.c:394: TWARN: umount('B') failed with EINVAL mountns.h:39: TWARN: umount(B) failed: EINVAL (22)

---
 testcases/kernel/containers/mountns/mountns01.c | 2 ++
 testcases/kernel/containers/mountns/mountns02.c | 2 ++
 testcases/kernel/containers/mountns/mountns03.c | 2 ++
 3 files changed, 6 insertions(+)
testcases/kernel/containers/mountns/mountns01.c +2 -0
index 452fe1d10..3e9c22ce3 100644
@@ -86,6 +86,8 @@ static void run(void)
 
 	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
 	SAFE_UMOUNT(DIRA);
 }
 
testcases/kernel/containers/mountns/mountns02.c +2 -0
index cbd435958..4ef1a61b8 100644
@@ -87,6 +87,8 @@ static void run(void)
 
 	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
 	SAFE_UMOUNT(DIRA);
 }
 
testcases/kernel/containers/mountns/mountns03.c +2 -0
index 5c19a96a9..0d8b86f9d 100644
@@ -97,6 +97,8 @@ static void run(void)
 
 	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
 	SAFE_UMOUNT(DIRA);
 }
 
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Li

We can also use TST_CHECKPOINT_WAKE_AND_WAIT(0) again, but use SAFE_WAIT(NULL) is easier.

So

ps: mountns04 seems doesn't need to use needs_checkpoints member because we don't use tst_checkpoint* api in there.

Best Regards
Yang Xu

Quoted 53 lines

To get rid of race condition (occurs with umount_folders):

mountns01.c:42: TPASS: shared mount in parent passed mountns01.c:83: TPASS: shared mount in child passed tst_device.c:394: TWARN: umount('B') failed with EINVAL mountns.h:39: TWARN: umount(B) failed: EINVAL (22)

---
  testcases/kernel/containers/mountns/mountns01.c | 2 ++
  testcases/kernel/containers/mountns/mountns02.c | 2 ++
  testcases/kernel/containers/mountns/mountns03.c | 2 ++
  3 files changed, 6 insertions(+)
testcases/kernel/containers/mountns/mountns01.c +2 -0
index 452fe1d10..3e9c22ce3 100644
@@ -86,6 +86,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
testcases/kernel/containers/mountns/mountns02.c +2 -0
index cbd435958..4ef1a61b8 100644
@@ -87,6 +87,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
testcases/kernel/containers/mountns/mountns03.c +2 -0
index 5c19a96a9..0d8b86f9d 100644
@@ -97,6 +97,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Li Wang

Hi Li

I have merged this patch by modifying patch title
mountns01->mountns0[1-3]

Best Regards
Yang Xu

Quoted 53 lines

To get rid of race condition (occurs with umount_folders):

mountns01.c:42: TPASS: shared mount in parent passed mountns01.c:83: TPASS: shared mount in child passed tst_device.c:394: TWARN: umount('B') failed with EINVAL mountns.h:39: TWARN: umount(B) failed: EINVAL (22)

---
  testcases/kernel/containers/mountns/mountns01.c | 2 ++
  testcases/kernel/containers/mountns/mountns02.c | 2 ++
  testcases/kernel/containers/mountns/mountns03.c | 2 ++
  3 files changed, 6 insertions(+)
testcases/kernel/containers/mountns/mountns01.c +2 -0
index 452fe1d10..3e9c22ce3 100644
@@ -86,6 +86,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
testcases/kernel/containers/mountns/mountns02.c +2 -0
index cbd435958..4ef1a61b8 100644
@@ -87,6 +87,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
testcases/kernel/containers/mountns/mountns03.c +2 -0
index 5c19a96a9..0d8b86f9d 100644
@@ -97,6 +97,8 @@ static void run(void)
 
  	TST_CHECKPOINT_WAKE(0);
 
+	SAFE_WAIT(NULL);
+
  	SAFE_UMOUNT(DIRA);
  }
 
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp