Commit d56a5ca3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfs-for-4.10-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
 "Stable patches:
   - NFSv4.1: Fix a deadlock in layoutget
   - NFSv4 must not bump sequence ids on NFS4ERR_MOVED errors
   - NFSv4 Fix a regression with OPEN EXCLUSIVE4 mode
   - Fix a memory leak when removing the SUNRPC module

  Bugfixes:
   - Fix a reference leak in _pnfs_return_layout"

* tag 'nfs-for-4.10-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  pNFS: Fix a reference leak in _pnfs_return_layout
  nfs: Fix "Don't increment lock sequence ID after NFS4ERR_MOVED"
  SUNRPC: cleanup ida information when removing sunrpc module
  NFSv4.0: always send mode in SETATTR after EXCLUSIVE4
  nfs: Don't increment lock sequence ID after NFS4ERR_MOVED
  NFSv4.1: Fix a deadlock in layoutget
parents dd553962 ee6625a9
...@@ -2700,7 +2700,8 @@ static inline void nfs4_exclusive_attrset(struct nfs4_opendata *opendata, ...@@ -2700,7 +2700,8 @@ static inline void nfs4_exclusive_attrset(struct nfs4_opendata *opendata,
sattr->ia_valid |= ATTR_MTIME; sattr->ia_valid |= ATTR_MTIME;
/* Except MODE, it seems harmless of setting twice. */ /* Except MODE, it seems harmless of setting twice. */
if ((attrset[1] & FATTR4_WORD1_MODE)) if (opendata->o_arg.createmode != NFS4_CREATE_EXCLUSIVE &&
attrset[1] & FATTR4_WORD1_MODE)
sattr->ia_valid &= ~ATTR_MODE; sattr->ia_valid &= ~ATTR_MODE;
if (attrset[2] & FATTR4_WORD2_SECURITY_LABEL) if (attrset[2] & FATTR4_WORD2_SECURITY_LABEL)
...@@ -8490,6 +8491,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task, ...@@ -8490,6 +8491,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task,
goto out; goto out;
} }
nfs4_sequence_free_slot(&lgp->res.seq_res);
err = nfs4_handle_exception(server, nfs4err, exception); err = nfs4_handle_exception(server, nfs4err, exception);
if (!status) { if (!status) {
if (exception->retry) if (exception->retry)
......
...@@ -1091,6 +1091,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid) ...@@ -1091,6 +1091,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
case -NFS4ERR_BADXDR: case -NFS4ERR_BADXDR:
case -NFS4ERR_RESOURCE: case -NFS4ERR_RESOURCE:
case -NFS4ERR_NOFILEHANDLE: case -NFS4ERR_NOFILEHANDLE:
case -NFS4ERR_MOVED:
/* Non-seqid mutating errors */ /* Non-seqid mutating errors */
return; return;
}; };
......
...@@ -1200,10 +1200,10 @@ _pnfs_return_layout(struct inode *ino) ...@@ -1200,10 +1200,10 @@ _pnfs_return_layout(struct inode *ino)
send = pnfs_prepare_layoutreturn(lo, &stateid, NULL); send = pnfs_prepare_layoutreturn(lo, &stateid, NULL);
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
pnfs_free_lseg_list(&tmp_list);
if (send) if (send)
status = pnfs_send_layoutreturn(lo, &stateid, IOMODE_ANY, true); status = pnfs_send_layoutreturn(lo, &stateid, IOMODE_ANY, true);
out_put_layout_hdr: out_put_layout_hdr:
pnfs_free_lseg_list(&tmp_list);
pnfs_put_layout_hdr(lo); pnfs_put_layout_hdr(lo);
out: out:
dprintk("<-- %s status: %d\n", __func__, status); dprintk("<-- %s status: %d\n", __func__, status);
......
...@@ -282,7 +282,7 @@ enum nfsstat4 { ...@@ -282,7 +282,7 @@ enum nfsstat4 {
static inline bool seqid_mutating_err(u32 err) static inline bool seqid_mutating_err(u32 err)
{ {
/* rfc 3530 section 8.1.5: */ /* See RFC 7530, section 9.1.7 */
switch (err) { switch (err) {
case NFS4ERR_STALE_CLIENTID: case NFS4ERR_STALE_CLIENTID:
case NFS4ERR_STALE_STATEID: case NFS4ERR_STALE_STATEID:
...@@ -291,6 +291,7 @@ static inline bool seqid_mutating_err(u32 err) ...@@ -291,6 +291,7 @@ static inline bool seqid_mutating_err(u32 err)
case NFS4ERR_BADXDR: case NFS4ERR_BADXDR:
case NFS4ERR_RESOURCE: case NFS4ERR_RESOURCE:
case NFS4ERR_NOFILEHANDLE: case NFS4ERR_NOFILEHANDLE:
case NFS4ERR_MOVED:
return false; return false;
}; };
return true; return true;
......
...@@ -216,5 +216,6 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *); ...@@ -216,5 +216,6 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *);
void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *); void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *);
bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt,
const struct sockaddr *sap); const struct sockaddr *sap);
void rpc_cleanup_clids(void);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_SUNRPC_CLNT_H */ #endif /* _LINUX_SUNRPC_CLNT_H */
...@@ -336,6 +336,11 @@ static int rpc_client_register(struct rpc_clnt *clnt, ...@@ -336,6 +336,11 @@ static int rpc_client_register(struct rpc_clnt *clnt,
static DEFINE_IDA(rpc_clids); static DEFINE_IDA(rpc_clids);
void rpc_cleanup_clids(void)
{
ida_destroy(&rpc_clids);
}
static int rpc_alloc_clid(struct rpc_clnt *clnt) static int rpc_alloc_clid(struct rpc_clnt *clnt)
{ {
int clid; int clid;
......
...@@ -119,6 +119,7 @@ init_sunrpc(void) ...@@ -119,6 +119,7 @@ init_sunrpc(void)
static void __exit static void __exit
cleanup_sunrpc(void) cleanup_sunrpc(void)
{ {
rpc_cleanup_clids();
rpcauth_remove_module(); rpcauth_remove_module();
cleanup_socket_xprt(); cleanup_socket_xprt();
svc_cleanup_xprt_sock(); svc_cleanup_xprt_sock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment