aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6f88d7c77ac9..5cb3345eb694 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -523,8 +523,12 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
523 523
524static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) 524static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait)
525{ 525{
526 struct inode *inode = ctx->path.dentry->d_inode; 526 struct inode *inode;
527 527
528 if (ctx == NULL)
529 return;
530
531 inode = ctx->path.dentry->d_inode;
528 if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock)) 532 if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock))
529 return; 533 return;
530 list_del(&ctx->list); 534 list_del(&ctx->list);
@@ -610,7 +614,7 @@ int nfs_open(struct inode *inode, struct file *filp)
610 struct nfs_open_context *ctx; 614 struct nfs_open_context *ctx;
611 struct rpc_cred *cred; 615 struct rpc_cred *cred;
612 616
613 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); 617 cred = rpc_lookup_cred();
614 if (IS_ERR(cred)) 618 if (IS_ERR(cred))
615 return PTR_ERR(cred); 619 return PTR_ERR(cred);
616 ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred); 620 ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred);
@@ -1218,6 +1222,36 @@ static void nfs_destroy_inodecache(void)
1218 kmem_cache_destroy(nfs_inode_cachep); 1222 kmem_cache_destroy(nfs_inode_cachep);
1219} 1223}
1220 1224
1225struct workqueue_struct *nfsiod_workqueue;
1226
1227/*
1228 * start up the nfsiod workqueue
1229 */
1230static int nfsiod_start(void)
1231{
1232 struct workqueue_struct *wq;
1233 dprintk("RPC: creating workqueue nfsiod\n");
1234 wq = create_singlethread_workqueue("nfsiod");
1235 if (wq == NULL)
1236 return -ENOMEM;
1237 nfsiod_workqueue = wq;
1238 return 0;
1239}
1240
1241/*
1242 * Destroy the nfsiod workqueue
1243 */
1244static void nfsiod_stop(void)
1245{
1246 struct workqueue_struct *wq;
1247
1248 wq = nfsiod_workqueue;
1249 if (wq == NULL)
1250 return;
1251 nfsiod_workqueue = NULL;
1252 destroy_workqueue(wq);
1253}
1254
1221/* 1255/*
1222 * Initialize NFS 1256 * Initialize NFS
1223 */ 1257 */
@@ -1225,6 +1259,10 @@ static int __init init_nfs_fs(void)
1225{ 1259{
1226 int err; 1260 int err;
1227 1261
1262 err = nfsiod_start();
1263 if (err)
1264 goto out6;
1265
1228 err = nfs_fs_proc_init(); 1266 err = nfs_fs_proc_init();
1229 if (err) 1267 if (err)
1230 goto out5; 1268 goto out5;
@@ -1271,6 +1309,8 @@ out3:
1271out4: 1309out4:
1272 nfs_fs_proc_exit(); 1310 nfs_fs_proc_exit();
1273out5: 1311out5:
1312 nfsiod_stop();
1313out6:
1274 return err; 1314 return err;
1275} 1315}
1276 1316
@@ -1286,6 +1326,7 @@ static void __exit exit_nfs_fs(void)
1286#endif 1326#endif
1287 unregister_nfs_fs(); 1327 unregister_nfs_fs();
1288 nfs_fs_proc_exit(); 1328 nfs_fs_proc_exit();
1329 nfsiod_stop();
1289} 1330}
1290 1331
1291/* Not quite true; I just maintain it */ 1332/* Not quite true; I just maintain it */