Skip to contentSkip to conversation

generic: new case to test getcwd(2)

PATCH New Eryu Guan 1 participant 1 message Jun 11, 2014

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH v2 1/1 generic: new case to test getcwd(2)

The following kernel commit introduced a race condition that causes getcwd(2) to return "/" instead of correct path

232d2d6 dcache: Translating dentry into pathname without taking rename_lock

Jan Stancek hit it once when building ltp and Mikulas Patocka could hit it by running lvm2 test suite. Please refer to this thread

https://www.mail-archive.com/[email protected]/msg17896.html

These commits fixed the bug
ede4ceb prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts f650080 __dentry_path() fixes

Cc Artem Savkov <[email protected]>
Cc Jan Stancek <[email protected]>

---

This case was originally written by Artem Savkov and I made minor updates and ported it to xfstests.

v2:
- write detailed description and commit log
- reduce run time to 5s and add quick group
- return error when $CWD changes
- delete the code that removes $seqres.full
- run test in $TEST_DIR not xfstests dir

 .gitignore            |   1 +
 src/Makefile          |   2 +-
 src/t_getcwd.c        | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/028     |  58 ++++++++++++++++++++++++++++
 tests/generic/028.out |   2 +
 tests/generic/group   |   1 +
 6 files changed, 165 insertions(+), 1 deletion(-)
 create mode 100644 src/t_getcwd.c
 create mode 100755 tests/generic/028
 create mode 100644 tests/generic/028.out
.gitignore +1 -0
index 66e6ee8..5353439 100644
@@ -83,6 +83,7 @@
 /src/t_dir_offset
 /src/t_dir_offset2
 /src/t_futimens
+/src/t_getcwd
 /src/t_holes
 /src/t_immutable
 /src/t_mmap_writev
src/Makefile +1 -1
index d754048..7a7984a 100644
@@ -19,7 +19,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \
 	stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
-	renameat2
+	renameat2 t_getcwd
 
 SUBDIRS =
 
src/t_getcwd.c new file +102 -0

102 lines not on this page · raw message

tests/generic/028 new file +58 -0

58 lines not on this page · raw message

tests/generic/028.out new file +2 -0
new file mode 100644
index 0000000..2615f73
@@ -0,0 +1,2 @@
+QA output created by 028
+Silence is golden
tests/generic/group +1 -0
index e851c62..e822dfd 100644
@@ -30,6 +30,7 @@
 025 auto quick
 026 acl quick auto
 027 auto enospc
+028 auto quick
 053 acl repair auto quick
 062 attr udf auto quick
 068 other auto freeze dangerous stress
Signature · 1 line
1.9.3