nfs4: Setting owner and owner group at creation is not needed
This commit is contained in:
@@ -403,7 +403,6 @@ NFS4Inode::CreateFile(const char* name, int mode, int perms, OpenState* state,
|
|||||||
bool confirm;
|
bool confirm;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
bool badOwner = false;
|
|
||||||
uint32 sequence = fFileSystem->OpenOwnerSequenceLock();
|
uint32 sequence = fFileSystem->OpenOwnerSequenceLock();
|
||||||
do {
|
do {
|
||||||
state->fClientID = fFileSystem->NFSServer()->ClientId();
|
state->fClientID = fFileSystem->NFSServer()->ClientId();
|
||||||
@@ -414,7 +413,7 @@ NFS4Inode::CreateFile(const char* name, int mode, int perms, OpenState* state,
|
|||||||
|
|
||||||
req.PutFH(fInfo.fHandle);
|
req.PutFH(fInfo.fHandle);
|
||||||
|
|
||||||
AttrValue cattr[4];
|
AttrValue cattr[2];
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
if ((mode & O_TRUNC) == O_TRUNC) {
|
if ((mode & O_TRUNC) == O_TRUNC) {
|
||||||
cattr[i].fAttribute = FATTR4_SIZE;
|
cattr[i].fAttribute = FATTR4_SIZE;
|
||||||
@@ -427,20 +426,6 @@ NFS4Inode::CreateFile(const char* name, int mode, int perms, OpenState* state,
|
|||||||
cattr[i].fData.fValue32 = perms;
|
cattr[i].fData.fValue32 = perms;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (!badOwner && fFileSystem->IsAttrSupported(FATTR4_OWNER)) {
|
|
||||||
cattr[i].fAttribute = FATTR4_OWNER;
|
|
||||||
cattr[i].fFreePointer = true;
|
|
||||||
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!badOwner && 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, sequence, sModeToAccess(mode),
|
req.Open(CLAIM_NULL, sequence, sModeToAccess(mode),
|
||||||
state->fClientID, OPEN4_CREATE, fFileSystem->OpenOwner(), name,
|
state->fClientID, OPEN4_CREATE, fFileSystem->OpenOwner(), name,
|
||||||
cattr, i, (mode & O_EXCL) == O_EXCL);
|
cattr, i, (mode & O_EXCL) == O_EXCL);
|
||||||
@@ -462,10 +447,6 @@ NFS4Inode::CreateFile(const char* name, int mode, int perms, OpenState* state,
|
|||||||
|
|
||||||
sequence += IncrementSequence(reply.NFS4Error());
|
sequence += IncrementSequence(reply.NFS4Error());
|
||||||
|
|
||||||
if (reply.NFS4Error() == NFS4ERR_BADOWNER) {
|
|
||||||
badOwner = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (HandleErrors(reply.NFS4Error(), serv, NULL, state, &sequence))
|
if (HandleErrors(reply.NFS4Error(), serv, NULL, state, &sequence))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -735,8 +716,6 @@ status_t
|
|||||||
NFS4Inode::CreateObject(const char* name, const char* path, int mode,
|
NFS4Inode::CreateObject(const char* name, const char* path, int mode,
|
||||||
FileType type, ChangeInfo* changeInfo, uint64* fileID, FileHandle* handle)
|
FileType type, ChangeInfo* changeInfo, uint64* fileID, FileHandle* handle)
|
||||||
{
|
{
|
||||||
bool badOwner = false;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
RPC::Server* serv = fFileSystem->Server();
|
RPC::Server* serv = fFileSystem->Server();
|
||||||
Request request(serv);
|
Request request(serv);
|
||||||
@@ -745,26 +724,12 @@ NFS4Inode::CreateObject(const char* name, const char* path, int mode,
|
|||||||
req.PutFH(fInfo.fHandle);
|
req.PutFH(fInfo.fHandle);
|
||||||
|
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
AttrValue cattr[3];
|
AttrValue cattr[1];
|
||||||
cattr[i].fAttribute = FATTR4_MODE;
|
cattr[i].fAttribute = FATTR4_MODE;
|
||||||
cattr[i].fFreePointer = false;
|
cattr[i].fFreePointer = false;
|
||||||
cattr[i].fData.fValue32 = mode;
|
cattr[i].fData.fValue32 = mode;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (!badOwner && fFileSystem->IsAttrSupported(FATTR4_OWNER)) {
|
|
||||||
cattr[i].fAttribute = FATTR4_OWNER;
|
|
||||||
cattr[i].fFreePointer = true;
|
|
||||||
cattr[i].fData.fPointer = gIdMapper->GetOwner(getuid());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!badOwner && fFileSystem->IsAttrSupported(FATTR4_OWNER_GROUP)) {
|
|
||||||
cattr[i].fAttribute = FATTR4_OWNER_GROUP;
|
|
||||||
cattr[i].fFreePointer = true;
|
|
||||||
cattr[i].fData.fPointer = gIdMapper->GetOwnerGroup(getgid());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NF4DIR:
|
case NF4DIR:
|
||||||
req.Create(NF4DIR, name, cattr, i);
|
req.Create(NF4DIR, name, cattr, i);
|
||||||
@@ -786,10 +751,6 @@ NFS4Inode::CreateObject(const char* name, const char* path, int mode,
|
|||||||
|
|
||||||
ReplyInterpreter& reply = request.Reply();
|
ReplyInterpreter& reply = request.Reply();
|
||||||
|
|
||||||
if (reply.NFS4Error() == NFS4ERR_BADOWNER) {
|
|
||||||
badOwner = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (HandleErrors(reply.NFS4Error(), serv))
|
if (HandleErrors(reply.NFS4Error(), serv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user