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.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6d2f2a3eccf8..db5d96dc6107 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -514,7 +514,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
514 return ctx; 514 return ctx;
515} 515}
516 516
517void put_nfs_open_context(struct nfs_open_context *ctx) 517static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait)
518{ 518{
519 struct inode *inode = ctx->path.dentry->d_inode; 519 struct inode *inode = ctx->path.dentry->d_inode;
520 520
@@ -522,8 +522,12 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
522 return; 522 return;
523 list_del(&ctx->list); 523 list_del(&ctx->list);
524 spin_unlock(&inode->i_lock); 524 spin_unlock(&inode->i_lock);
525 if (ctx->state != NULL) 525 if (ctx->state != NULL) {
526 nfs4_close_state(&ctx->path, ctx->state, ctx->mode); 526 if (wait)
527 nfs4_close_sync(&ctx->path, ctx->state, ctx->mode);
528 else
529 nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
530 }
527 if (ctx->cred != NULL) 531 if (ctx->cred != NULL)
528 put_rpccred(ctx->cred); 532 put_rpccred(ctx->cred);
529 dput(ctx->path.dentry); 533 dput(ctx->path.dentry);
@@ -531,6 +535,16 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
531 kfree(ctx); 535 kfree(ctx);
532} 536}
533 537
538void put_nfs_open_context(struct nfs_open_context *ctx)
539{
540 __put_nfs_open_context(ctx, 0);
541}
542
543static void put_nfs_open_context_sync(struct nfs_open_context *ctx)
544{
545 __put_nfs_open_context(ctx, 1);
546}
547
534/* 548/*
535 * Ensure that mmap has a recent RPC credential for use when writing out 549 * Ensure that mmap has a recent RPC credential for use when writing out
536 * shared pages 550 * shared pages
@@ -577,7 +591,7 @@ static void nfs_file_clear_open_context(struct file *filp)
577 spin_lock(&inode->i_lock); 591 spin_lock(&inode->i_lock);
578 list_move_tail(&ctx->list, &NFS_I(inode)->open_files); 592 list_move_tail(&ctx->list, &NFS_I(inode)->open_files);
579 spin_unlock(&inode->i_lock); 593 spin_unlock(&inode->i_lock);
580 put_nfs_open_context(ctx); 594 put_nfs_open_context_sync(ctx);
581 } 595 }
582} 596}
583 597
@@ -1169,6 +1183,9 @@ static void init_once(struct kmem_cache * cachep, void *foo)
1169 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); 1183 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
1170 nfsi->ncommit = 0; 1184 nfsi->ncommit = 0;
1171 nfsi->npages = 0; 1185 nfsi->npages = 0;
1186 atomic_set(&nfsi->silly_count, 1);
1187 INIT_HLIST_HEAD(&nfsi->silly_list);
1188 init_waitqueue_head(&nfsi->waitqueue);
1172 nfs4_init_once(nfsi); 1189 nfs4_init_once(nfsi);
1173} 1190}
1174 1191