Hi. As of now, if we run test cases which use the tst_checkpoint framework on NFS, they will fail with errors like:
creat07 0 TWARN : tst_tmpdir.c:206: tst_rmdir: rmobj(/tmpdir/ltp-0IVQPP0NK6/creigi0kV) failed: remove(/tmpdir/ltp-0IVQPP0NK6/creigi0kV) failed; errno=66: Directory not empty This happens because we keep the futex page mapped while tst_rmdir() is running. So on we need to unmap the page before tst_rmdir(). What do you think about the proposed solution? Thanks. Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmansk...@oracle.com> --- include/tst_checkpoint.h | 9 +++++++++ lib/tst_checkpoint.c | 19 ++++++++++++++++++- testcases/kernel/syscalls/creat/creat07.c | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-) diff --git a/include/tst_checkpoint.h b/include/tst_checkpoint.h index e6b8100..95a82b4 100644 --- a/include/tst_checkpoint.h +++ b/include/tst_checkpoint.h @@ -48,7 +48,16 @@ void tst_checkpoint_init(const char *file, const int lineno, void (*cleanup_fn)(void)); +/* + * Destroy the checkpoint. + * + * Call it once you are done with the syncronization. + */ +#define TST_CHECKPOINT_DESTROY(cleanup_fn) \ + tst_checkpoint_destroy(__FILE__, __LINE__, cleanup_fn) +void tst_checkpoint_destroy(const char *file, const int lineno, + void (*cleanup_fn)(void)); /* * Waits for wakeup. diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c index 79e49ac..2957f33 100644 --- a/lib/tst_checkpoint.c +++ b/lib/tst_checkpoint.c @@ -31,6 +31,7 @@ #include "safe_macros.h" #define DEFAULT_MSEC_TIMEOUT 10000 +#define CHECKPOINT_BASE_FILE "checkpoint_futex_base_file" typedef volatile uint32_t futex_t; @@ -67,7 +68,7 @@ void tst_checkpoint_init(const char *file, const int lineno, page_size = getpagesize(); - fd = SAFE_OPEN(cleanup_fn, "checkpoint_futex_base_file", + fd = SAFE_OPEN(cleanup_fn, CHECKPOINT_BASE_FILE, O_RDWR | O_CREAT, 0666); SAFE_FTRUNCATE(cleanup_fn, fd, page_size); @@ -78,6 +79,22 @@ void tst_checkpoint_init(const char *file, const int lineno, SAFE_CLOSE(cleanup_fn, fd); } +void tst_checkpoint_destroy(const char *file, const int lineno, + void (*cleanup_fn)(void)) +{ + if (!futexes || !page_size) { + tst_brkm(TBROK, cleanup_fn, + "%s: %d checkpoints are not initialized", + file, lineno); + } + + SAFE_MUNMAP(cleanup_fn, (void *)futexes, page_size); + + futexes = NULL; + + SAFE_UNLINK(cleanup_fn, CHECKPOINT_BASE_FILE); +} + int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout) { struct timespec timeout; diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c index c3cbd37..7b67d73 100644 --- a/testcases/kernel/syscalls/creat/creat07.c +++ b/testcases/kernel/syscalls/creat/creat07.c @@ -106,5 +106,7 @@ static void setup(void) static void cleanup(void) { + TST_CHECKPOINT_DESTROY(NULL); + tst_rmdir(); } -- 1.7.1 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list