Skip to content

Commit b009a87

Browse files
bfieldsLinus Torvalds
authored andcommitted
[PATCH] knfsd: nfsd: store export path in export
Store the export path in the svc_export structure instead of storing only the dentry. This will prevent the need for additional d_path calls to provide NFSv4 fs_locations support. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 21c0d8f commit b009a87

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎fs/nfsd/export.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ static void svc_export_put(struct kref *ref)
325325
dput(exp->ex_dentry);
326326
mntput(exp->ex_mnt);
327327
auth_domain_put(exp->ex_client);
328+
kfree(exp->ex_path);
328329
kfree(exp);
329330
}
330331

@@ -398,6 +399,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
398399
int an_int;
399400

400401
nd.dentry = NULL;
402+
exp.ex_path = NULL;
401403

402404
if (mesg[mlen-1] != '\n')
403405
return -EINVAL;
@@ -428,6 +430,10 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
428430
exp.ex_client = dom;
429431
exp.ex_mnt = nd.mnt;
430432
exp.ex_dentry = nd.dentry;
433+
exp.ex_path = kstrdup(buf, GFP_KERNEL);
434+
err = -ENOMEM;
435+
if (!exp.ex_path)
436+
goto out;
431437

432438
/* expiry */
433439
err = -EINVAL;
@@ -473,6 +479,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
473479
else
474480
exp_put(expp);
475481
out:
482+
kfree(exp.ex_path);
476483
if (nd.dentry)
477484
path_release(&nd);
478485
out_no_path:
@@ -524,6 +531,7 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
524531
new->ex_client = item->ex_client;
525532
new->ex_dentry = dget(item->ex_dentry);
526533
new->ex_mnt = mntget(item->ex_mnt);
534+
new->ex_path = NULL;
527535
}
528536

529537
static void export_update(struct cache_head *cnew, struct cache_head *citem)
@@ -535,6 +543,8 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem)
535543
new->ex_anon_uid = item->ex_anon_uid;
536544
new->ex_anon_gid = item->ex_anon_gid;
537545
new->ex_fsid = item->ex_fsid;
546+
new->ex_path = item->ex_path;
547+
item->ex_path = NULL;
538548
}
539549

540550
static struct cache_head *svc_export_alloc(void)

‎include/linux/nfsd/export.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct svc_export {
5151
int ex_flags;
5252
struct vfsmount * ex_mnt;
5353
struct dentry * ex_dentry;
54+
char * ex_path;
5455
uid_t ex_anon_uid;
5556
gid_t ex_anon_gid;
5657
int ex_fsid;

0 commit comments

Comments
 (0)