aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4recover.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4recover.c')
-rw-r--r--fs/nfsd/nfs4recover.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 095f1740f3ae..57ed50fe7f85 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -119,25 +119,12 @@ out:
119 return status; 119 return status;
120} 120}
121 121
122static int 122static void
123nfsd4_rec_fsync(struct dentry *dentry) 123nfsd4_sync_rec_dir(void)
124{ 124{
125 struct file *filp; 125 down(&rec_dir.dentry->d_inode->i_sem);
126 int status = nfs_ok; 126 nfsd_sync_dir(rec_dir.dentry);
127 127 up(&rec_dir.dentry->d_inode->i_sem);
128 dprintk("NFSD: nfs4_fsync_rec_dir\n");
129 filp = dentry_open(dget(dentry), mntget(rec_dir.mnt), O_RDWR);
130 if (IS_ERR(filp)) {
131 status = PTR_ERR(filp);
132 goto out;
133 }
134 if (filp->f_op && filp->f_op->fsync)
135 status = filp->f_op->fsync(filp, filp->f_dentry, 0);
136 fput(filp);
137out:
138 if (status)
139 printk("nfsd4: unable to sync recovery directory\n");
140 return status;
141} 128}
142 129
143int 130int
@@ -176,7 +163,7 @@ out_unlock:
176 up(&rec_dir.dentry->d_inode->i_sem); 163 up(&rec_dir.dentry->d_inode->i_sem);
177 if (status == 0) { 164 if (status == 0) {
178 clp->cl_firststate = 1; 165 clp->cl_firststate = 1;
179 status = nfsd4_rec_fsync(rec_dir.dentry); 166 nfsd4_sync_rec_dir();
180 } 167 }
181 nfs4_reset_user(uid, gid); 168 nfs4_reset_user(uid, gid);
182 dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status); 169 dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status);
@@ -302,7 +289,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
302 289
303 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 290 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
304 291
292 down(&rec_dir.dentry->d_inode->i_sem);
305 dentry = lookup_one_len(name, rec_dir.dentry, namlen); 293 dentry = lookup_one_len(name, rec_dir.dentry, namlen);
294 up(&rec_dir.dentry->d_inode->i_sem);
306 if (IS_ERR(dentry)) { 295 if (IS_ERR(dentry)) {
307 status = PTR_ERR(dentry); 296 status = PTR_ERR(dentry);
308 return status; 297 return status;
@@ -327,11 +316,12 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
327 if (!rec_dir_init || !clp->cl_firststate) 316 if (!rec_dir_init || !clp->cl_firststate)
328 return; 317 return;
329 318
319 clp->cl_firststate = 0;
330 nfs4_save_user(&uid, &gid); 320 nfs4_save_user(&uid, &gid);
331 status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1); 321 status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1);
332 nfs4_reset_user(uid, gid); 322 nfs4_reset_user(uid, gid);
333 if (status == 0) 323 if (status == 0)
334 status = nfsd4_rec_fsync(rec_dir.dentry); 324 nfsd4_sync_rec_dir();
335 if (status) 325 if (status)
336 printk("NFSD: Failed to remove expired client state directory" 326 printk("NFSD: Failed to remove expired client state directory"
337 " %.*s\n", HEXDIR_LEN, clp->cl_recdir); 327 " %.*s\n", HEXDIR_LEN, clp->cl_recdir);
@@ -362,7 +352,7 @@ nfsd4_recdir_purge_old(void) {
362 return; 352 return;
363 status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old); 353 status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old);
364 if (status == 0) 354 if (status == 0)
365 status = nfsd4_rec_fsync(rec_dir.dentry); 355 nfsd4_sync_rec_dir();
366 if (status) 356 if (status)
367 printk("nfsd4: failed to purge old clients from recovery" 357 printk("nfsd4: failed to purge old clients from recovery"
368 " directory %s\n", rec_dir.dentry->d_name.name); 358 " directory %s\n", rec_dir.dentry->d_name.name);