Commit 9bb4ebc6 authored by Neil Brown's avatar Neil Brown Committed by David S. Miller

[PATCH] kNFSd 10: Discard ex_dev and ex_ino from svc_export

They can be deduced from ex_dentry
parent d42f5634
...@@ -70,15 +70,17 @@ static svc_client * clients; ...@@ -70,15 +70,17 @@ static svc_client * clients;
svc_export * svc_export *
exp_get(svc_client *clp, dev_t dev, ino_t ino) exp_get(svc_client *clp, dev_t dev, ino_t ino)
{ {
struct list_head *head, *p; struct list_head *head;
svc_export *exp;
if (!clp) if (!clp)
return NULL; return NULL;
head = &clp->cl_export[EXPORT_HASH(dev)]; head = &clp->cl_export[EXPORT_HASH(dev)];
list_for_each(p, head) { list_for_each_entry(exp, head, ex_hash) {
svc_export *exp = list_entry(p, svc_export, ex_hash); struct inode *inode = exp->ex_dentry->d_inode;
if (exp->ex_ino == ino && exp->ex_dev == dev) if (inode->i_ino == ino &&
inode->i_sb->s_dev == dev)
return exp; return exp;
} }
return NULL; return NULL;
...@@ -338,8 +340,6 @@ exp_export(struct nfsctl_export *nxp) ...@@ -338,8 +340,6 @@ exp_export(struct nfsctl_export *nxp)
exp->ex_mnt = mntget(nd.mnt); exp->ex_mnt = mntget(nd.mnt);
exp->ex_dentry = dget(nd.dentry); exp->ex_dentry = dget(nd.dentry);
exp->ex_flags = nxp->ex_flags; exp->ex_flags = nxp->ex_flags;
exp->ex_dev = dev;
exp->ex_ino = ino;
exp->ex_anon_uid = nxp->ex_anon_uid; exp->ex_anon_uid = nxp->ex_anon_uid;
exp->ex_anon_gid = nxp->ex_anon_gid; exp->ex_anon_gid = nxp->ex_anon_gid;
exp->ex_fsid = nxp->ex_dev; exp->ex_fsid = nxp->ex_dev;
...@@ -376,8 +376,6 @@ exp_do_unexport(svc_export *unexp) ...@@ -376,8 +376,6 @@ exp_do_unexport(svc_export *unexp)
dentry = unexp->ex_dentry; dentry = unexp->ex_dentry;
mnt = unexp->ex_mnt; mnt = unexp->ex_mnt;
inode = dentry->d_inode; inode = dentry->d_inode;
if (unexp->ex_dev != inode->i_sb->s_dev || unexp->ex_ino != inode->i_ino)
printk(KERN_WARNING "nfsd: bad dentry in unexport!\n");
dput(dentry); dput(dentry);
mntput(mnt); mntput(mnt);
......
...@@ -322,9 +322,11 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st ...@@ -322,9 +322,11 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
struct inode * inode = dentry->d_inode; struct inode * inode = dentry->d_inode;
struct dentry *parent = dentry->d_parent; struct dentry *parent = dentry->d_parent;
__u32 *datap; __u32 *datap;
dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev;
dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
MAJOR(exp->ex_dev), MINOR(exp->ex_dev), (long) exp->ex_ino, MAJOR(ex_dev), MINOR(ex_dev),
(long) exp->ex_dentry->d_inode->i_ino,
parent->d_name.name, dentry->d_name.name, parent->d_name.name, dentry->d_name.name,
(inode ? inode->i_ino : 0)); (inode ? inode->i_ino : 0));
...@@ -351,9 +353,9 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st ...@@ -351,9 +353,9 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE);
fhp->fh_handle.fh_size = NFS_FHSIZE; fhp->fh_handle.fh_size = NFS_FHSIZE;
fhp->fh_handle.ofh_dcookie = 0xfeebbaca; fhp->fh_handle.ofh_dcookie = 0xfeebbaca;
fhp->fh_handle.ofh_dev = htonl((MAJOR(exp->ex_dev)<<16)| MINOR(exp->ex_dev)); fhp->fh_handle.ofh_dev = htonl((MAJOR(ex_dev)<<16)| MINOR(ex_dev));
fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_ino); fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_dentry->d_inode->i_ino);
fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
if (inode) if (inode)
_fh_update_old(dentry, exp, &fhp->fh_handle); _fh_update_old(dentry, exp, &fhp->fh_handle);
...@@ -370,8 +372,8 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st ...@@ -370,8 +372,8 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
} else { } else {
fhp->fh_handle.fh_fsid_type = 0; fhp->fh_handle.fh_fsid_type = 0;
/* fsid_type 0 == 2byte major, 2byte minor, 4byte inode */ /* fsid_type 0 == 2byte major, 2byte minor, 4byte inode */
*datap++ = htonl((MAJOR(exp->ex_dev)<<16)| MINOR(exp->ex_dev)); *datap++ = htonl((MAJOR(ex_dev)<<16)| MINOR(ex_dev));
*datap++ = ino_t_to_u32(exp->ex_ino); *datap++ = ino_t_to_u32(exp->ex_dentry->d_inode->i_ino);
fhp->fh_handle.fh_size = 3*4; fhp->fh_handle.fh_size = 3*4;
} }
if (inode) { if (inode) {
......
...@@ -64,8 +64,6 @@ struct svc_export { ...@@ -64,8 +64,6 @@ struct svc_export {
int ex_flags; int ex_flags;
struct vfsmount * ex_mnt; struct vfsmount * ex_mnt;
struct dentry * ex_dentry; struct dentry * ex_dentry;
dev_t ex_dev;
ino_t ex_ino;
uid_t ex_anon_uid; uid_t ex_anon_uid;
gid_t ex_anon_gid; gid_t ex_anon_gid;
int ex_fsid; int ex_fsid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment