Skip to content

Commit d56a5ca

Browse files
committed
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
2 parents dd55396 + ee6625a commit d56a5ca

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

fs/nfs/nfs4proc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,8 @@ static inline void nfs4_exclusive_attrset(struct nfs4_opendata *opendata,
27002700
sattr->ia_valid |= ATTR_MTIME;
27012701

27022702
/* Except MODE, it seems harmless of setting twice. */
2703-
if ((attrset[1] & FATTR4_WORD1_MODE))
2703+
if (opendata->o_arg.createmode != NFS4_CREATE_EXCLUSIVE &&
2704+
attrset[1] & FATTR4_WORD1_MODE)
27042705
sattr->ia_valid &= ~ATTR_MODE;
27052706

27062707
if (attrset[2] & FATTR4_WORD2_SECURITY_LABEL)
@@ -8490,6 +8491,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task,
84908491
goto out;
84918492
}
84928493

8494+
nfs4_sequence_free_slot(&lgp->res.seq_res);
84938495
err = nfs4_handle_exception(server, nfs4err, exception);
84948496
if (!status) {
84958497
if (exception->retry)

fs/nfs/nfs4state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
10911091
case -NFS4ERR_BADXDR:
10921092
case -NFS4ERR_RESOURCE:
10931093
case -NFS4ERR_NOFILEHANDLE:
1094+
case -NFS4ERR_MOVED:
10941095
/* Non-seqid mutating errors */
10951096
return;
10961097
};

fs/nfs/pnfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,10 +1200,10 @@ _pnfs_return_layout(struct inode *ino)
12001200

12011201
send = pnfs_prepare_layoutreturn(lo, &stateid, NULL);
12021202
spin_unlock(&ino->i_lock);
1203-
pnfs_free_lseg_list(&tmp_list);
12041203
if (send)
12051204
status = pnfs_send_layoutreturn(lo, &stateid, IOMODE_ANY, true);
12061205
out_put_layout_hdr:
1206+
pnfs_free_lseg_list(&tmp_list);
12071207
pnfs_put_layout_hdr(lo);
12081208
out:
12091209
dprintk("<-- %s status: %d\n", __func__, status);

include/linux/nfs4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ enum nfsstat4 {
282282

283283
static inline bool seqid_mutating_err(u32 err)
284284
{
285-
/* rfc 3530 section 8.1.5: */
285+
/* See RFC 7530, section 9.1.7 */
286286
switch (err) {
287287
case NFS4ERR_STALE_CLIENTID:
288288
case NFS4ERR_STALE_STATEID:
@@ -291,6 +291,7 @@ static inline bool seqid_mutating_err(u32 err)
291291
case NFS4ERR_BADXDR:
292292
case NFS4ERR_RESOURCE:
293293
case NFS4ERR_NOFILEHANDLE:
294+
case NFS4ERR_MOVED:
294295
return false;
295296
};
296297
return true;

include/linux/sunrpc/clnt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,6 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *);
216216
void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *);
217217
bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt,
218218
const struct sockaddr *sap);
219+
void rpc_cleanup_clids(void);
219220
#endif /* __KERNEL__ */
220221
#endif /* _LINUX_SUNRPC_CLNT_H */

net/sunrpc/clnt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ static int rpc_client_register(struct rpc_clnt *clnt,
336336

337337
static DEFINE_IDA(rpc_clids);
338338

339+
void rpc_cleanup_clids(void)
340+
{
341+
ida_destroy(&rpc_clids);
342+
}
343+
339344
static int rpc_alloc_clid(struct rpc_clnt *clnt)
340345
{
341346
int clid;

net/sunrpc/sunrpc_syms.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ init_sunrpc(void)
119119
static void __exit
120120
cleanup_sunrpc(void)
121121
{
122+
rpc_cleanup_clids();
122123
rpcauth_remove_module();
123124
cleanup_socket_xprt();
124125
svc_cleanup_xprt_sock();

0 commit comments

Comments
 (0)