lock_ObtainRead(&scp->bufCreateLock);
code = buf_Get(scp, &thyper, &bufferp);
lock_ReleaseRead(&scp->bufCreateLock);
+ if (code) {
+ /* if buf_Get() fails we do not have a buffer object to lock */
+ bufferp = NULL;
+ break;
+ }
lock_ObtainMutex(&bufferp->mx);
- if (code)
- break;
bufferOffset = thyper;
/* now get the data in the cache */
return CM_ERROR_NOSUCHFILE;
}
else { /* nonexistent dir on freelance root, so add it */
+ char fullname[200] = ".";
+ int found = 0;
+
osi_Log1(afsd_logp,"cm_Lookup adding mount for non-existent directory: %s",
osi_LogSaveString(afsd_logp,namep));
- code = cm_FreelanceAddMount(namep, namep, "root.cell.", namep[0] == '.', &rock.fid);
- if (code < 0) { /* add mount point failed, so give up */
+ if (namep[0] == '.') {
+ if (cm_GetCell_Gen(&namep[1], &fullname[1], CM_FLAG_CREATE)) {
+ found = 1;
+ if ( stricmp(&namep[1], &fullname[1]) )
+ code = cm_FreelanceAddSymlink(namep, fullname, &rock.fid);
+ else
+ code = cm_FreelanceAddMount(namep, &fullname[1], "root.cell.", 1, &rock.fid);
+ }
+ } else {
+ if (cm_GetCell_Gen(namep, fullname, CM_FLAG_CREATE)) {
+ found = 1;
+ if ( stricmp(namep, fullname) )
+ code = cm_FreelanceAddSymlink(namep, fullname, &rock.fid);
+ else
+ code = cm_FreelanceAddMount(namep, fullname, "root.cell.", 0, &rock.fid);
+ }
+ }
+ if (!found || code < 0) { /* add mount point failed, so give up */
if (flags & CM_FLAG_CHECKPATH)
return CM_ERROR_NOSUCHPATH;
else