Skip to content

Commit 912fc99

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: add netlink upcall for the svc_export cache
Add netlink-based cache upcall support for the svc_export (nfsd.export) cache to Documentation/netlink/specs/nfsd.yaml and regenerate the resulting files. Implement nfsd_cache_notify() which sends a NFSD_CMD_CACHE_NOTIFY multicast event to the "exportd" group, carrying the cache type so userspace knows which cache has pending requests. Implement nfsd_nl_svc_export_get_reqs_dumpit() which snapshots pending svc_export cache requests and sends each entry's seqno, client name, and path over netlink. Implement nfsd_nl_svc_export_set_reqs_doit() which parses svc_export cache responses from userspace (client, path, expiry, flags, anon uid/gid, fslocations, uuid, secinfo, xprtsec, fsid, or negative flag) and updates the cache via svc_export_lookup() / svc_export_update(). Wire up the svc_export_notify() callback in svc_export_cache_template so cache misses trigger NFSD_CMD_CACHE_NOTIFY multicast events with NFSD_CACHE_TYPE_SVC_EXPORT. Note that the export-flags and xprtsec-mode enums are organized to match their counterparts in include/uapi/linux/nfsd/export.h. The intent is that future export options will only be added to the netlink headers, which should eliminate the need to keep so much in sync. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 0850e86 commit 912fc99

9 files changed

Lines changed: 815 additions & 16 deletions

File tree

Documentation/netlink/specs/nfsd.yaml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,51 @@ uapi-header: linux/nfsd_netlink.h
66

77
doc: NFSD configuration over generic netlink.
88

9+
definitions:
10+
-
11+
type: flags
12+
name: cache-type
13+
entries: [svc_export]
14+
-
15+
type: flags
16+
name: export-flags
17+
doc: These flags are ordered to match the NFSEXP_* flags in include/linux/nfsd/export.h
18+
entries:
19+
- readonly
20+
- insecure-port
21+
- rootsquash
22+
- allsquash
23+
- async
24+
- gathered-writes
25+
- noreaddirplus
26+
- security-label
27+
- sign-fh
28+
- nohide
29+
- nosubtreecheck
30+
- noauthnlm
31+
- msnfs
32+
- fsid
33+
- crossmount
34+
- noacl
35+
- v4root
36+
- pnfs
37+
-
38+
type: flags
39+
name: xprtsec-mode
40+
doc: These flags are ordered to match the NFSEXP_XPRTSEC_* flags in include/linux/nfsd/export.h
41+
entries:
42+
- none
43+
- tls
44+
- mtls
45+
946
attribute-sets:
47+
-
48+
name: cache-notify
49+
attributes:
50+
-
51+
name: cache-type
52+
type: u32
53+
enum: cache-type
1054
-
1155
name: rpc-status
1256
attributes:
@@ -132,6 +176,91 @@ attribute-sets:
132176
-
133177
name: npools
134178
type: u32
179+
-
180+
name: fslocation
181+
attributes:
182+
-
183+
name: host
184+
type: string
185+
-
186+
name: path
187+
type: string
188+
-
189+
name: fslocations
190+
attributes:
191+
-
192+
name: location
193+
type: nest
194+
nested-attributes: fslocation
195+
multi-attr: true
196+
-
197+
name: auth-flavor
198+
attributes:
199+
-
200+
name: pseudoflavor
201+
type: u32
202+
-
203+
name: flags
204+
type: u32
205+
enum: export-flags
206+
enum-as-flags: true
207+
-
208+
name: svc-export
209+
attributes:
210+
-
211+
name: seqno
212+
type: u64
213+
-
214+
name: client
215+
type: string
216+
-
217+
name: path
218+
type: string
219+
-
220+
name: negative
221+
type: flag
222+
-
223+
name: expiry
224+
type: u64
225+
-
226+
name: anon-uid
227+
type: u32
228+
-
229+
name: anon-gid
230+
type: u32
231+
-
232+
name: fslocations
233+
type: nest
234+
nested-attributes: fslocations
235+
-
236+
name: uuid
237+
type: binary
238+
-
239+
name: secinfo
240+
type: nest
241+
nested-attributes: auth-flavor
242+
multi-attr: true
243+
-
244+
name: xprtsec
245+
type: u32
246+
enum: xprtsec-mode
247+
multi-attr: true
248+
-
249+
name: flags
250+
type: u32
251+
enum: export-flags
252+
enum-as-flags: true
253+
-
254+
name: fsid
255+
type: s32
256+
-
257+
name: svc-export-reqs
258+
attributes:
259+
-
260+
name: requests
261+
type: nest
262+
nested-attributes: svc-export
263+
multi-attr: true
135264

136265
operations:
137266
list:
@@ -233,3 +362,36 @@ operations:
233362
attributes:
234363
- mode
235364
- npools
365+
-
366+
name: cache-notify
367+
doc: Notification that there are cache requests that need servicing
368+
attribute-set: cache-notify
369+
mcgrp: exportd
370+
event:
371+
attributes:
372+
- cache-type
373+
-
374+
name: svc-export-get-reqs
375+
doc: Dump all pending svc_export requests
376+
attribute-set: svc-export-reqs
377+
flags: [admin-perm]
378+
dump:
379+
request:
380+
attributes:
381+
- requests
382+
-
383+
name: svc-export-set-reqs
384+
doc: Respond to one or more svc_export requests
385+
attribute-set: svc-export-reqs
386+
flags: [admin-perm]
387+
do:
388+
request:
389+
attributes:
390+
- requests
391+
392+
mcast-groups:
393+
list:
394+
-
395+
name: none
396+
-
397+
name: exportd

0 commit comments

Comments
 (0)