aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4recover.c
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2008-02-15 17:37:34 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-04-19 00:25:33 -0400
commit0622753b800e4cc6cb9319b36b27658c72dd7cdc (patch)
tree5a32b65a087ff7fd5effa8d3f6f1f9717d4391aa /fs/nfsd/nfs4recover.c
parent49e0d02cf018d4edf24bfc8531a816a26367e4ce (diff)
[PATCH] r/o bind mounts: elevate write count for rmdir and unlink.
Elevate the write count during the vfs_rmdir() and vfs_unlink(). [AV: merged rmdir and unlink parts, added missing pieces in nfsd] Acked-by: Serge Hallyn <serue@us.ibm.com> Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd/nfs4recover.c')
-rw-r--r--fs/nfsd/nfs4recover.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1ff90625860f..4e77a1a3bd73 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -46,6 +46,7 @@
46#include <linux/scatterlist.h> 46#include <linux/scatterlist.h>
47#include <linux/crypto.h> 47#include <linux/crypto.h>
48#include <linux/sched.h> 48#include <linux/sched.h>
49#include <linux/mount.h>
49 50
50#define NFSDDBG_FACILITY NFSDDBG_PROC 51#define NFSDDBG_FACILITY NFSDDBG_PROC
51 52
@@ -313,12 +314,17 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
313 if (!rec_dir_init || !clp->cl_firststate) 314 if (!rec_dir_init || !clp->cl_firststate)
314 return; 315 return;
315 316
317 status = mnt_want_write(rec_dir.path.mnt);
318 if (status)
319 goto out;
316 clp->cl_firststate = 0; 320 clp->cl_firststate = 0;
317 nfs4_save_user(&uid, &gid); 321 nfs4_save_user(&uid, &gid);
318 status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1); 322 status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1);
319 nfs4_reset_user(uid, gid); 323 nfs4_reset_user(uid, gid);
320 if (status == 0) 324 if (status == 0)
321 nfsd4_sync_rec_dir(); 325 nfsd4_sync_rec_dir();
326 mnt_drop_write(rec_dir.path.mnt);
327out:
322 if (status) 328 if (status)
323 printk("NFSD: Failed to remove expired client state directory" 329 printk("NFSD: Failed to remove expired client state directory"
324 " %.*s\n", HEXDIR_LEN, clp->cl_recdir); 330 " %.*s\n", HEXDIR_LEN, clp->cl_recdir);
@@ -347,13 +353,17 @@ nfsd4_recdir_purge_old(void) {
347 353
348 if (!rec_dir_init) 354 if (!rec_dir_init)
349 return; 355 return;
356 status = mnt_want_write(rec_dir.path.mnt);
357 if (status)
358 goto out;
350 status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old); 359 status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old);
351 if (status == 0) 360 if (status == 0)
352 nfsd4_sync_rec_dir(); 361 nfsd4_sync_rec_dir();
362 mnt_drop_write(rec_dir.path.mnt);
363out:
353 if (status) 364 if (status)
354 printk("nfsd4: failed to purge old clients from recovery" 365 printk("nfsd4: failed to purge old clients from recovery"
355 " directory %s\n", rec_dir.path.dentry->d_name.name); 366 " directory %s\n", rec_dir.path.dentry->d_name.name);
356 return;
357} 367}
358 368
359static int 369static int