Skip to content

Commit 29be634

Browse files
committed
Merge tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust: - Stable fix for a NFSv4.1 delegation and state recovery deadlock - Stable fix for a loop on irrecoverable errors when returning delegations - Fix a 3-way deadlock between layoutreturn, open, and state recovery - Update the MAINTAINERS file with contact information for Trond Myklebust - Close needs to handle NFS4ERR_ADMIN_REVOKED - Enabling v4.2 should not recompile nfsd and lockd - Fix a couple of compile warnings * tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: nfs: fix do_div() warning by instead using sector_div() MAINTAINERS: Update contact information for Trond Myklebust NFSv4.1: Prevent a 3-way deadlock between layoutreturn, open and state recovery SUNRPC: do not fail gss proc NULL calls with EACCES NFSv4: close needs to handle NFS4ERR_ADMIN_REVOKED NFSv4: Update list of irrecoverable errors on DELEGRETURN NFSv4 wait on recovery for async session errors NFS: Fix a warning in nfs_setsecurity NFS: Enabling v4.2 should not recompile nfsd and lockd
2 parents ef1e4e3 + 3873d06 commit 29be634

File tree

11 files changed

+54
-40
lines changed

11 files changed

+54
-40
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5980,10 +5980,10 @@ F: drivers/nfc/
59805980
F: include/linux/platform_data/pn544.h
59815981

59825982
NFS, SUNRPC, AND LOCKD CLIENTS
5983-
M: Trond Myklebust <Trond.Myklebust@netapp.com>
5983+
M: Trond Myklebust <trond.myklebust@primarydata.com>
59845984
L: linux-nfs@vger.kernel.org
59855985
W: http://client.linux-nfs.org
5986-
T: git git://git.linux-nfs.org/pub/linux/nfs-2.6.git
5986+
T: git git://git.linux-nfs.org/projects/trondmy/linux-nfs.git
59875987
S: Maintained
59885988
F: fs/lockd/
59895989
F: fs/nfs/

fs/nfs/blocklayout/blocklayout.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/nfs_fs.h>
3737
#include <linux/sunrpc/rpc_pipe_fs.h>
3838

39+
#include "../nfs4_fs.h"
3940
#include "../pnfs.h"
4041
#include "../netns.h"
4142

fs/nfs/blocklayout/extents.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
static inline sector_t normalize(sector_t s, int base)
4545
{
4646
sector_t tmp = s; /* Since do_div modifies its argument */
47-
return s - do_div(tmp, base);
47+
return s - sector_div(tmp, base);
4848
}
4949

5050
static inline sector_t normalize_up(sector_t s, int base)

fs/nfs/dns_resolve.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
4646
#include <linux/sunrpc/cache.h>
4747
#include <linux/sunrpc/svcauth.h>
4848
#include <linux/sunrpc/rpc_pipe_fs.h>
49+
#include <linux/nfs_fs.h>
4950

51+
#include "nfs4_fs.h"
5052
#include "dns_resolve.h"
5153
#include "cache_lib.h"
5254
#include "netns.h"

fs/nfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags)
312312
}
313313
EXPORT_SYMBOL_GPL(nfs4_label_alloc);
314314
#else
315-
void inline nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
315+
void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
316316
struct nfs4_label *label)
317317
{
318318
}

fs/nfs/internal.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,21 @@ extern const u32 nfs41_maxgetdevinfo_overhead;
269269
extern struct rpc_procinfo nfs4_procedures[];
270270
#endif
271271

272+
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
273+
extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
274+
static inline void nfs4_label_free(struct nfs4_label *label)
275+
{
276+
if (label) {
277+
kfree(label->label);
278+
kfree(label);
279+
}
280+
return;
281+
}
282+
#else
283+
static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
284+
static inline void nfs4_label_free(void *label) {}
285+
#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
286+
272287
/* proc.c */
273288
void nfs_close_context(struct nfs_open_context *ctx, int is_sync);
274289
extern struct nfs_client *nfs_init_client(struct nfs_client *clp,

fs/nfs/nfs4_fs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
#ifndef __LINUX_FS_NFS_NFS4_FS_H
1010
#define __LINUX_FS_NFS_NFS4_FS_H
1111

12+
#if defined(CONFIG_NFS_V4_2)
13+
#define NFS4_MAX_MINOR_VERSION 2
14+
#elif defined(CONFIG_NFS_V4_1)
15+
#define NFS4_MAX_MINOR_VERSION 1
16+
#else
17+
#define NFS4_MAX_MINOR_VERSION 0
18+
#endif
19+
1220
#if IS_ENABLED(CONFIG_NFS_V4)
1321

1422
#define NFS4_MAX_LOOP_ON_RECOVER (10)

fs/nfs/nfs4proc.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,19 +2518,22 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
25182518
calldata->roc_barrier);
25192519
nfs_set_open_stateid(state, &calldata->res.stateid, 0);
25202520
renew_lease(server, calldata->timestamp);
2521-
nfs4_close_clear_stateid_flags(state,
2522-
calldata->arg.fmode);
25232521
break;
2522+
case -NFS4ERR_ADMIN_REVOKED:
25242523
case -NFS4ERR_STALE_STATEID:
25252524
case -NFS4ERR_OLD_STATEID:
25262525
case -NFS4ERR_BAD_STATEID:
25272526
case -NFS4ERR_EXPIRED:
25282527
if (calldata->arg.fmode == 0)
25292528
break;
25302529
default:
2531-
if (nfs4_async_handle_error(task, server, state) == -EAGAIN)
2530+
if (nfs4_async_handle_error(task, server, state) == -EAGAIN) {
25322531
rpc_restart_call_prepare(task);
2532+
goto out_release;
2533+
}
25332534
}
2535+
nfs4_close_clear_stateid_flags(state, calldata->arg.fmode);
2536+
out_release:
25342537
nfs_release_seqid(calldata->arg.seqid);
25352538
nfs_refresh_inode(calldata->inode, calldata->res.fattr);
25362539
dprintk("%s: done, ret = %d!\n", __func__, task->tk_status);
@@ -4802,7 +4805,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
48024805
dprintk("%s ERROR %d, Reset session\n", __func__,
48034806
task->tk_status);
48044807
nfs4_schedule_session_recovery(clp->cl_session, task->tk_status);
4805-
goto restart_call;
4808+
goto wait_on_recovery;
48064809
#endif /* CONFIG_NFS_V4_1 */
48074810
case -NFS4ERR_DELAY:
48084811
nfs_inc_server_stats(server, NFSIOS_DELAY);
@@ -4987,11 +4990,17 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
49874990

49884991
trace_nfs4_delegreturn_exit(&data->args, &data->res, task->tk_status);
49894992
switch (task->tk_status) {
4990-
case -NFS4ERR_STALE_STATEID:
4991-
case -NFS4ERR_EXPIRED:
49924993
case 0:
49934994
renew_lease(data->res.server, data->timestamp);
49944995
break;
4996+
case -NFS4ERR_ADMIN_REVOKED:
4997+
case -NFS4ERR_DELEG_REVOKED:
4998+
case -NFS4ERR_BAD_STATEID:
4999+
case -NFS4ERR_OLD_STATEID:
5000+
case -NFS4ERR_STALE_STATEID:
5001+
case -NFS4ERR_EXPIRED:
5002+
task->tk_status = 0;
5003+
break;
49955004
default:
49965005
if (nfs4_async_handle_error(task, data->res.server, NULL) ==
49975006
-EAGAIN) {
@@ -7589,7 +7598,14 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
75897598
return;
75907599

75917600
server = NFS_SERVER(lrp->args.inode);
7592-
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
7601+
switch (task->tk_status) {
7602+
default:
7603+
task->tk_status = 0;
7604+
case 0:
7605+
break;
7606+
case -NFS4ERR_DELAY:
7607+
if (nfs4_async_handle_error(task, server, NULL) != -EAGAIN)
7608+
break;
75937609
rpc_restart_call_prepare(task);
75947610
return;
75957611
}

include/linux/nfs4.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,6 @@ enum lock_type4 {
413413
#define NFS4_VERSION 4
414414
#define NFS4_MINOR_VERSION 0
415415

416-
#if defined(CONFIG_NFS_V4_2)
417-
#define NFS4_MAX_MINOR_VERSION 2
418-
#else
419-
#if defined(CONFIG_NFS_V4_1)
420-
#define NFS4_MAX_MINOR_VERSION 1
421-
#else
422-
#define NFS4_MAX_MINOR_VERSION 0
423-
#endif /* CONFIG_NFS_V4_1 */
424-
#endif /* CONFIG_NFS_V4_2 */
425-
426416
#define NFS4_DEBUG 1
427417

428418
/* Index of predefined Linux client operations */

include/linux/nfs_fs.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -506,24 +506,6 @@ extern const struct inode_operations nfs_referral_inode_operations;
506506
extern int nfs_mountpoint_expiry_timeout;
507507
extern void nfs_release_automount_timer(void);
508508

509-
/*
510-
* linux/fs/nfs/nfs4proc.c
511-
*/
512-
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
513-
extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
514-
static inline void nfs4_label_free(struct nfs4_label *label)
515-
{
516-
if (label) {
517-
kfree(label->label);
518-
kfree(label);
519-
}
520-
return;
521-
}
522-
#else
523-
static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
524-
static inline void nfs4_label_free(void *label) {}
525-
#endif
526-
527509
/*
528510
* linux/fs/nfs/unlink.c
529511
*/

0 commit comments

Comments
 (0)