Commit 6577aac0 authored by Boaz Harrosh's avatar Boaz Harrosh Committed by J. Bruce Fields

nfsd4: fix failure to end nfsd4 grace period

Even if we fail to write a recovery record, we should still mark the
client as having acquired its first state.  Otherwise we leave 4.1
clients with indefinite ERR_GRACE returns.

However, an inability to write stable storage records may cause failures
of reboot recovery, and the problem should still be brought to the
server administrator's attention.

So, make sure the error is logged.

These errors shouldn't normally be triggered on a corectly functioning
server--this isn't a case where a misconfigured client could spam the
logs.
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 48483bf2
...@@ -130,6 +130,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) ...@@ -130,6 +130,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
if (!rec_file || clp->cl_firststate) if (!rec_file || clp->cl_firststate)
return 0; return 0;
clp->cl_firststate = 1;
status = nfs4_save_creds(&original_cred); status = nfs4_save_creds(&original_cred);
if (status < 0) if (status < 0)
return status; return status;
...@@ -144,10 +145,8 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) ...@@ -144,10 +145,8 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
goto out_unlock; goto out_unlock;
} }
status = -EEXIST; status = -EEXIST;
if (dentry->d_inode) { if (dentry->d_inode)
dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
goto out_put; goto out_put;
}
status = mnt_want_write(rec_file->f_path.mnt); status = mnt_want_write(rec_file->f_path.mnt);
if (status) if (status)
goto out_put; goto out_put;
...@@ -157,12 +156,14 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) ...@@ -157,12 +156,14 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
dput(dentry); dput(dentry);
out_unlock: out_unlock:
mutex_unlock(&dir->d_inode->i_mutex); mutex_unlock(&dir->d_inode->i_mutex);
if (status == 0) { if (status == 0)
clp->cl_firststate = 1;
vfs_fsync(rec_file, 0); vfs_fsync(rec_file, 0);
} else
printk(KERN_ERR "NFSD: failed to write recovery record"
" (err %d); please check that %s exists"
" and is writeable", status,
user_recovery_dirname);
nfs4_reset_creds(original_cred); nfs4_reset_creds(original_cred);
dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status);
return status; return status;
} }
......
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