nfs4: Do not attempt to set owner, owner_group when not supported

This commit is contained in:
Pawel Dziepak
2012-07-03 21:57:08 +02:00
parent b2cea80ce5
commit ed097dd0a2
3 changed files with 36 additions and 24 deletions
+12 -8
View File
@@ -353,15 +353,19 @@ Inode::CreateLink(const char* name, const char* path, int mode)
cattr[i].fData.fValue32 = mode;
i++;
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER)) {
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
}
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER_GROUP)) {
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
}
req.Create(NF4LNK, name, cattr, i, path);
@@ -34,15 +34,19 @@ Inode::CreateDir(const char* name, int mode)
cattr[i].fData.fValue32 = mode;
i++;
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER)) {
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
}
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER_GROUP)) {
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
}
req.Create(NF4DIR, name, cattr, i);
@@ -91,15 +91,19 @@ Inode::Create(const char* name, int mode, int perms, OpenFileCookie* cookie,
cattr[i].fData.fValue32 = perms;
i++;
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER)) {
cattr[i].fAttribute = FATTR4_OWNER;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
i++;
}
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
if (fFilesystem->IsAttrSupported(FATTR4_OWNER_GROUP)) {
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
cattr[i].fFreePointer = true;
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
i++;
}
req.Open(CLAIM_NULL, cookie->fSequence++, sModeToAccess(mode),
cookie->fClientId, OPEN4_CREATE, cookie->fOwnerId, name, cattr,