[PATCH] knfsd: nfsd4: fix open_confirm locking
[safe/jmp/linux-2.6] / fs / nfsd / nfsfh.c
index 7a3e397..ca96ede 100644 (file)
@@ -312,8 +312,8 @@ int
 fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh)
 {
        /* ref_fh is a reference file handle.
-        * if it is non-null, then we should compose a filehandle which is
-        * of the same version, where possible.
+        * if it is non-null and for the same filesystem, then we should compose
+        * a filehandle which is of the same version, where possible.
         * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca
         * Then create a 32byte filehandle using nfs_fhbase_old
         *
@@ -332,7 +332,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
                parent->d_name.name, dentry->d_name.name,
                (inode ? inode->i_ino : 0));
 
-       if (ref_fh) {
+       if (ref_fh && ref_fh->fh_export == exp) {
                ref_fh_version = ref_fh->fh_handle.fh_version;
                if (ref_fh_version == 0xca)
                        ref_fh_fsid_type = 0;
@@ -461,7 +461,7 @@ fh_update(struct svc_fh *fhp)
        } else {
                int size;
                if (fhp->fh_handle.fh_fileid_type != 0)
-                       goto out_uptodate;
+                       goto out;
                datap = fhp->fh_handle.fh_auth+
                        fhp->fh_handle.fh_size/4 -1;
                size = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
@@ -481,10 +481,6 @@ out_negative:
        printk(KERN_ERR "fh_update: %s/%s still negative!\n",
                dentry->d_parent->d_name.name, dentry->d_name.name);
        goto out;
-out_uptodate:
-       printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
-               dentry->d_parent->d_name.name, dentry->d_name.name);
-       goto out;
 }
 
 /*
@@ -506,7 +502,7 @@ fh_put(struct svc_fh *fhp)
                nfsd_nr_put++;
        }
        if (exp) {
-               svc_export_put(&exp->h, &svc_export_cache);
+               cache_put(&exp->h, &svc_export_cache);
                fhp->fh_export = NULL;
        }
        return;