aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4recover.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-08-12 20:30:12 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-08-27 14:21:21 -0400
commit6577aac01f00636c16cd583c30bd4dedf18475d5 (patch)
treecd7aef18e8be2615179638c036172958b0597252 /fs/nfsd/nfs4recover.c
parent48483bf23a568f3ef4cc7ad2c8f1a082f10ad0e7 (diff)
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: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4recover.c')
-rw-r--r--fs/nfsd/nfs4recover.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index c3466610e6cd..493851b844fe 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -130,6 +130,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
130 if (!rec_file || clp->cl_firststate) 130 if (!rec_file || clp->cl_firststate)
131 return 0; 131 return 0;
132 132
133 clp->cl_firststate = 1;
133 status = nfs4_save_creds(&original_cred); 134 status = nfs4_save_creds(&original_cred);
134 if (status < 0) 135 if (status < 0)
135 return status; 136 return status;
@@ -144,10 +145,8 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
144 goto out_unlock; 145 goto out_unlock;
145 } 146 }
146 status = -EEXIST; 147 status = -EEXIST;
147 if (dentry->d_inode) { 148 if (dentry->d_inode)
148 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
149 goto out_put; 149 goto out_put;
150 }
151 status = mnt_want_write(rec_file->f_path.mnt); 150 status = mnt_want_write(rec_file->f_path.mnt);
152 if (status) 151 if (status)
153 goto out_put; 152 goto out_put;
@@ -157,12 +156,14 @@ out_put:
157 dput(dentry); 156 dput(dentry);
158out_unlock: 157out_unlock:
159 mutex_unlock(&dir->d_inode->i_mutex); 158 mutex_unlock(&dir->d_inode->i_mutex);
160 if (status == 0) { 159 if (status == 0)
161 clp->cl_firststate = 1;
162 vfs_fsync(rec_file, 0); 160 vfs_fsync(rec_file, 0);
163 } 161 else
162 printk(KERN_ERR "NFSD: failed to write recovery record"
163 " (err %d); please check that %s exists"
164 " and is writeable", status,
165 user_recovery_dirname);
164 nfs4_reset_creds(original_cred); 166 nfs4_reset_creds(original_cred);
165 dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status);
166 return status; 167 return status;
167} 168}
168 169