export.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. /*
  2. * NFS exporting and validation.
  3. *
  4. * We maintain a list of clients, each of which has a list of
  5. * exports. To export an fs to a given client, you first have
  6. * to create the client entry with NFSCTL_ADDCLIENT, which
  7. * creates a client control block and adds it to the hash
  8. * table. Then, you call NFSCTL_EXPORT for each fs.
  9. *
  10. *
  11. * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de>
  12. */
  13. #include <linux/slab.h>
  14. #include <linux/namei.h>
  15. #include <linux/module.h>
  16. #include <linux/exportfs.h>
  17. #include <net/ipv6.h>
  18. #include "nfsd.h"
  19. #include "nfsfh.h"
  20. #define NFSDDBG_FACILITY NFSDDBG_EXPORT
  21. typedef struct auth_domain svc_client;
  22. typedef struct svc_export svc_export;
  23. /*
  24. * We have two caches.
  25. * One maps client+vfsmnt+dentry to export options - the export map
  26. * The other maps client+filehandle-fragment to export options. - the expkey map
  27. *
  28. * The export options are actually stored in the first map, and the
  29. * second map contains a reference to the entry in the first map.
  30. */
  31. #define EXPKEY_HASHBITS 8
  32. #define EXPKEY_HASHMAX (1 << EXPKEY_HASHBITS)
  33. #define EXPKEY_HASHMASK (EXPKEY_HASHMAX -1)
  34. static struct cache_head *expkey_table[EXPKEY_HASHMAX];
  35. static void expkey_put(struct kref *ref)
  36. {
  37. struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
  38. if (test_bit(CACHE_VALID, &key->h.flags) &&
  39. !test_bit(CACHE_NEGATIVE, &key->h.flags))
  40. path_put(&key->ek_path);
  41. auth_domain_put(key->ek_client);
  42. kfree(key);
  43. }
  44. static void expkey_request(struct cache_detail *cd,
  45. struct cache_head *h,
  46. char **bpp, int *blen)
  47. {
  48. /* client fsidtype \xfsid */
  49. struct svc_expkey *ek = container_of(h, struct svc_expkey, h);
  50. char type[5];
  51. qword_add(bpp, blen, ek->ek_client->name);
  52. snprintf(type, 5, "%d", ek->ek_fsidtype);
  53. qword_add(bpp, blen, type);
  54. qword_addhex(bpp, blen, (char*)ek->ek_fsid, key_len(ek->ek_fsidtype));
  55. (*bpp)[-1] = '\n';
  56. }
  57. static int expkey_upcall(struct cache_detail *cd, struct cache_head *h)
  58. {
  59. return sunrpc_cache_pipe_upcall(cd, h, expkey_request);
  60. }
  61. static struct svc_expkey *svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
  62. struct svc_expkey *old);
  63. static struct svc_expkey *svc_expkey_lookup(struct cache_detail *cd, struct svc_expkey *);
  64. static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
  65. {
  66. /* client fsidtype fsid [path] */
  67. char *buf;
  68. int len;
  69. struct auth_domain *dom = NULL;
  70. int err;
  71. int fsidtype;
  72. char *ep;
  73. struct svc_expkey key;
  74. struct svc_expkey *ek = NULL;
  75. if (mesg[mlen - 1] != '\n')
  76. return -EINVAL;
  77. mesg[mlen-1] = 0;
  78. buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
  79. err = -ENOMEM;
  80. if (!buf)
  81. goto out;
  82. err = -EINVAL;
  83. if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
  84. goto out;
  85. err = -ENOENT;
  86. dom = auth_domain_find(buf);
  87. if (!dom)
  88. goto out;
  89. dprintk("found domain %s\n", buf);
  90. err = -EINVAL;
  91. if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
  92. goto out;
  93. fsidtype = simple_strtoul(buf, &ep, 10);
  94. if (*ep)
  95. goto out;
  96. dprintk("found fsidtype %d\n", fsidtype);
  97. if (key_len(fsidtype)==0) /* invalid type */
  98. goto out;
  99. if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
  100. goto out;
  101. dprintk("found fsid length %d\n", len);
  102. if (len != key_len(fsidtype))
  103. goto out;
  104. /* OK, we seem to have a valid key */
  105. key.h.flags = 0;
  106. key.h.expiry_time = get_expiry(&mesg);
  107. if (key.h.expiry_time == 0)
  108. goto out;
  109. key.ek_client = dom;
  110. key.ek_fsidtype = fsidtype;
  111. memcpy(key.ek_fsid, buf, len);
  112. ek = svc_expkey_lookup(cd, &key);
  113. err = -ENOMEM;
  114. if (!ek)
  115. goto out;
  116. /* now we want a pathname, or empty meaning NEGATIVE */
  117. err = -EINVAL;
  118. len = qword_get(&mesg, buf, PAGE_SIZE);
  119. if (len < 0)
  120. goto out;
  121. dprintk("Path seems to be <%s>\n", buf);
  122. err = 0;
  123. if (len == 0) {
  124. set_bit(CACHE_NEGATIVE, &key.h.flags);
  125. ek = svc_expkey_update(cd, &key, ek);
  126. if (!ek)
  127. err = -ENOMEM;
  128. } else {
  129. err = kern_path(buf, 0, &key.ek_path);
  130. if (err)
  131. goto out;
  132. dprintk("Found the path %s\n", buf);
  133. ek = svc_expkey_update(cd, &key, ek);
  134. if (!ek)
  135. err = -ENOMEM;
  136. path_put(&key.ek_path);
  137. }
  138. cache_flush();
  139. out:
  140. if (ek)
  141. cache_put(&ek->h, cd);
  142. if (dom)
  143. auth_domain_put(dom);
  144. kfree(buf);
  145. return err;
  146. }
  147. static int expkey_show(struct seq_file *m,
  148. struct cache_detail *cd,
  149. struct cache_head *h)
  150. {
  151. struct svc_expkey *ek ;
  152. int i;
  153. if (h ==NULL) {
  154. seq_puts(m, "#domain fsidtype fsid [path]\n");
  155. return 0;
  156. }
  157. ek = container_of(h, struct svc_expkey, h);
  158. seq_printf(m, "%s %d 0x", ek->ek_client->name,
  159. ek->ek_fsidtype);
  160. for (i=0; i < key_len(ek->ek_fsidtype)/4; i++)
  161. seq_printf(m, "%08x", ek->ek_fsid[i]);
  162. if (test_bit(CACHE_VALID, &h->flags) &&
  163. !test_bit(CACHE_NEGATIVE, &h->flags)) {
  164. seq_printf(m, " ");
  165. seq_path(m, &ek->ek_path, "\\ \t\n");
  166. }
  167. seq_printf(m, "\n");
  168. return 0;
  169. }
  170. static inline int expkey_match (struct cache_head *a, struct cache_head *b)
  171. {
  172. struct svc_expkey *orig = container_of(a, struct svc_expkey, h);
  173. struct svc_expkey *new = container_of(b, struct svc_expkey, h);
  174. if (orig->ek_fsidtype != new->ek_fsidtype ||
  175. orig->ek_client != new->ek_client ||
  176. memcmp(orig->ek_fsid, new->ek_fsid, key_len(orig->ek_fsidtype)) != 0)
  177. return 0;
  178. return 1;
  179. }
  180. static inline void expkey_init(struct cache_head *cnew,
  181. struct cache_head *citem)
  182. {
  183. struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
  184. struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
  185. kref_get(&item->ek_client->ref);
  186. new->ek_client = item->ek_client;
  187. new->ek_fsidtype = item->ek_fsidtype;
  188. memcpy(new->ek_fsid, item->ek_fsid, sizeof(new->ek_fsid));
  189. }
  190. static inline void expkey_update(struct cache_head *cnew,
  191. struct cache_head *citem)
  192. {
  193. struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
  194. struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
  195. new->ek_path = item->ek_path;
  196. path_get(&item->ek_path);
  197. }
  198. static struct cache_head *expkey_alloc(void)
  199. {
  200. struct svc_expkey *i = kmalloc(sizeof(*i), GFP_KERNEL);
  201. if (i)
  202. return &i->h;
  203. else
  204. return NULL;
  205. }
  206. static struct cache_detail svc_expkey_cache = {
  207. .owner = THIS_MODULE,
  208. .hash_size = EXPKEY_HASHMAX,
  209. .hash_table = expkey_table,
  210. .name = "nfsd.fh",
  211. .cache_put = expkey_put,
  212. .cache_upcall = expkey_upcall,
  213. .cache_parse = expkey_parse,
  214. .cache_show = expkey_show,
  215. .match = expkey_match,
  216. .init = expkey_init,
  217. .update = expkey_update,
  218. .alloc = expkey_alloc,
  219. };
  220. static int
  221. svc_expkey_hash(struct svc_expkey *item)
  222. {
  223. int hash = item->ek_fsidtype;
  224. char * cp = (char*)item->ek_fsid;
  225. int len = key_len(item->ek_fsidtype);
  226. hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
  227. hash ^= hash_ptr(item->ek_client, EXPKEY_HASHBITS);
  228. hash &= EXPKEY_HASHMASK;
  229. return hash;
  230. }
  231. static struct svc_expkey *
  232. svc_expkey_lookup(struct cache_detail *cd, struct svc_expkey *item)
  233. {
  234. struct cache_head *ch;
  235. int hash = svc_expkey_hash(item);
  236. ch = sunrpc_cache_lookup(cd, &item->h, hash);
  237. if (ch)
  238. return container_of(ch, struct svc_expkey, h);
  239. else
  240. return NULL;
  241. }
  242. static struct svc_expkey *
  243. svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
  244. struct svc_expkey *old)
  245. {
  246. struct cache_head *ch;
  247. int hash = svc_expkey_hash(new);
  248. ch = sunrpc_cache_update(cd, &new->h, &old->h, hash);
  249. if (ch)
  250. return container_of(ch, struct svc_expkey, h);
  251. else
  252. return NULL;
  253. }
  254. #define EXPORT_HASHBITS 8
  255. #define EXPORT_HASHMAX (1<< EXPORT_HASHBITS)
  256. static struct cache_head *export_table[EXPORT_HASHMAX];
  257. static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
  258. {
  259. int i;
  260. for (i = 0; i < fsloc->locations_count; i++) {
  261. kfree(fsloc->locations[i].path);
  262. kfree(fsloc->locations[i].hosts);
  263. }
  264. kfree(fsloc->locations);
  265. }
  266. static void svc_export_put(struct kref *ref)
  267. {
  268. struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
  269. path_put(&exp->ex_path);
  270. auth_domain_put(exp->ex_client);
  271. nfsd4_fslocs_free(&exp->ex_fslocs);
  272. kfree(exp);
  273. }
  274. static void svc_export_request(struct cache_detail *cd,
  275. struct cache_head *h,
  276. char **bpp, int *blen)
  277. {
  278. /* client path */
  279. struct svc_export *exp = container_of(h, struct svc_export, h);
  280. char *pth;
  281. qword_add(bpp, blen, exp->ex_client->name);
  282. pth = d_path(&exp->ex_path, *bpp, *blen);
  283. if (IS_ERR(pth)) {
  284. /* is this correct? */
  285. (*bpp)[0] = '\n';
  286. return;
  287. }
  288. qword_add(bpp, blen, pth);
  289. (*bpp)[-1] = '\n';
  290. }
  291. static int svc_export_upcall(struct cache_detail *cd, struct cache_head *h)
  292. {
  293. return sunrpc_cache_pipe_upcall(cd, h, svc_export_request);
  294. }
  295. static struct svc_export *svc_export_update(struct svc_export *new,
  296. struct svc_export *old);
  297. static struct svc_export *svc_export_lookup(struct svc_export *);
  298. static int check_export(struct inode *inode, int *flags, unsigned char *uuid)
  299. {
  300. /*
  301. * We currently export only dirs, regular files, and (for v4
  302. * pseudoroot) symlinks.
  303. */
  304. if (!S_ISDIR(inode->i_mode) &&
  305. !S_ISLNK(inode->i_mode) &&
  306. !S_ISREG(inode->i_mode))
  307. return -ENOTDIR;
  308. /*
  309. * Mountd should never pass down a writeable V4ROOT export, but,
  310. * just to make sure:
  311. */
  312. if (*flags & NFSEXP_V4ROOT)
  313. *flags |= NFSEXP_READONLY;
  314. /* There are two requirements on a filesystem to be exportable.
  315. * 1: We must be able to identify the filesystem from a number.
  316. * either a device number (so FS_REQUIRES_DEV needed)
  317. * or an FSID number (so NFSEXP_FSID or ->uuid is needed).
  318. * 2: We must be able to find an inode from a filehandle.
  319. * This means that s_export_op must be set.
  320. */
  321. if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&
  322. !(*flags & NFSEXP_FSID) &&
  323. uuid == NULL) {
  324. dprintk("exp_export: export of non-dev fs without fsid\n");
  325. return -EINVAL;
  326. }
  327. if (!inode->i_sb->s_export_op ||
  328. !inode->i_sb->s_export_op->fh_to_dentry) {
  329. dprintk("exp_export: export of invalid fs type.\n");
  330. return -EINVAL;
  331. }
  332. return 0;
  333. }
  334. #ifdef CONFIG_NFSD_V4
  335. static int
  336. fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
  337. {
  338. int len;
  339. int migrated, i, err;
  340. /* listsize */
  341. err = get_int(mesg, &fsloc->locations_count);
  342. if (err)
  343. return err;
  344. if (fsloc->locations_count > MAX_FS_LOCATIONS)
  345. return -EINVAL;
  346. if (fsloc->locations_count == 0)
  347. return 0;
  348. fsloc->locations = kzalloc(fsloc->locations_count
  349. * sizeof(struct nfsd4_fs_location), GFP_KERNEL);
  350. if (!fsloc->locations)
  351. return -ENOMEM;
  352. for (i=0; i < fsloc->locations_count; i++) {
  353. /* colon separated host list */
  354. err = -EINVAL;
  355. len = qword_get(mesg, buf, PAGE_SIZE);
  356. if (len <= 0)
  357. goto out_free_all;
  358. err = -ENOMEM;
  359. fsloc->locations[i].hosts = kstrdup(buf, GFP_KERNEL);
  360. if (!fsloc->locations[i].hosts)
  361. goto out_free_all;
  362. err = -EINVAL;
  363. /* slash separated path component list */
  364. len = qword_get(mesg, buf, PAGE_SIZE);
  365. if (len <= 0)
  366. goto out_free_all;
  367. err = -ENOMEM;
  368. fsloc->locations[i].path = kstrdup(buf, GFP_KERNEL);
  369. if (!fsloc->locations[i].path)
  370. goto out_free_all;
  371. }
  372. /* migrated */
  373. err = get_int(mesg, &migrated);
  374. if (err)
  375. goto out_free_all;
  376. err = -EINVAL;
  377. if (migrated < 0 || migrated > 1)
  378. goto out_free_all;
  379. fsloc->migrated = migrated;
  380. return 0;
  381. out_free_all:
  382. nfsd4_fslocs_free(fsloc);
  383. return err;
  384. }
  385. static int secinfo_parse(char **mesg, char *buf, struct svc_export *exp)
  386. {
  387. int listsize, err;
  388. struct exp_flavor_info *f;
  389. err = get_int(mesg, &listsize);
  390. if (err)
  391. return err;
  392. if (listsize < 0 || listsize > MAX_SECINFO_LIST)
  393. return -EINVAL;
  394. for (f = exp->ex_flavors; f < exp->ex_flavors + listsize; f++) {
  395. err = get_int(mesg, &f->pseudoflavor);
  396. if (err)
  397. return err;
  398. /*
  399. * XXX: It would be nice to also check whether this
  400. * pseudoflavor is supported, so we can discover the
  401. * problem at export time instead of when a client fails
  402. * to authenticate.
  403. */
  404. err = get_int(mesg, &f->flags);
  405. if (err)
  406. return err;
  407. /* Only some flags are allowed to differ between flavors: */
  408. if (~NFSEXP_SECINFO_FLAGS & (f->flags ^ exp->ex_flags))
  409. return -EINVAL;
  410. }
  411. exp->ex_nflavors = listsize;
  412. return 0;
  413. }
  414. #else /* CONFIG_NFSD_V4 */
  415. static inline int
  416. fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc){return 0;}
  417. static inline int
  418. secinfo_parse(char **mesg, char *buf, struct svc_export *exp) { return 0; }
  419. #endif
  420. static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
  421. {
  422. /* client path expiry [flags anonuid anongid fsid] */
  423. char *buf;
  424. int len;
  425. int err;
  426. struct auth_domain *dom = NULL;
  427. struct svc_export exp = {}, *expp;
  428. int an_int;
  429. if (mesg[mlen-1] != '\n')
  430. return -EINVAL;
  431. mesg[mlen-1] = 0;
  432. buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
  433. if (!buf)
  434. return -ENOMEM;
  435. /* client */
  436. err = -EINVAL;
  437. len = qword_get(&mesg, buf, PAGE_SIZE);
  438. if (len <= 0)
  439. goto out;
  440. err = -ENOENT;
  441. dom = auth_domain_find(buf);
  442. if (!dom)
  443. goto out;
  444. /* path */
  445. err = -EINVAL;
  446. if ((len = qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
  447. goto out1;
  448. err = kern_path(buf, 0, &exp.ex_path);
  449. if (err)
  450. goto out1;
  451. exp.ex_client = dom;
  452. exp.cd = cd;
  453. /* expiry */
  454. err = -EINVAL;
  455. exp.h.expiry_time = get_expiry(&mesg);
  456. if (exp.h.expiry_time == 0)
  457. goto out3;
  458. /* flags */
  459. err = get_int(&mesg, &an_int);
  460. if (err == -ENOENT) {
  461. err = 0;
  462. set_bit(CACHE_NEGATIVE, &exp.h.flags);
  463. } else {
  464. if (err || an_int < 0)
  465. goto out3;
  466. exp.ex_flags= an_int;
  467. /* anon uid */
  468. err = get_int(&mesg, &an_int);
  469. if (err)
  470. goto out3;
  471. exp.ex_anon_uid= an_int;
  472. /* anon gid */
  473. err = get_int(&mesg, &an_int);
  474. if (err)
  475. goto out3;
  476. exp.ex_anon_gid= an_int;
  477. /* fsid */
  478. err = get_int(&mesg, &an_int);
  479. if (err)
  480. goto out3;
  481. exp.ex_fsid = an_int;
  482. while ((len = qword_get(&mesg, buf, PAGE_SIZE)) > 0) {
  483. if (strcmp(buf, "fsloc") == 0)
  484. err = fsloc_parse(&mesg, buf, &exp.ex_fslocs);
  485. else if (strcmp(buf, "uuid") == 0) {
  486. /* expect a 16 byte uuid encoded as \xXXXX... */
  487. len = qword_get(&mesg, buf, PAGE_SIZE);
  488. if (len != 16)
  489. err = -EINVAL;
  490. else {
  491. exp.ex_uuid =
  492. kmemdup(buf, 16, GFP_KERNEL);
  493. if (exp.ex_uuid == NULL)
  494. err = -ENOMEM;
  495. }
  496. } else if (strcmp(buf, "secinfo") == 0)
  497. err = secinfo_parse(&mesg, buf, &exp);
  498. else
  499. /* quietly ignore unknown words and anything
  500. * following. Newer user-space can try to set
  501. * new values, then see what the result was.
  502. */
  503. break;
  504. if (err)
  505. goto out4;
  506. }
  507. err = check_export(exp.ex_path.dentry->d_inode, &exp.ex_flags,
  508. exp.ex_uuid);
  509. if (err)
  510. goto out4;
  511. }
  512. expp = svc_export_lookup(&exp);
  513. if (expp)
  514. expp = svc_export_update(&exp, expp);
  515. else
  516. err = -ENOMEM;
  517. cache_flush();
  518. if (expp == NULL)
  519. err = -ENOMEM;
  520. else
  521. exp_put(expp);
  522. out4:
  523. nfsd4_fslocs_free(&exp.ex_fslocs);
  524. kfree(exp.ex_uuid);
  525. out3:
  526. path_put(&exp.ex_path);
  527. out1:
  528. auth_domain_put(dom);
  529. out:
  530. kfree(buf);
  531. return err;
  532. }
  533. static void exp_flags(struct seq_file *m, int flag, int fsid,
  534. uid_t anonu, uid_t anong, struct nfsd4_fs_locations *fslocs);
  535. static void show_secinfo(struct seq_file *m, struct svc_export *exp);
  536. static int svc_export_show(struct seq_file *m,
  537. struct cache_detail *cd,
  538. struct cache_head *h)
  539. {
  540. struct svc_export *exp ;
  541. if (h ==NULL) {
  542. seq_puts(m, "#path domain(flags)\n");
  543. return 0;
  544. }
  545. exp = container_of(h, struct svc_export, h);
  546. seq_path(m, &exp->ex_path, " \t\n\\");
  547. seq_putc(m, '\t');
  548. seq_escape(m, exp->ex_client->name, " \t\n\\");
  549. seq_putc(m, '(');
  550. if (test_bit(CACHE_VALID, &h->flags) &&
  551. !test_bit(CACHE_NEGATIVE, &h->flags)) {
  552. exp_flags(m, exp->ex_flags, exp->ex_fsid,
  553. exp->ex_anon_uid, exp->ex_anon_gid, &exp->ex_fslocs);
  554. if (exp->ex_uuid) {
  555. int i;
  556. seq_puts(m, ",uuid=");
  557. for (i=0; i<16; i++) {
  558. if ((i&3) == 0 && i)
  559. seq_putc(m, ':');
  560. seq_printf(m, "%02x", exp->ex_uuid[i]);
  561. }
  562. }
  563. show_secinfo(m, exp);
  564. }
  565. seq_puts(m, ")\n");
  566. return 0;
  567. }
  568. static int svc_export_match(struct cache_head *a, struct cache_head *b)
  569. {
  570. struct svc_export *orig = container_of(a, struct svc_export, h);
  571. struct svc_export *new = container_of(b, struct svc_export, h);
  572. return orig->ex_client == new->ex_client &&
  573. orig->ex_path.dentry == new->ex_path.dentry &&
  574. orig->ex_path.mnt == new->ex_path.mnt;
  575. }
  576. static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
  577. {
  578. struct svc_export *new = container_of(cnew, struct svc_export, h);
  579. struct svc_export *item = container_of(citem, struct svc_export, h);
  580. kref_get(&item->ex_client->ref);
  581. new->ex_client = item->ex_client;
  582. new->ex_path.dentry = dget(item->ex_path.dentry);
  583. new->ex_path.mnt = mntget(item->ex_path.mnt);
  584. new->ex_fslocs.locations = NULL;
  585. new->ex_fslocs.locations_count = 0;
  586. new->ex_fslocs.migrated = 0;
  587. new->cd = item->cd;
  588. }
  589. static void export_update(struct cache_head *cnew, struct cache_head *citem)
  590. {
  591. struct svc_export *new = container_of(cnew, struct svc_export, h);
  592. struct svc_export *item = container_of(citem, struct svc_export, h);
  593. int i;
  594. new->ex_flags = item->ex_flags;
  595. new->ex_anon_uid = item->ex_anon_uid;
  596. new->ex_anon_gid = item->ex_anon_gid;
  597. new->ex_fsid = item->ex_fsid;
  598. new->ex_uuid = item->ex_uuid;
  599. item->ex_uuid = NULL;
  600. new->ex_fslocs.locations = item->ex_fslocs.locations;
  601. item->ex_fslocs.locations = NULL;
  602. new->ex_fslocs.locations_count = item->ex_fslocs.locations_count;
  603. item->ex_fslocs.locations_count = 0;
  604. new->ex_fslocs.migrated = item->ex_fslocs.migrated;
  605. item->ex_fslocs.migrated = 0;
  606. new->ex_nflavors = item->ex_nflavors;
  607. for (i = 0; i < MAX_SECINFO_LIST; i++) {
  608. new->ex_flavors[i] = item->ex_flavors[i];
  609. }
  610. }
  611. static struct cache_head *svc_export_alloc(void)
  612. {
  613. struct svc_export *i = kmalloc(sizeof(*i), GFP_KERNEL);
  614. if (i)
  615. return &i->h;
  616. else
  617. return NULL;
  618. }
  619. struct cache_detail svc_export_cache = {
  620. .owner = THIS_MODULE,
  621. .hash_size = EXPORT_HASHMAX,
  622. .hash_table = export_table,
  623. .name = "nfsd.export",
  624. .cache_put = svc_export_put,
  625. .cache_upcall = svc_export_upcall,
  626. .cache_parse = svc_export_parse,
  627. .cache_show = svc_export_show,
  628. .match = svc_export_match,
  629. .init = svc_export_init,
  630. .update = export_update,
  631. .alloc = svc_export_alloc,
  632. };
  633. static int
  634. svc_export_hash(struct svc_export *exp)
  635. {
  636. int hash;
  637. hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS);
  638. hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS);
  639. hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS);
  640. return hash;
  641. }
  642. static struct svc_export *
  643. svc_export_lookup(struct svc_export *exp)
  644. {
  645. struct cache_head *ch;
  646. int hash = svc_export_hash(exp);
  647. ch = sunrpc_cache_lookup(exp->cd, &exp->h, hash);
  648. if (ch)
  649. return container_of(ch, struct svc_export, h);
  650. else
  651. return NULL;
  652. }
  653. static struct svc_export *
  654. svc_export_update(struct svc_export *new, struct svc_export *old)
  655. {
  656. struct cache_head *ch;
  657. int hash = svc_export_hash(old);
  658. ch = sunrpc_cache_update(old->cd, &new->h, &old->h, hash);
  659. if (ch)
  660. return container_of(ch, struct svc_export, h);
  661. else
  662. return NULL;
  663. }
  664. static struct svc_expkey *
  665. exp_find_key(struct cache_detail *cd, svc_client *clp, int fsid_type,
  666. u32 *fsidv, struct cache_req *reqp)
  667. {
  668. struct svc_expkey key, *ek;
  669. int err;
  670. if (!clp)
  671. return ERR_PTR(-ENOENT);
  672. key.ek_client = clp;
  673. key.ek_fsidtype = fsid_type;
  674. memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
  675. ek = svc_expkey_lookup(cd, &key);
  676. if (ek == NULL)
  677. return ERR_PTR(-ENOMEM);
  678. err = cache_check(cd, &ek->h, reqp);
  679. if (err)
  680. return ERR_PTR(err);
  681. return ek;
  682. }
  683. static svc_export *exp_get_by_name(struct cache_detail *cd, svc_client *clp,
  684. const struct path *path, struct cache_req *reqp)
  685. {
  686. struct svc_export *exp, key;
  687. int err;
  688. if (!clp)
  689. return ERR_PTR(-ENOENT);
  690. key.ex_client = clp;
  691. key.ex_path = *path;
  692. key.cd = cd;
  693. exp = svc_export_lookup(&key);
  694. if (exp == NULL)
  695. return ERR_PTR(-ENOMEM);
  696. err = cache_check(cd, &exp->h, reqp);
  697. if (err)
  698. return ERR_PTR(err);
  699. return exp;
  700. }
  701. /*
  702. * Find the export entry for a given dentry.
  703. */
  704. static struct svc_export *exp_parent(struct cache_detail *cd, svc_client *clp,
  705. struct path *path)
  706. {
  707. struct dentry *saved = dget(path->dentry);
  708. svc_export *exp = exp_get_by_name(cd, clp, path, NULL);
  709. while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) {
  710. struct dentry *parent = dget_parent(path->dentry);
  711. dput(path->dentry);
  712. path->dentry = parent;
  713. exp = exp_get_by_name(cd, clp, path, NULL);
  714. }
  715. dput(path->dentry);
  716. path->dentry = saved;
  717. return exp;
  718. }
  719. /*
  720. * Obtain the root fh on behalf of a client.
  721. * This could be done in user space, but I feel that it adds some safety
  722. * since its harder to fool a kernel module than a user space program.
  723. */
  724. int
  725. exp_rootfh(svc_client *clp, char *name,
  726. struct knfsd_fh *f, int maxsize)
  727. {
  728. struct svc_export *exp;
  729. struct path path;
  730. struct inode *inode;
  731. struct svc_fh fh;
  732. int err;
  733. struct cache_detail *cd = &svc_export_cache;
  734. err = -EPERM;
  735. /* NB: we probably ought to check that it's NUL-terminated */
  736. if (kern_path(name, 0, &path)) {
  737. printk("nfsd: exp_rootfh path not found %s", name);
  738. return err;
  739. }
  740. inode = path.dentry->d_inode;
  741. dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
  742. name, path.dentry, clp->name,
  743. inode->i_sb->s_id, inode->i_ino);
  744. exp = exp_parent(cd, clp, &path);
  745. if (IS_ERR(exp)) {
  746. err = PTR_ERR(exp);
  747. goto out;
  748. }
  749. /*
  750. * fh must be initialized before calling fh_compose
  751. */
  752. fh_init(&fh, maxsize);
  753. if (fh_compose(&fh, exp, path.dentry, NULL))
  754. err = -EINVAL;
  755. else
  756. err = 0;
  757. memcpy(f, &fh.fh_handle, sizeof(struct knfsd_fh));
  758. fh_put(&fh);
  759. exp_put(exp);
  760. out:
  761. path_put(&path);
  762. return err;
  763. }
  764. static struct svc_export *exp_find(struct cache_detail *cd,
  765. struct auth_domain *clp, int fsid_type,
  766. u32 *fsidv, struct cache_req *reqp)
  767. {
  768. struct svc_export *exp;
  769. struct svc_expkey *ek = exp_find_key(&svc_expkey_cache, clp, fsid_type, fsidv, reqp);
  770. if (IS_ERR(ek))
  771. return ERR_CAST(ek);
  772. exp = exp_get_by_name(cd, clp, &ek->ek_path, reqp);
  773. cache_put(&ek->h, &svc_expkey_cache);
  774. if (IS_ERR(exp))
  775. return ERR_CAST(exp);
  776. return exp;
  777. }
  778. __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp)
  779. {
  780. struct exp_flavor_info *f;
  781. struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
  782. /* legacy gss-only clients are always OK: */
  783. if (exp->ex_client == rqstp->rq_gssclient)
  784. return 0;
  785. /* ip-address based client; check sec= export option: */
  786. for (f = exp->ex_flavors; f < end; f++) {
  787. if (f->pseudoflavor == rqstp->rq_flavor)
  788. return 0;
  789. }
  790. /* defaults in absence of sec= options: */
  791. if (exp->ex_nflavors == 0) {
  792. if (rqstp->rq_flavor == RPC_AUTH_NULL ||
  793. rqstp->rq_flavor == RPC_AUTH_UNIX)
  794. return 0;
  795. }
  796. return nfserr_wrongsec;
  797. }
  798. /*
  799. * Uses rq_client and rq_gssclient to find an export; uses rq_client (an
  800. * auth_unix client) if it's available and has secinfo information;
  801. * otherwise, will try to use rq_gssclient.
  802. *
  803. * Called from functions that handle requests; functions that do work on
  804. * behalf of mountd are passed a single client name to use, and should
  805. * use exp_get_by_name() or exp_find().
  806. */
  807. struct svc_export *
  808. rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
  809. {
  810. struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
  811. struct cache_detail *cd = &svc_export_cache;
  812. if (rqstp->rq_client == NULL)
  813. goto gss;
  814. /* First try the auth_unix client: */
  815. exp = exp_get_by_name(cd, rqstp->rq_client, path, &rqstp->rq_chandle);
  816. if (PTR_ERR(exp) == -ENOENT)
  817. goto gss;
  818. if (IS_ERR(exp))
  819. return exp;
  820. /* If it has secinfo, assume there are no gss/... clients */
  821. if (exp->ex_nflavors > 0)
  822. return exp;
  823. gss:
  824. /* Otherwise, try falling back on gss client */
  825. if (rqstp->rq_gssclient == NULL)
  826. return exp;
  827. gssexp = exp_get_by_name(cd, rqstp->rq_gssclient, path, &rqstp->rq_chandle);
  828. if (PTR_ERR(gssexp) == -ENOENT)
  829. return exp;
  830. if (!IS_ERR(exp))
  831. exp_put(exp);
  832. return gssexp;
  833. }
  834. struct svc_export *
  835. rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
  836. {
  837. struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
  838. struct cache_detail *cd = &svc_export_cache;
  839. if (rqstp->rq_client == NULL)
  840. goto gss;
  841. /* First try the auth_unix client: */
  842. exp = exp_find(cd, rqstp->rq_client, fsid_type,
  843. fsidv, &rqstp->rq_chandle);
  844. if (PTR_ERR(exp) == -ENOENT)
  845. goto gss;
  846. if (IS_ERR(exp))
  847. return exp;
  848. /* If it has secinfo, assume there are no gss/... clients */
  849. if (exp->ex_nflavors > 0)
  850. return exp;
  851. gss:
  852. /* Otherwise, try falling back on gss client */
  853. if (rqstp->rq_gssclient == NULL)
  854. return exp;
  855. gssexp = exp_find(cd, rqstp->rq_gssclient, fsid_type, fsidv,
  856. &rqstp->rq_chandle);
  857. if (PTR_ERR(gssexp) == -ENOENT)
  858. return exp;
  859. if (!IS_ERR(exp))
  860. exp_put(exp);
  861. return gssexp;
  862. }
  863. struct svc_export *
  864. rqst_exp_parent(struct svc_rqst *rqstp, struct path *path)
  865. {
  866. struct dentry *saved = dget(path->dentry);
  867. struct svc_export *exp = rqst_exp_get_by_name(rqstp, path);
  868. while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) {
  869. struct dentry *parent = dget_parent(path->dentry);
  870. dput(path->dentry);
  871. path->dentry = parent;
  872. exp = rqst_exp_get_by_name(rqstp, path);
  873. }
  874. dput(path->dentry);
  875. path->dentry = saved;
  876. return exp;
  877. }
  878. struct svc_export *rqst_find_fsidzero_export(struct svc_rqst *rqstp)
  879. {
  880. u32 fsidv[2];
  881. mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
  882. return rqst_exp_find(rqstp, FSID_NUM, fsidv);
  883. }
  884. /*
  885. * Called when we need the filehandle for the root of the pseudofs,
  886. * for a given NFSv4 client. The root is defined to be the
  887. * export point with fsid==0
  888. */
  889. __be32
  890. exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
  891. {
  892. struct svc_export *exp;
  893. __be32 rv;
  894. exp = rqst_find_fsidzero_export(rqstp);
  895. if (IS_ERR(exp))
  896. return nfserrno(PTR_ERR(exp));
  897. rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL);
  898. exp_put(exp);
  899. return rv;
  900. }
  901. /* Iterator */
  902. static void *e_start(struct seq_file *m, loff_t *pos)
  903. __acquires(((struct cache_detail *)m->private)->hash_lock)
  904. {
  905. loff_t n = *pos;
  906. unsigned hash, export;
  907. struct cache_head *ch;
  908. struct cache_detail *cd = m->private;
  909. struct cache_head **export_table = cd->hash_table;
  910. read_lock(&cd->hash_lock);
  911. if (!n--)
  912. return SEQ_START_TOKEN;
  913. hash = n >> 32;
  914. export = n & ((1LL<<32) - 1);
  915. for (ch=export_table[hash]; ch; ch=ch->next)
  916. if (!export--)
  917. return ch;
  918. n &= ~((1LL<<32) - 1);
  919. do {
  920. hash++;
  921. n += 1LL<<32;
  922. } while(hash < EXPORT_HASHMAX && export_table[hash]==NULL);
  923. if (hash >= EXPORT_HASHMAX)
  924. return NULL;
  925. *pos = n+1;
  926. return export_table[hash];
  927. }
  928. static void *e_next(struct seq_file *m, void *p, loff_t *pos)
  929. {
  930. struct cache_head *ch = p;
  931. int hash = (*pos >> 32);
  932. struct cache_detail *cd = m->private;
  933. struct cache_head **export_table = cd->hash_table;
  934. if (p == SEQ_START_TOKEN)
  935. hash = 0;
  936. else if (ch->next == NULL) {
  937. hash++;
  938. *pos += 1LL<<32;
  939. } else {
  940. ++*pos;
  941. return ch->next;
  942. }
  943. *pos &= ~((1LL<<32) - 1);
  944. while (hash < EXPORT_HASHMAX && export_table[hash] == NULL) {
  945. hash++;
  946. *pos += 1LL<<32;
  947. }
  948. if (hash >= EXPORT_HASHMAX)
  949. return NULL;
  950. ++*pos;
  951. return export_table[hash];
  952. }
  953. static void e_stop(struct seq_file *m, void *p)
  954. __releases(((struct cache_detail *)m->private)->hash_lock)
  955. {
  956. struct cache_detail *cd = m->private;
  957. read_unlock(&cd->hash_lock);
  958. }
  959. static struct flags {
  960. int flag;
  961. char *name[2];
  962. } expflags[] = {
  963. { NFSEXP_READONLY, {"ro", "rw"}},
  964. { NFSEXP_INSECURE_PORT, {"insecure", ""}},
  965. { NFSEXP_ROOTSQUASH, {"root_squash", "no_root_squash"}},
  966. { NFSEXP_ALLSQUASH, {"all_squash", ""}},
  967. { NFSEXP_ASYNC, {"async", "sync"}},
  968. { NFSEXP_GATHERED_WRITES, {"wdelay", "no_wdelay"}},
  969. { NFSEXP_NOHIDE, {"nohide", ""}},
  970. { NFSEXP_CROSSMOUNT, {"crossmnt", ""}},
  971. { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
  972. { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
  973. { NFSEXP_V4ROOT, {"v4root", ""}},
  974. { 0, {"", ""}}
  975. };
  976. static void show_expflags(struct seq_file *m, int flags, int mask)
  977. {
  978. struct flags *flg;
  979. int state, first = 0;
  980. for (flg = expflags; flg->flag; flg++) {
  981. if (flg->flag & ~mask)
  982. continue;
  983. state = (flg->flag & flags) ? 0 : 1;
  984. if (*flg->name[state])
  985. seq_printf(m, "%s%s", first++?",":"", flg->name[state]);
  986. }
  987. }
  988. static void show_secinfo_flags(struct seq_file *m, int flags)
  989. {
  990. seq_printf(m, ",");
  991. show_expflags(m, flags, NFSEXP_SECINFO_FLAGS);
  992. }
  993. static bool secinfo_flags_equal(int f, int g)
  994. {
  995. f &= NFSEXP_SECINFO_FLAGS;
  996. g &= NFSEXP_SECINFO_FLAGS;
  997. return f == g;
  998. }
  999. static int show_secinfo_run(struct seq_file *m, struct exp_flavor_info **fp, struct exp_flavor_info *end)
  1000. {
  1001. int flags;
  1002. flags = (*fp)->flags;
  1003. seq_printf(m, ",sec=%d", (*fp)->pseudoflavor);
  1004. (*fp)++;
  1005. while (*fp != end && secinfo_flags_equal(flags, (*fp)->flags)) {
  1006. seq_printf(m, ":%d", (*fp)->pseudoflavor);
  1007. (*fp)++;
  1008. }
  1009. return flags;
  1010. }
  1011. static void show_secinfo(struct seq_file *m, struct svc_export *exp)
  1012. {
  1013. struct exp_flavor_info *f;
  1014. struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
  1015. int flags;
  1016. if (exp->ex_nflavors == 0)
  1017. return;
  1018. f = exp->ex_flavors;
  1019. flags = show_secinfo_run(m, &f, end);
  1020. if (!secinfo_flags_equal(flags, exp->ex_flags))
  1021. show_secinfo_flags(m, flags);
  1022. while (f != end) {
  1023. flags = show_secinfo_run(m, &f, end);
  1024. show_secinfo_flags(m, flags);
  1025. }
  1026. }
  1027. static void exp_flags(struct seq_file *m, int flag, int fsid,
  1028. uid_t anonu, uid_t anong, struct nfsd4_fs_locations *fsloc)
  1029. {
  1030. show_expflags(m, flag, NFSEXP_ALLFLAGS);
  1031. if (flag & NFSEXP_FSID)
  1032. seq_printf(m, ",fsid=%d", fsid);
  1033. if (anonu != (uid_t)-2 && anonu != (0x10000-2))
  1034. seq_printf(m, ",anonuid=%u", anonu);
  1035. if (anong != (gid_t)-2 && anong != (0x10000-2))
  1036. seq_printf(m, ",anongid=%u", anong);
  1037. if (fsloc && fsloc->locations_count > 0) {
  1038. char *loctype = (fsloc->migrated) ? "refer" : "replicas";
  1039. int i;
  1040. seq_printf(m, ",%s=", loctype);
  1041. seq_escape(m, fsloc->locations[0].path, ",;@ \t\n\\");
  1042. seq_putc(m, '@');
  1043. seq_escape(m, fsloc->locations[0].hosts, ",;@ \t\n\\");
  1044. for (i = 1; i < fsloc->locations_count; i++) {
  1045. seq_putc(m, ';');
  1046. seq_escape(m, fsloc->locations[i].path, ",;@ \t\n\\");
  1047. seq_putc(m, '@');
  1048. seq_escape(m, fsloc->locations[i].hosts, ",;@ \t\n\\");
  1049. }
  1050. }
  1051. }
  1052. static int e_show(struct seq_file *m, void *p)
  1053. {
  1054. struct cache_head *cp = p;
  1055. struct svc_export *exp = container_of(cp, struct svc_export, h);
  1056. struct cache_detail *cd = m->private;
  1057. if (p == SEQ_START_TOKEN) {
  1058. seq_puts(m, "# Version 1.1\n");
  1059. seq_puts(m, "# Path Client(Flags) # IPs\n");
  1060. return 0;
  1061. }
  1062. cache_get(&exp->h);
  1063. if (cache_check(cd, &exp->h, NULL))
  1064. return 0;
  1065. exp_put(exp);
  1066. return svc_export_show(m, cd, cp);
  1067. }
  1068. const struct seq_operations nfs_exports_op = {
  1069. .start = e_start,
  1070. .next = e_next,
  1071. .stop = e_stop,
  1072. .show = e_show,
  1073. };
  1074. /*
  1075. * Initialize the exports module.
  1076. */
  1077. int
  1078. nfsd_export_init(struct net *net)
  1079. {
  1080. int rv;
  1081. dprintk("nfsd: initializing export module (net: %p).\n", net);
  1082. rv = cache_register_net(&svc_export_cache, net);
  1083. if (rv)
  1084. return rv;
  1085. rv = cache_register_net(&svc_expkey_cache, net);
  1086. if (rv)
  1087. cache_unregister_net(&svc_export_cache, net);
  1088. return rv;
  1089. }
  1090. /*
  1091. * Flush exports table - called when last nfsd thread is killed
  1092. */
  1093. void
  1094. nfsd_export_flush(void)
  1095. {
  1096. cache_purge(&svc_expkey_cache);
  1097. cache_purge(&svc_export_cache);
  1098. }
  1099. /*
  1100. * Shutdown the exports module.
  1101. */
  1102. void
  1103. nfsd_export_shutdown(struct net *net)
  1104. {
  1105. dprintk("nfsd: shutting down export module (net: %p).\n", net);
  1106. cache_unregister_net(&svc_expkey_cache, net);
  1107. cache_unregister_net(&svc_export_cache, net);
  1108. svcauth_unix_purge();
  1109. dprintk("nfsd: export shutdown complete (net: %p).\n", net);
  1110. }