Skip to content

Commit 7449f86

Browse files
committed
Merge tag 'nfs-for-7.0-1' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client updates from Anna Schumaker: "New Features: - Use an LRU list for returning unused delegations - Introduce a KConfig option to disable NFS v4.0 and make NFS v4.1 the default Bugfixes: - NFS/localio: - Handle short writes by retrying - Prevent direct reclaim recursion into NFS via nfs_writepages - Use GFP_NOIO and non-memreclaim workqueue in nfs_local_commit - Remove -EAGAIN handling in nfs_local_doio() - pNFS: fix a missing wake up while waiting on NFS_LAYOUT_DRAIN - fs/nfs: Fix a readdir slow-start regression - SUNRPC: fix gss_auth kref leak in gss_alloc_msg error path Other cleanups and improvements: - A few other NFS/localio cleanups - Various other delegation handling cleanups from Christoph - Unify security_inode_listsecurity() calls - Improvements to NFSv4 lease handling - Clean up SUNRPC *_debug fields when CONFIG_SUNRPC_DEBUG is not set" * tag 'nfs-for-7.0-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (60 commits) SUNRPC: fix gss_auth kref leak in gss_alloc_msg error path nfs: nfs4proc: Convert comma to semicolon SUNRPC: Change list definition method sunrpc: rpc_debug and others are defined even if CONFIG_SUNRPC_DEBUG unset NFSv4: limit lease period in nfs4_set_lease_period() NFSv4: pass lease period in seconds to nfs4_set_lease_period() nfs: unify security_inode_listsecurity() calls fs/nfs: Fix readdir slow-start regression pNFS: fix a missing wake up while waiting on NFS_LAYOUT_DRAIN NFS: fix delayed delegation return handling NFS: simplify error handling in nfs_end_delegation_return NFS: fold nfs_abort_delegation_return into nfs_end_delegation_return NFS: remove the delegation == NULL check in nfs_end_delegation_return NFS: use bool for the issync argument to nfs_end_delegation_return NFS: return void from ->return_delegation NFS: return void from nfs4_inode_make_writeable NFS: Merge CONFIG_NFS_V4_1 with CONFIG_NFS_V4 NFS: Add a way to disable NFS v4.0 via KConfig NFS: Move sequence slot operations into minorversion operations NFS: Pass a struct nfs_client to nfs4_init_sequence() ...
2 parents 8429538 + dd2fdc3 commit 7449f86

41 files changed

Lines changed: 1367 additions & 1551 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fs/nfs/Kconfig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ config NFS_V4
7878
tristate "NFS client support for NFS version 4"
7979
depends on NFS_FS
8080
select KEYS
81+
select SUNRPC_BACKCHANNEL
8182
help
82-
This option enables support for version 4 of the NFS protocol
83-
(RFC 3530) in the kernel's NFS client.
83+
This option enables support for version 4.1 of the NFS protocol
84+
(RFC 5661) in the kernel's NFS client.
8485

8586
To mount NFS servers using NFSv4, you also need to install user
8687
space programs which can be found in the Linux nfs-utils package,
@@ -96,19 +97,18 @@ config NFS_SWAP
9697
help
9798
This option enables swapon to work on files located on NFS mounts.
9899

99-
config NFS_V4_1
100-
bool "NFS client support for NFSv4.1"
100+
config NFS_V4_0
101+
bool "NFS client support for NFSv4.0"
101102
depends on NFS_V4
102-
select SUNRPC_BACKCHANNEL
103103
help
104-
This option enables support for minor version 1 of the NFSv4 protocol
105-
(RFC 5661) in the kernel's NFS client.
104+
This option enables support for minor version 0 of the NFSv4 protocol
105+
(RFC 3530) in the kernel's NFS client.
106106

107107
If unsure, say N.
108108

109109
config NFS_V4_2
110110
bool "NFS client support for NFSv4.2"
111-
depends on NFS_V4_1
111+
depends on NFS_V4
112112
help
113113
This option enables support for minor version 2 of the NFSv4 protocol
114114
in the kernel's NFS client.
@@ -117,22 +117,22 @@ config NFS_V4_2
117117

118118
config PNFS_FILE_LAYOUT
119119
tristate
120-
depends on NFS_V4_1
120+
depends on NFS_V4
121121
default NFS_V4
122122

123123
config PNFS_BLOCK
124124
tristate
125-
depends on NFS_V4_1 && BLK_DEV_DM
125+
depends on NFS_V4 && BLK_DEV_DM
126126
default NFS_V4
127127

128128
config PNFS_FLEXFILE_LAYOUT
129129
tristate
130-
depends on NFS_V4_1
130+
depends on NFS_V4
131131
default NFS_V4
132132

133133
config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
134134
string "NFSv4.1 Implementation ID Domain"
135-
depends on NFS_V4_1
135+
depends on NFS_V4
136136
default "kernel.org"
137137
help
138138
This option defines the domain portion of the implementation ID that
@@ -144,7 +144,7 @@ config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
144144

145145
config NFS_V4_1_MIGRATION
146146
bool "NFSv4.1 client support for migration"
147-
depends on NFS_V4_1
147+
depends on NFS_V4
148148
default n
149149
help
150150
This option makes the NFS client advertise to NFSv4.1 servers that

fs/nfs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ CFLAGS_nfs4trace.o += -I$(src)
2727
nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
2828
delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
2929
nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
30-
dns_resolve.o nfs4trace.o
30+
dns_resolve.o nfs4trace.o pnfs.o pnfs_dev.o pnfs_nfs.o
3131
nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
3232
nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o
33-
nfsv4-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o pnfs_nfs.o
33+
nfsv4-$(CONFIG_NFS_V4_0) += nfs40client.o nfs40proc.o
3434
nfsv4-$(CONFIG_NFS_V4_2) += nfs42proc.o nfs42xattr.o
3535

3636
obj-$(CONFIG_PNFS_FILE_LAYOUT) += filelayout/

fs/nfs/callback.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ nfs4_callback_svc(void *vrqstp)
8787
return 0;
8888
}
8989

90-
#if defined(CONFIG_NFS_V4_1)
9190
static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
9291
struct svc_serv *serv)
9392
{
@@ -98,12 +97,6 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
9897
*/
9998
xprt->bc_serv = serv;
10099
}
101-
#else
102-
static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
103-
struct svc_serv *serv)
104-
{
105-
}
106-
#endif /* CONFIG_NFS_V4_1 */
107100

108101
static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
109102
struct svc_serv *serv)
@@ -157,7 +150,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
157150
}
158151

159152
ret = 0;
160-
if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
153+
if (minorversion == 0)
161154
ret = nfs4_callback_up_net(serv, net);
162155
else if (xprt->ops->bc_setup)
163156
set_bc_enabled(serv);
@@ -198,10 +191,6 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
198191
cb_info->users);
199192

200193
threadfn = nfs4_callback_svc;
201-
#if !defined(CONFIG_NFS_V4_1)
202-
if (minorversion)
203-
return ERR_PTR(-ENOTSUPP);
204-
#endif
205194
serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE,
206195
threadfn);
207196
if (!serv) {

fs/nfs/callback.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ struct cb_recallargs {
6565
uint32_t truncate;
6666
};
6767

68-
#if defined(CONFIG_NFS_V4_1)
69-
7068
struct referring_call {
7169
uint32_t rc_sequenceid;
7270
uint32_t rc_slotid;
@@ -168,7 +166,6 @@ struct cb_notify_lock_args {
168166

169167
extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
170168
struct cb_process_state *cps);
171-
#endif /* CONFIG_NFS_V4_1 */
172169
#ifdef CONFIG_NFS_V4_2
173170
struct cb_offloadargs {
174171
struct nfs_fh coa_fh;

fs/nfs/callback_proc.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,18 @@ __be32 nfs4_callback_getattr(void *argp, void *resp,
5151
-ntohl(res->status));
5252
goto out;
5353
}
54-
rcu_read_lock();
54+
5555
delegation = nfs4_get_valid_delegation(inode);
56-
if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0)
56+
if (!delegation)
5757
goto out_iput;
58-
res->size = i_size_read(inode);
58+
if ((delegation->type & FMODE_WRITE) == 0) {
59+
nfs_put_delegation(delegation);
60+
goto out_iput;
61+
}
5962
res->change_attr = delegation->change_attr;
63+
nfs_put_delegation(delegation);
64+
65+
res->size = i_size_read(inode);
6066
if (nfs_have_writebacks(inode))
6167
res->change_attr++;
6268
res->atime = inode_get_atime(inode);
@@ -71,7 +77,6 @@ __be32 nfs4_callback_getattr(void *argp, void *resp,
7177
FATTR4_WORD2_TIME_DELEG_MODIFY) & args->bitmap[2];
7278
res->status = 0;
7379
out_iput:
74-
rcu_read_unlock();
7580
trace_nfs4_cb_getattr(cps->clp, &args->fh, inode, -ntohl(res->status));
7681
nfs_iput_and_deactive(inode);
7782
out:
@@ -121,8 +126,6 @@ __be32 nfs4_callback_recall(void *argp, void *resp,
121126
return res;
122127
}
123128

124-
#if defined(CONFIG_NFS_V4_1)
125-
126129
/*
127130
* Lookup a layout inode by stateid
128131
*
@@ -693,7 +696,6 @@ __be32 nfs4_callback_notify_lock(void *argp, void *resp,
693696

694697
return htonl(NFS4_OK);
695698
}
696-
#endif /* CONFIG_NFS_V4_1 */
697699
#ifdef CONFIG_NFS_V4_2
698700
static void nfs4_copy_cb_args(struct nfs4_copy_state *cp_state,
699701
struct cb_offloadargs *args)

fs/nfs/callback_xdr.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
(2 + 2 + 3 + 3 + 3 + 3 + 3) * 4)
3131
#define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
3232

33-
#if defined(CONFIG_NFS_V4_1)
3433
#define CB_OP_LAYOUTRECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
3534
#define CB_OP_DEVICENOTIFY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
3635
#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
@@ -39,7 +38,6 @@
3938
#define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
4039
#define CB_OP_RECALLSLOT_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
4140
#define CB_OP_NOTIFY_LOCK_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
42-
#endif /* CONFIG_NFS_V4_1 */
4341
#ifdef CONFIG_NFS_V4_2
4442
#define CB_OP_OFFLOAD_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
4543
#endif /* CONFIG_NFS_V4_2 */
@@ -205,7 +203,6 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp,
205203
return decode_fh(xdr, &args->fh);
206204
}
207205

208-
#if defined(CONFIG_NFS_V4_1)
209206
static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
210207
{
211208
stateid->type = NFS4_LAYOUT_STATEID_TYPE;
@@ -521,7 +518,6 @@ static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
521518
return decode_lockowner(xdr, args);
522519
}
523520

524-
#endif /* CONFIG_NFS_V4_1 */
525521
#ifdef CONFIG_NFS_V4_2
526522
static __be32 decode_write_response(struct xdr_stream *xdr,
527523
struct cb_offloadargs *args)
@@ -747,8 +743,6 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
747743
return status;
748744
}
749745

750-
#if defined(CONFIG_NFS_V4_1)
751-
752746
static __be32 encode_sessionid(struct xdr_stream *xdr,
753747
const struct nfs4_sessionid *sid)
754748
{
@@ -846,19 +840,6 @@ static void nfs4_cb_free_slot(struct cb_process_state *cps)
846840
}
847841
}
848842

849-
#else /* CONFIG_NFS_V4_1 */
850-
851-
static __be32
852-
preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
853-
{
854-
return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
855-
}
856-
857-
static void nfs4_cb_free_slot(struct cb_process_state *cps)
858-
{
859-
}
860-
#endif /* CONFIG_NFS_V4_1 */
861-
862843
#ifdef CONFIG_NFS_V4_2
863844
static __be32
864845
preprocess_nfs42_op(int nop, unsigned int op_nr, struct callback_op **op)
@@ -1051,7 +1032,6 @@ static struct callback_op callback_ops[] = {
10511032
.decode_args = decode_recall_args,
10521033
.res_maxsize = CB_OP_RECALL_RES_MAXSZ,
10531034
},
1054-
#if defined(CONFIG_NFS_V4_1)
10551035
[OP_CB_LAYOUTRECALL] = {
10561036
.process_op = nfs4_callback_layoutrecall,
10571037
.decode_args = decode_layoutrecall_args,
@@ -1083,7 +1063,6 @@ static struct callback_op callback_ops[] = {
10831063
.decode_args = decode_notify_lock_args,
10841064
.res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
10851065
},
1086-
#endif /* CONFIG_NFS_V4_1 */
10871066
#ifdef CONFIG_NFS_V4_2
10881067
[OP_CB_OFFLOAD] = {
10891068
.process_op = nfs4_callback_offload,

fs/nfs/client.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,10 @@ struct nfs_server *nfs_alloc_server(void)
10601060
INIT_LIST_HEAD(&server->client_link);
10611061
INIT_LIST_HEAD(&server->master_link);
10621062
INIT_LIST_HEAD(&server->delegations);
1063+
spin_lock_init(&server->delegations_lock);
1064+
INIT_LIST_HEAD(&server->delegations_return);
1065+
INIT_LIST_HEAD(&server->delegations_lru);
1066+
INIT_LIST_HEAD(&server->delegations_delayed);
10631067
INIT_LIST_HEAD(&server->layouts);
10641068
INIT_LIST_HEAD(&server->state_owners_lru);
10651069
INIT_LIST_HEAD(&server->ss_copies);
@@ -1263,11 +1267,9 @@ void nfs_clients_init(struct net *net)
12631267
INIT_LIST_HEAD(&nn->nfs_volume_list);
12641268
#if IS_ENABLED(CONFIG_NFS_V4)
12651269
idr_init(&nn->cb_ident_idr);
1266-
#endif
1267-
#if IS_ENABLED(CONFIG_NFS_V4_1)
12681270
INIT_LIST_HEAD(&nn->nfs4_data_server_cache);
12691271
spin_lock_init(&nn->nfs4_data_server_lock);
1270-
#endif
1272+
#endif /* CONFIG_NFS_V4 */
12711273
spin_lock_init(&nn->nfs_client_lock);
12721274
nn->boot_time = ktime_get_real();
12731275
memset(&nn->rpcstats, 0, sizeof(nn->rpcstats));
@@ -1284,9 +1286,9 @@ void nfs_clients_exit(struct net *net)
12841286
nfs_cleanup_cb_ident_idr(net);
12851287
WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
12861288
WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
1287-
#if IS_ENABLED(CONFIG_NFS_V4_1)
1289+
#if IS_ENABLED(CONFIG_NFS_V4)
12881290
WARN_ON_ONCE(!list_empty(&nn->nfs4_data_server_cache));
1289-
#endif
1291+
#endif /* CONFIG_NFS_V4 */
12901292
}
12911293

12921294
#ifdef CONFIG_PROC_FS

0 commit comments

Comments
 (0)