patch-2.1.120 linux/fs/nfsd/export.c

Next file: linux/fs/nfsd/lockd.c
Previous file: linux/fs/nfs/write.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.119/linux/fs/nfsd/export.c linux/fs/nfsd/export.c
@@ -392,14 +392,15 @@
 int
 exp_rootfh(struct svc_client *clp, kdev_t dev, ino_t ino, struct knfs_fh *f)
 {
-	struct svc_export	*exp = NULL;
-	struct svc_fh		fh;
+	struct svc_export	*exp;
 	struct dentry		*dentry;
 	struct inode		*inode;
+	struct svc_fh		fh;
 
 	dprintk("nfsd: exp_rootfh(%s:%x/%ld)\n", clp->cl_ident, dev, ino);
 
-	if (!(exp = exp_get(clp, dev, ino)))
+	exp = exp_get(clp, dev, ino);
+	if (!exp)
 		return -EPERM;
 
 	dentry = exp->ex_dentry;
@@ -414,8 +415,11 @@
 		       dev, ino, inode->i_dev, inode->i_ino);
 	}
 
-	dget(dentry);
-	fh_compose(&fh, exp, dentry);
+	/*
+	 * fh must be initialized before calling fh_compose
+	 */
+	fh_init(&fh);
+	fh_compose(&fh, exp, dget(dentry));
 	memcpy(f, &fh.fh_handle, sizeof(struct knfs_fh));
 	fh_put(&fh);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov