Skip to content
This repository was archived by the owner on Feb 24, 2018. It is now read-only.

When IOR deletes an MPI-IO file, it might not delete it #17

Open
roblatham00 opened this issue Feb 19, 2014 · 3 comments
Open

When IOR deletes an MPI-IO file, it might not delete it #17

roblatham00 opened this issue Feb 19, 2014 · 3 comments

Comments

@roblatham00
Copy link

ROMIO allows you to prefix a file with something to specify a file system driver and override ROMIO's automatic detection. We might do this if, for example, PVFS is available, but the kernel module is not installed (pvfs:/path/to/pvfs/testfile), or if we simply wish to avoid the overhead of stat (ufs:/regular/unix/file_system)

When IOR attempts to remove a file with such a prefix, it makes a call to the POSIX routine access(), but does not remove the prefix before doing so. access() does not return F_OK, naturally, and so does not attempt to remove the file. IOR doesn't complain about this, so we ended up thinking we were running tests of "create a new file" when actually we were "reusing existing file."

@roblatham00
Copy link
Author

Here's a patch:

From fc6f65e81098075832e53d643e0187946b9e639d Mon Sep 17 00:00:00 2001
From: Rob Latham <[email protected]>
Date: Wed, 19 Feb 2014 10:16:08 -0600
Subject: [PATCH] A more MPI-IO friendly remove file

MPI-IO allows prefxing file names with something-something: (e.g. pvfs2:
or bglockless:). These prefixed file names, however, do not make sense
to posix calls like access().  So, if we must use access(), strip the
prefix first.
---
 src/ior.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/ior.c b/src/ior.c
index 163a59c5..6026414e 100644
--- a/src/ior.c
+++ b/src/ior.c
@@ -1254,6 +1254,12 @@ static void PrintRemoveTiming(double start, double finish, int rep)
 static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test)
 {
         int tmpRankOffset;
+        char *strippedFileName;
+
+        strippedFileName = strchr(testFileName, ':');
+        if (strippedFileName > testFileName + 1)
+                strippedFileName = strippedFileName + 1;
+
         if (filePerProc) {
                 /* in random tasks, delete own file */
                 if (test->reorderTasksRandom == TRUE) {
@@ -1261,7 +1267,7 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test)
                         rankOffset = 0;
                         GetTestFileName(testFileName, test);
                 }
-                if (access(testFileName, F_OK) == 0) {
+                if (access(strippedFileName, F_OK) == 0) {
                         backend->delete(testFileName, test);
                 }
                 if (test->reorderTasksRandom == TRUE) {
@@ -1269,7 +1275,7 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test)
                         GetTestFileName(testFileName, test);
                 }
         } else {
-                if ((rank == 0) && (access(testFileName, F_OK) == 0)) {
+                if ((rank == 0) && (access(strippedFileName, F_OK) == 0)) {
                         backend->delete(testFileName, test);
                 }
         }
-- 
1.8.3.2

@roblatham00
Copy link
Author

I should have added it was poor Florin Isaila [email protected] who encountered this and came up with the fix. I just updated the patch to apply onto master and to match IOR's coding conventions.

@roblatham00
Copy link
Author

I found a problem with the patch. See the pull request I'm just about to generate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant