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.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 954cf893d50c..06da7506363c 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -121,9 +121,9 @@ out:
121static void 121static void
122nfsd4_sync_rec_dir(void) 122nfsd4_sync_rec_dir(void)
123{ 123{
124 down(&rec_dir.dentry->d_inode->i_sem); 124 mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
125 nfsd_sync_dir(rec_dir.dentry); 125 nfsd_sync_dir(rec_dir.dentry);
126 up(&rec_dir.dentry->d_inode->i_sem); 126 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
127} 127}
128 128
129int 129int
@@ -143,7 +143,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
143 nfs4_save_user(&uid, &gid); 143 nfs4_save_user(&uid, &gid);
144 144
145 /* lock the parent */ 145 /* lock the parent */
146 down(&rec_dir.dentry->d_inode->i_sem); 146 mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
147 147
148 dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1); 148 dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1);
149 if (IS_ERR(dentry)) { 149 if (IS_ERR(dentry)) {
@@ -159,7 +159,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
159out_put: 159out_put:
160 dput(dentry); 160 dput(dentry);
161out_unlock: 161out_unlock:
162 up(&rec_dir.dentry->d_inode->i_sem); 162 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
163 if (status == 0) { 163 if (status == 0) {
164 clp->cl_firststate = 1; 164 clp->cl_firststate = 1;
165 nfsd4_sync_rec_dir(); 165 nfsd4_sync_rec_dir();
@@ -222,8 +222,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
222 222
223 nfs4_save_user(&uid, &gid); 223 nfs4_save_user(&uid, &gid);
224 224
225 filp = dentry_open(dget(dir), mntget(rec_dir.mnt), 225 filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY);
226 O_RDWR);
227 status = PTR_ERR(filp); 226 status = PTR_ERR(filp);
228 if (IS_ERR(filp)) 227 if (IS_ERR(filp))
229 goto out; 228 goto out;
@@ -259,9 +258,9 @@ nfsd4_remove_clid_file(struct dentry *dir, struct dentry *dentry)
259 printk("nfsd4: non-file found in client recovery directory\n"); 258 printk("nfsd4: non-file found in client recovery directory\n");
260 return -EINVAL; 259 return -EINVAL;
261 } 260 }
262 down(&dir->d_inode->i_sem); 261 mutex_lock(&dir->d_inode->i_mutex);
263 status = vfs_unlink(dir->d_inode, dentry); 262 status = vfs_unlink(dir->d_inode, dentry);
264 up(&dir->d_inode->i_sem); 263 mutex_unlock(&dir->d_inode->i_mutex);
265 return status; 264 return status;
266} 265}
267 266
@@ -274,9 +273,9 @@ nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry)
274 * any regular files anyway, just in case the directory was created by 273 * any regular files anyway, just in case the directory was created by
275 * a kernel from the future.... */ 274 * a kernel from the future.... */
276 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file); 275 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
277 down(&dir->d_inode->i_sem); 276 mutex_lock(&dir->d_inode->i_mutex);
278 status = vfs_rmdir(dir->d_inode, dentry); 277 status = vfs_rmdir(dir->d_inode, dentry);
279 up(&dir->d_inode->i_sem); 278 mutex_unlock(&dir->d_inode->i_mutex);
280 return status; 279 return status;
281} 280}
282 281
@@ -288,9 +287,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
288 287
289 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 288 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
290 289
291 down(&rec_dir.dentry->d_inode->i_sem); 290 mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
292 dentry = lookup_one_len(name, rec_dir.dentry, namlen); 291 dentry = lookup_one_len(name, rec_dir.dentry, namlen);
293 up(&rec_dir.dentry->d_inode->i_sem); 292 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
294 if (IS_ERR(dentry)) { 293 if (IS_ERR(dentry)) {
295 status = PTR_ERR(dentry); 294 status = PTR_ERR(dentry);
296 return status; 295 return status;
@@ -400,9 +399,10 @@ nfsd4_init_recdir(char *rec_dirname)
400 399
401 nfs4_save_user(&uid, &gid); 400 nfs4_save_user(&uid, &gid);
402 401
403 status = path_lookup(rec_dirname, LOOKUP_FOLLOW, &rec_dir); 402 status = path_lookup(rec_dirname, LOOKUP_FOLLOW | LOOKUP_DIRECTORY,
404 if (status == -ENOENT) 403 &rec_dir);
405 printk("NFSD: recovery directory %s doesn't exist\n", 404 if (status)
405 printk("NFSD: unable to find recovery directory %s\n",
406 rec_dirname); 406 rec_dirname);
407 407
408 if (!status) 408 if (!status)