Skip to contentSkip to conversation

syscalls/umount2_02: remove useless TST_ERR assignment

PATCH In review Dai Shili 3 participants 7 messages Mar 25, 2022 – Mar 30, 2022

lore
Share & tools
lore

Dai Shili

author
#0 lore raw

PATCH 1/1 syscalls/umount2_02: remove useless TST_ERR assignment

---
 testcases/kernel/syscalls/umount2/umount2_02.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/umount2/umount2_02.c +0 -1
index 4c3b30e..d1aed11 100644
@@ -69,7 +69,6 @@ static int umount2_retry(const char *target, int flags)
 	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
 		target, flags);
 
-	TST_ERR = EBUSY;
 	return -1;
 }
 
Signature · 5 lines
1.8.3.1


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

Hi Dai,

Quoted 10 lines
---
 testcases/kernel/syscalls/umount2/umount2_02.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
index 4c3b30e..d1aed11 100644

testcases/kernel/syscalls/umount2/umount2_02.c static int umount2_retry(const char *target, int flags) · line 72

Quoted 4 lines
testcases/kernel/syscalls/umount2/umount2_02.c +0 -1
@@ -69,7 +69,6 @@ static int umount2_retry(const char *target, int flags)
 	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
 		target, flags);
 
-	TST_ERR = EBUSY;

Not sure if the for loop in umount2_retry() could overwrite the original errno.

Kind regards,
Petr

Quoted 2 lines
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
 	return -1;
 }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Petr,Dai

Quoted 15 lines

Hi Dai,

Quoted 12 lines
---
  testcases/kernel/syscalls/umount2/umount2_02.c | 1 -
  1 file changed, 1 deletion(-)
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
index 4c3b30e..d1aed11 100644
@@ -69,7 +69,6 @@ static int umount2_retry(const char *target, int flags)
  	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
  		target, flags);
Quoted 3 lines

testcases/kernel/syscalls/umount2/umount2_02.c static int umount2_retry(const char *target, int flags) · line 72

Quoted 1 line
testcases/kernel/syscalls/umount2/umount2_02.c +0 -1
-	TST_ERR = EBUSY;

Not sure if the for loop in umount2_retry() could overwrite the original errno.

IMO, in this wrapper, we don't need to use TEST macro and we can use umount2 directly.

Best Regards
Yang Xu

Quoted 7 lines

Kind regards,
Petr

Quoted 2 lines
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
  	return -1;
  }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 16 lines

Hi Petr,Dai

Quoted 14 lines

Hi Dai,

Quoted 12 lines
---
  testcases/kernel/syscalls/umount2/umount2_02.c | 1 -
  1 file changed, 1 deletion(-)
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
index 4c3b30e..d1aed11 100644
@@ -69,7 +69,6 @@ static int umount2_retry(const char *target, int flags)
  	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
  		target, flags);
Quoted 5 lines
Quoted 3 lines

testcases/kernel/syscalls/umount2/umount2_02.c static int umount2_retry(const char *target, int flags) · line 72

Quoted 1 line
testcases/kernel/syscalls/umount2/umount2_02.c +0 -1
-	TST_ERR = EBUSY;

Not sure if the for loop in umount2_retry() could overwrite the original errno.

IMO, in this wrapper, we don't need to use TEST macro and we can use umount2 directly.

+1

Kind regards,
Petr

Quoted 8 lines

Best Regards
Yang Xu

Quoted 5 lines

Kind regards,
Petr

Quoted 2 lines
testcases/kernel/syscalls/umount2/umount2_02.c +0 -0
  	return -1;
  }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

PATCH 1/1 syscalls/umount2_02: use umount2 directly instead of TEST macro

In reply to [email protected]

There is no need to use TEST macro in umount2_retry(), because we have used it in TST_EXP_FAIL and TST_EXP_PASS macro.

---
 testcases/kernel/syscalls/umount2/umount2_02.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/umount2/umount2_02.c +5 -5
index 4c3b30e..b23f37b 100644
@@ -53,12 +53,12 @@ static struct tcase {
 
 static int umount2_retry(const char *target, int flags)
 {
-	int i;
+	int i, ret;
 
 	for (i = 0; i < 50; i++) {
-		TEST(umount2(target, flags));
-		if (TST_RET == 0 || TST_ERR != EBUSY)
-			return TST_RET;
+		ret = umount2(target, flags);
+		if (ret == 0 || errno != EBUSY)
+			return ret;
 
 		tst_res(TINFO, "umount('%s', %i) failed with EBUSY, try %2i...",
 			target, flags, i);
@@ -69,7 +69,7 @@ static int umount2_retry(const char *target, int flags)
 	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
 		target, flags);
 
-	TST_ERR = EBUSY;
+	errno = EBUSY;
 	return -1;
 }
 
Signature · 5 lines
1.8.3.1


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

Re: [LTP] [PATCH] syscalls/umount2_02: use umount2 directly instead of TEST macro

Hi Dai

Looks good to me,

Best Regards
Yang Xu

Quoted 38 lines

There is no need to use TEST macro in umount2_retry(), because we have used it in TST_EXP_FAIL and TST_EXP_PASS macro.

---
  testcases/kernel/syscalls/umount2/umount2_02.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/umount2/umount2_02.c +5 -5
index 4c3b30e..b23f37b 100644
@@ -53,12 +53,12 @@ static struct tcase {
 
  static int umount2_retry(const char *target, int flags)
  {
-	int i;
+	int i, ret;
 
  	for (i = 0; i<  50; i++) {
-		TEST(umount2(target, flags));
-		if (TST_RET == 0 || TST_ERR != EBUSY)
-			return TST_RET;
+		ret = umount2(target, flags);
+		if (ret == 0 || errno != EBUSY)
+			return ret;
 
  		tst_res(TINFO, "umount('%s', %i) failed with EBUSY, try %2i...",
  			target, flags, i);
@@ -69,7 +69,7 @@ static int umount2_retry(const char *target, int flags)
  	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
  		target, flags);
 
-	TST_ERR = EBUSY;
+	errno = EBUSY;
  	return -1;
  }
 
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Applied
#6 lore raw

Re: [LTP] [PATCH] syscalls/umount2_02: use umount2 directly instead of TEST macro

Hi Dai

merged, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp