aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorSteve Dickson <SteveD@redhat.com>2007-11-08 04:05:04 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:24 -0500
commitef818a28fac9bd214e676986d8301db0582b92a9 (patch)
treeb1825d1ecdfa6b35951a61f6bc54363236c12cd0 /fs/nfs/super.c
parent2f74c0a05612b9c2014b5b67833dba9b9f523948 (diff)
NFS: Stop sillyname renames and unmounts from racing
Added an active/deactive mechanism to the nfs_server structure allowing async operations to hold off umount until the operations are done. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 0b0c72a072ff..fda1635dd133 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -202,6 +202,7 @@ static int nfs_get_sb(struct file_system_type *, int, const char *, void *, stru
202static int nfs_xdev_get_sb(struct file_system_type *fs_type, 202static int nfs_xdev_get_sb(struct file_system_type *fs_type,
203 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 203 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
204static void nfs_kill_super(struct super_block *); 204static void nfs_kill_super(struct super_block *);
205static void nfs_put_super(struct super_block *);
205 206
206static struct file_system_type nfs_fs_type = { 207static struct file_system_type nfs_fs_type = {
207 .owner = THIS_MODULE, 208 .owner = THIS_MODULE,
@@ -223,6 +224,7 @@ static const struct super_operations nfs_sops = {
223 .alloc_inode = nfs_alloc_inode, 224 .alloc_inode = nfs_alloc_inode,
224 .destroy_inode = nfs_destroy_inode, 225 .destroy_inode = nfs_destroy_inode,
225 .write_inode = nfs_write_inode, 226 .write_inode = nfs_write_inode,
227 .put_super = nfs_put_super,
226 .statfs = nfs_statfs, 228 .statfs = nfs_statfs,
227 .clear_inode = nfs_clear_inode, 229 .clear_inode = nfs_clear_inode,
228 .umount_begin = nfs_umount_begin, 230 .umount_begin = nfs_umount_begin,
@@ -325,6 +327,28 @@ void __exit unregister_nfs_fs(void)
325 unregister_filesystem(&nfs_fs_type); 327 unregister_filesystem(&nfs_fs_type);
326} 328}
327 329
330void nfs_sb_active(struct nfs_server *server)
331{
332 atomic_inc(&server->active);
333}
334
335void nfs_sb_deactive(struct nfs_server *server)
336{
337 if (atomic_dec_and_test(&server->active))
338 wake_up(&server->active_wq);
339}
340
341static void nfs_put_super(struct super_block *sb)
342{
343 struct nfs_server *server = NFS_SB(sb);
344 /*
345 * Make sure there are no outstanding ops to this server.
346 * If so, wait for them to finish before allowing the
347 * unmount to continue.
348 */
349 wait_event(server->active_wq, atomic_read(&server->active) == 0);
350}
351
328/* 352/*
329 * Deliver file system statistics to userspace 353 * Deliver file system statistics to userspace
330 */ 354 */