Merge branch 'for-3.3' of git://linux-nfs.org/~bfields/linux
[linux-2.6.git] / fs / nfsd / nfs4recover.c
index 80a0be9..0b3e875 100644 (file)
@@ -117,8 +117,7 @@ out_no_tfm:
        return status;
 }
 
-int
-nfsd4_create_clid_dir(struct nfs4_client *clp)
+void nfsd4_create_clid_dir(struct nfs4_client *clp)
 {
        const struct cred *original_cred;
        char *dname = clp->cl_recdir;
@@ -127,13 +126,14 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
 
        dprintk("NFSD: nfsd4_create_clid_dir for \"%s\"\n", dname);
 
-       if (!rec_file || clp->cl_firststate)
-               return 0;
-
+       if (clp->cl_firststate)
+               return;
        clp->cl_firststate = 1;
+       if (!rec_file)
+               return;
        status = nfs4_save_creds(&original_cred);
        if (status < 0)
-               return status;
+               return;
 
        dir = rec_file->f_path.dentry;
        /* lock the parent */
@@ -144,8 +144,15 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
                status = PTR_ERR(dentry);
                goto out_unlock;
        }
-       status = -EEXIST;
        if (dentry->d_inode)
+               /*
+                * In the 4.1 case, where we're called from
+                * reclaim_complete(), records from the previous reboot
+                * may still be left, so this is OK.
+                *
+                * In the 4.0 case, we should never get here; but we may
+                * as well be forgiving and just succeed silently.
+                */
                goto out_put;
        status = mnt_want_write_file(rec_file);
        if (status)
@@ -164,7 +171,6 @@ out_unlock:
                                " and is writeable", status,
                                user_recovery_dirname);
        nfs4_reset_creds(original_cred);
-       return status;
 }
 
 typedef int (recdir_func)(struct dentry *, struct dentry *);