Skip to contentSkip to conversation

dup2/dup205: close all fds before tst_rmdir()

PATCH Superseded Eryu Guan 4 participants 6 messages Jun 24, 2013

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 dup2/dup205: close all fds before tst_rmdir()

Close all open fds before calling tst_rmdir() to avoid TWARN caused by NFS silly rename when removing temp dir caused by NFS silly rename.

dup205 0 TWARN : tst_rmdir: rmobj(/mnt/nfs/dupbA5J5i) failed: unlink(/mnt/nfs/dupbA5J5i/.nfs0000000000f4805b00000005) failed; errno=16: Device or resource busy

---
 testcases/kernel/syscalls/dup2/dup205.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/dup2/dup205.c +2 -2
index c728fcc..0528beb 100644
@@ -112,8 +112,8 @@ int main(int ac, char *av[])
 			}
 		}
 		unlink(pfilname);
-		if (ifile > 0)
-			close(fildes[ifile - 1]);
+		for (ifile = fildes[0]; ifile < min + 10; ifile++)
+			close(fildes[ifile]);
 		if (local_flag == PASSED) {
 			tst_resm(TPASS, "Test passed.");
 		} else {
Signature · 13 lines
1.8.3.1


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 2 lines · On Monday 24 June 2013 11:12:07 Eryu Guan wrote:

Close all open fds before calling tst_rmdir() to avoid TWARN caused by NFS silly rename when removing temp dir caused by NFS silly rename.

"NFS silly rename" duplicated by accident ?

code looks fine to me
-mike

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw
Quoted 5 lines · Mike Frysinger
Quoted 2 lines · On Monday 24 June 2013 11:12:07 Eryu Guan wrote:

Close all open fds before calling tst_rmdir() to avoid TWARN caused by NFS silly rename when removing temp dir caused by NFS silly rename.

"NFS silly rename" duplicated by accident ?

Oh, forgot to remove one "NFS silly rename" when editing commit message.. Will send v2. Thanks for the review!

Eryu Guan

Quoted 3 lines

code looks fine to me
-mike

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#3 lore raw

PATCH v2 1/1 dup2/dup205: close all fds before tst_rmdir()

In reply to Eryu Guan

Close all open fds before calling tst_rmdir() to avoid TWARN caused by NFS silly rename when removing temp dir.

dup205 0 TWARN : tst_rmdir: rmobj(/mnt/nfs/dupbA5J5i) failed: unlink(/mnt/nfs/dupbA5J5i/.nfs0000000000f4805b00000005) failed; errno=16: Device or resource busy

---
v2: Correct commit message.

 testcases/kernel/syscalls/dup2/dup205.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/dup2/dup205.c +2 -2
index c728fcc..0528beb 100644
@@ -112,8 +112,8 @@ int main(int ac, char *av[])
 			}
 		}
 		unlink(pfilname);
-		if (ifile > 0)
-			close(fildes[ifile - 1]);
+		for (ifile = fildes[0]; ifile < min + 10; ifile++)
+			close(fildes[ifile]);
 		if (local_flag == PASSED) {
 			tst_resm(TPASS, "Test passed.");
 		} else {
Signature · 13 lines
1.8.3.1


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Acked-by on v2 1/1
#4 lore raw
Quoted 6 lines · Eryu Guan

Close all open fds before calling tst_rmdir() to avoid TWARN caused by NFS silly rename when removing temp dir.

dup205 0 TWARN : tst_rmdir: rmobj(/mnt/nfs/dupbA5J5i) failed: unlink(/mnt/nfs/dupbA5J5i/.nfs0000000000f4805b00000005) failed; errno=16: Device or resource busy

Looks good to me.

Quoted 12 lines

---
v2: Correct commit message.

  testcases/kernel/syscalls/dup2/dup205.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/dup2/dup205.c +0 -0
index c728fcc..0528beb 100644

testcases/kernel/syscalls/dup2/dup205.c int main(int ac, char *av[]) · line 119

Quoted 10 lines
testcases/kernel/syscalls/dup2/dup205.c +2 -2
@@ -112,8 +112,8 @@ int main(int ac, char *av[])
  			}
  		}
  		unlink(pfilname);
-		if (ifile > 0)
-			close(fildes[ifile - 1]);
+		for (ifile = fildes[0]; ifile < min + 10; ifile++)
+			close(fildes[ifile]);
  		if (local_flag == PASSED) {
  			tst_resm(TPASS, "Test passed.");
  		} else {

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw
In reply to Eryu Guan

Hi!
Pushed, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list