aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-04-16 18:42:34 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-04-16 18:58:26 -0400
commit549b19cc9f31e8fdda317625d564bac0052a3328 (patch)
tree4906e15f9d45a89cb6ea548837bc0cc6eee1f75f /fs/nfs/nfs4xdr.c
parent98f98cf571b7b1f34683455a61dae9f35e7222a1 (diff)
NFSv4: Record the OPEN create mode used in the nfs4_opendata structure
If we're doing NFSv4.1 against a server that has persistent sessions, then we should not need to call SETATTR in order to reset the file attributes immediately after doing an exclusive create. Note that since the create mode depends on the type of session that has been negotiated with the server, we should not choose the mode until after we've got a session slot. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 0b744895b9e1..fef71cbec501 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1366,33 +1366,28 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
1366 1366
1367static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) 1367static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
1368{ 1368{
1369 struct iattr dummy;
1369 __be32 *p; 1370 __be32 *p;
1370 struct nfs_client *clp;
1371 1371
1372 p = reserve_space(xdr, 4); 1372 p = reserve_space(xdr, 4);
1373 switch(arg->open_flags & O_EXCL) { 1373 switch(arg->createmode) {
1374 case 0: 1374 case NFS4_CREATE_UNCHECKED:
1375 *p = cpu_to_be32(NFS4_CREATE_UNCHECKED); 1375 *p = cpu_to_be32(NFS4_CREATE_UNCHECKED);
1376 encode_attrs(xdr, arg->u.attrs, arg->server); 1376 encode_attrs(xdr, arg->u.attrs, arg->server);
1377 break; 1377 break;
1378 default: 1378 case NFS4_CREATE_GUARDED:
1379 clp = arg->server->nfs_client; 1379 *p = cpu_to_be32(NFS4_CREATE_GUARDED);
1380 if (clp->cl_mvops->minor_version > 0) { 1380 encode_attrs(xdr, arg->u.attrs, arg->server);
1381 if (nfs4_has_persistent_session(clp)) { 1381 break;
1382 *p = cpu_to_be32(NFS4_CREATE_GUARDED); 1382 case NFS4_CREATE_EXCLUSIVE:
1383 encode_attrs(xdr, arg->u.attrs, arg->server); 1383 *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
1384 } else { 1384 encode_nfs4_verifier(xdr, &arg->u.verifier);
1385 struct iattr dummy; 1385 break;
1386 1386 case NFS4_CREATE_EXCLUSIVE4_1:
1387 *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1); 1387 *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1);
1388 encode_nfs4_verifier(xdr, &arg->u.verifier); 1388 encode_nfs4_verifier(xdr, &arg->u.verifier);
1389 dummy.ia_valid = 0; 1389 dummy.ia_valid = 0;
1390 encode_attrs(xdr, &dummy, arg->server); 1390 encode_attrs(xdr, &dummy, arg->server);
1391 }
1392 } else {
1393 *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
1394 encode_nfs4_verifier(xdr, &arg->u.verifier);
1395 }
1396 } 1391 }
1397} 1392}
1398 1393