vol: nt_open should not create missing directories
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 20 Jan 2011 07:11:57 +0000 (02:11 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 20 Jan 2011 13:40:59 +0000 (05:40 -0800)
Revert the prior change that added directory creation
to nt_open().  nt_open() should fail and the caller should
create the directories.  Failure to do so results in an
incomplete tree which confuses the salvager.

Change-Id: Ieb2a05baada2531dad1869e95823fe2006bdc2c6
Reviewed-on: http://gerrit.openafs.org/3709
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/vol/ntops.c

index 651ba29..589a61d 100644 (file)
@@ -120,39 +120,6 @@ nt_open(char *name, int flags, int mode)
     fh = CreateFile(name, nt_access, nt_share, NULL, nt_create, FandA, NULL);
     if (fh == INVALID_HANDLE_VALUE) {
         DWORD gle = GetLastError();
-
-        if (gle == ERROR_PATH_NOT_FOUND) {
-            /*
-             * one or more of the directories in the path
-             * does not exist.  We must create them and
-             * try again to create the file.
-             */
-            char * p;
-
-            for (p=name; *p && *p != OS_DIRSEPC; p++);
-            while (*p == OS_DIRSEPC) p++;    /* ignore the first dirsep */
-            for (; *p; p++) {
-                if (*p == OS_DIRSEPC) {
-                    *p = '\0';
-                    if (CreateDirectory(name, NULL))
-                        gle = 0;
-                    else
-                        gle = GetLastError();
-                    *p = OS_DIRSEPC;
-                    if (gle != ERROR_SUCCESS &&
-                         gle != ERROR_ALREADY_EXISTS) {
-                        /* The directory creation failed. */
-                        fh = INVALID_FD;
-                        break;
-                    } else {
-                        while (*(p+1) == OS_DIRSEPC) p++;
-                    }
-                }
-            }
-
-            if (!*p) /* successful creation of the path */
-                goto retry;
-        }
         errno = nterr_nt2unix(gle, EBADF);
     }
     return fh;