Merge tag 'nfs-for-3.12-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Sep 2013 20:39:34 +0000 (13:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Sep 2013 20:39:34 +0000 (13:39 -0700)
Pull NFS client bugfixes (part 2) from Trond Myklebust:
 "Bugfixes:
   - Fix a few credential reference leaks resulting from the
     SP4_MACH_CRED NFSv4.1 state protection code.
   - Fix the SUNRPC bloatometer footprint: convert a 256K hashtable into
     the intended 64 byte structure.
   - Fix a long standing XDR issue with FREE_STATEID
   - Fix a potential WARN_ON spamming issue
   - Fix a missing dprintk() kuid conversion

  New features:
   - Enable the NFSv4.1 state protection support for the WRITE and
     COMMIT operations"

* tag 'nfs-for-3.12-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  SUNRPC: No, I did not intend to create a 256KiB hashtable
  sunrpc: Add missing kuids conversion for printing
  NFSv4.1: sp4_mach_cred: WARN_ON -> WARN_ON_ONCE
  NFSv4.1: sp4_mach_cred: no need to ref count creds
  NFSv4.1: fix SECINFO* use of put_rpccred
  NFSv4.1: sp4_mach_cred: ask for WRITE and COMMIT
  NFSv4.1 fix decode_free_stateid

1  2 
fs/nfs/nfs4proc.c

diff --combined fs/nfs/nfs4proc.c
@@@ -3196,13 -3196,15 +3196,13 @@@ struct rpc_clnt 
  nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
                            struct nfs_fh *fhandle, struct nfs_fattr *fattr)
  {
 +      struct rpc_clnt *client = NFS_CLIENT(dir);
        int status;
 -      struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir));
  
        status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
 -      if (status < 0) {
 -              rpc_shutdown_client(client);
 +      if (status < 0)
                return ERR_PTR(status);
 -      }
 -      return client;
 +      return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
  }
  
  static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
@@@ -6001,10 -6003,12 +6001,12 @@@ static int _nfs4_proc_secinfo(struct in
                .rpc_resp = &res,
        };
        struct rpc_clnt *clnt = NFS_SERVER(dir)->client;
+       struct rpc_cred *cred = NULL;
  
        if (use_integrity) {
                clnt = NFS_SERVER(dir)->nfs_client->cl_rpcclient;
-               msg.rpc_cred = nfs4_get_clid_cred(NFS_SERVER(dir)->nfs_client);
+               cred = nfs4_get_clid_cred(NFS_SERVER(dir)->nfs_client);
+               msg.rpc_cred = cred;
        }
  
        dprintk("NFS call  secinfo %s\n", name->name);
                                &res.seq_res, 0);
        dprintk("NFS reply  secinfo: %d\n", status);
  
-       if (msg.rpc_cred)
-               put_rpccred(msg.rpc_cred);
+       if (cred)
+               put_rpccred(cred);
  
        return status;
  }
@@@ -6151,11 -6155,13 +6153,13 @@@ static const struct nfs41_state_protect
        },
        .allow.u.words = {
                [0] = 1 << (OP_CLOSE) |
-                     1 << (OP_LOCKU),
+                     1 << (OP_LOCKU) |
+                     1 << (OP_COMMIT),
                [1] = 1 << (OP_SECINFO - 32) |
                      1 << (OP_SECINFO_NO_NAME - 32) |
                      1 << (OP_TEST_STATEID - 32) |
-                     1 << (OP_FREE_STATEID - 32)
+                     1 << (OP_FREE_STATEID - 32) |
+                     1 << (OP_WRITE - 32)
        }
  };
  
@@@ -7496,11 -7502,13 +7500,13 @@@ _nfs41_proc_secinfo_no_name(struct nfs_
                .rpc_resp = &res,
        };
        struct rpc_clnt *clnt = server->client;
+       struct rpc_cred *cred = NULL;
        int status;
  
        if (use_integrity) {
                clnt = server->nfs_client->cl_rpcclient;
-               msg.rpc_cred = nfs4_get_clid_cred(server->nfs_client);
+               cred = nfs4_get_clid_cred(server->nfs_client);
+               msg.rpc_cred = cred;
        }
  
        dprintk("--> %s\n", __func__);
                                &res.seq_res, 0);
        dprintk("<-- %s status=%d\n", __func__, status);
  
-       if (msg.rpc_cred)
-               put_rpccred(msg.rpc_cred);
+       if (cred)
+               put_rpccred(cred);
  
        return status;
  }