diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/client.c | 3 | ||||
-rw-r--r-- | fs/nfs/internal.h | 2 | ||||
-rw-r--r-- | fs/nfs/super.c | 24 | ||||
-rw-r--r-- | fs/nfs/unlink.c | 4 |
4 files changed, 33 insertions, 0 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index a6f625497612..c3740f5ab978 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -729,6 +729,9 @@ static struct nfs_server *nfs_alloc_server(void) | |||
729 | INIT_LIST_HEAD(&server->client_link); | 729 | INIT_LIST_HEAD(&server->client_link); |
730 | INIT_LIST_HEAD(&server->master_link); | 730 | INIT_LIST_HEAD(&server->master_link); |
731 | 731 | ||
732 | init_waitqueue_head(&server->active_wq); | ||
733 | atomic_set(&server->active, 0); | ||
734 | |||
732 | server->io_stats = nfs_alloc_iostats(); | 735 | server->io_stats = nfs_alloc_iostats(); |
733 | if (!server->io_stats) { | 736 | if (!server->io_stats) { |
734 | kfree(server); | 737 | kfree(server); |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index f3acf48412be..75793794aefe 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -160,6 +160,8 @@ extern struct rpc_stat nfs_rpcstat; | |||
160 | 160 | ||
161 | extern int __init register_nfs_fs(void); | 161 | extern int __init register_nfs_fs(void); |
162 | extern void __exit unregister_nfs_fs(void); | 162 | extern void __exit unregister_nfs_fs(void); |
163 | extern void nfs_sb_active(struct nfs_server *server); | ||
164 | extern void nfs_sb_deactive(struct nfs_server *server); | ||
163 | 165 | ||
164 | /* namespace.c */ | 166 | /* namespace.c */ |
165 | extern char *nfs_path(const char *base, | 167 | extern char *nfs_path(const char *base, |
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 | |||
202 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, | 202 | static 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); |
204 | static void nfs_kill_super(struct super_block *); | 204 | static void nfs_kill_super(struct super_block *); |
205 | static void nfs_put_super(struct super_block *); | ||
205 | 206 | ||
206 | static struct file_system_type nfs_fs_type = { | 207 | static 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 | ||
330 | void nfs_sb_active(struct nfs_server *server) | ||
331 | { | ||
332 | atomic_inc(&server->active); | ||
333 | } | ||
334 | |||
335 | void nfs_sb_deactive(struct nfs_server *server) | ||
336 | { | ||
337 | if (atomic_dec_and_test(&server->active)) | ||
338 | wake_up(&server->active_wq); | ||
339 | } | ||
340 | |||
341 | static 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 | */ |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 431981d0265f..8e5428e0b86f 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/wait.h> | 15 | #include <linux/wait.h> |
16 | 16 | ||
17 | #include "internal.h" | ||
18 | |||
17 | struct nfs_unlinkdata { | 19 | struct nfs_unlinkdata { |
18 | struct hlist_node list; | 20 | struct hlist_node list; |
19 | struct nfs_removeargs args; | 21 | struct nfs_removeargs args; |
@@ -113,6 +115,7 @@ static void nfs_async_unlink_release(void *calldata) | |||
113 | struct nfs_unlinkdata *data = calldata; | 115 | struct nfs_unlinkdata *data = calldata; |
114 | 116 | ||
115 | nfs_dec_sillycount(data->dir); | 117 | nfs_dec_sillycount(data->dir); |
118 | nfs_sb_deactive(NFS_SERVER(data->dir)); | ||
116 | nfs_free_unlinkdata(data); | 119 | nfs_free_unlinkdata(data); |
117 | } | 120 | } |
118 | 121 | ||
@@ -153,6 +156,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n | |||
153 | nfs_dec_sillycount(dir); | 156 | nfs_dec_sillycount(dir); |
154 | return 0; | 157 | return 0; |
155 | } | 158 | } |
159 | nfs_sb_active(NFS_SERVER(dir)); | ||
156 | data->args.fh = NFS_FH(dir); | 160 | data->args.fh = NFS_FH(dir); |
157 | nfs_fattr_init(&data->res.dir_attr); | 161 | nfs_fattr_init(&data->res.dir_attr); |
158 | 162 | ||