Skip to contentSkip to conversation

io/diotest4: Close open fd after testing

PATCH In review Eryu Guan 2 participants 2 messages Dec 26, 2011

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 io/diotest4: Close open fd after testing

The 'silly rename' mechanism of NFS creates temporary file .nfsXXX in NFS mount. The tst_rmdir() in cleanup() in diotest4.c complains about "Device or resource busy"

Close open fd after each sub-test.

---
 testcases/kernel/io/direct_io/diotest4.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
testcases/kernel/io/direct_io/diotest4.c +4 -0
index 1f1b44b..a256104 100644
@@ -324,6 +324,7 @@ main(int argc, char *argv[])
 		else
 			tst_resm (TPASS, "Out of range file descriptor");
 	}
+	close(newfd);
 	total++;
 
 	/* Test-7: Closed file descriptor */
@@ -360,6 +361,7 @@ main(int argc, char *argv[])
 		else
 			tst_resm (TPASS, "character device read, write");
 	}
+	close(newfd);
 	total++;
 
 	/* Test-10: read, write to a mmaped file */
@@ -400,6 +402,7 @@ main(int argc, char *argv[])
 	}
 	else
 		tst_resm (TPASS, "read, write to an unmapped file");
+	close(fd);
 	total++;
 
 	/* Test-12: read from file not open for reading */
@@ -610,6 +613,7 @@ static void setup(void)
 	if ((fd1 = open(filename, O_DIRECT, 0600)) < 0) {
 		tst_brkm(TCONF, cleanup, "O_DIRECT is not supported by this filesystem. %s", strerror(errno));
 	}
+	close(fd1);
 }
 
 static void cleanup(void)

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev

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

#1 lore raw
Quoted 8 lines · Eryu Guan

The 'silly rename' mechanism of NFS creates temporary file .nfsXXX in NFS mount. The tst_rmdir() in cleanup() in diotest4.c complains about "Device or resource busy"

Close open fd after each sub-test.

Hi, Committed, thanks.

-Caspar

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list