aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-22 18:40:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-20 01:43:44 -0400
commit3d4ff43d895c50319af45eb4bf04a4618eccdf76 (patch)
treeb412cd076920a903a854a20bceed4a0ce511fd13 /fs/nfs/inode.c
parent82a2c1b77ada3b81911deeb871719ec5ff77f83c (diff)
nfs_open_context doesn't need struct path either
just dentry, please... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6f4850deb272..fe1203797b2b 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -567,7 +567,7 @@ static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context
567struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx) 567struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx)
568{ 568{
569 struct nfs_lock_context *res, *new = NULL; 569 struct nfs_lock_context *res, *new = NULL;
570 struct inode *inode = ctx->path.dentry->d_inode; 570 struct inode *inode = ctx->dentry->d_inode;
571 571
572 spin_lock(&inode->i_lock); 572 spin_lock(&inode->i_lock);
573 res = __nfs_find_lock_context(ctx); 573 res = __nfs_find_lock_context(ctx);
@@ -594,7 +594,7 @@ struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx)
594void nfs_put_lock_context(struct nfs_lock_context *l_ctx) 594void nfs_put_lock_context(struct nfs_lock_context *l_ctx)
595{ 595{
596 struct nfs_open_context *ctx = l_ctx->open_context; 596 struct nfs_open_context *ctx = l_ctx->open_context;
597 struct inode *inode = ctx->path.dentry->d_inode; 597 struct inode *inode = ctx->dentry->d_inode;
598 598
599 if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock)) 599 if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock))
600 return; 600 return;
@@ -620,7 +620,7 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync)
620 return; 620 return;
621 if (!is_sync) 621 if (!is_sync)
622 return; 622 return;
623 inode = ctx->path.dentry->d_inode; 623 inode = ctx->dentry->d_inode;
624 if (!list_empty(&NFS_I(inode)->open_files)) 624 if (!list_empty(&NFS_I(inode)->open_files))
625 return; 625 return;
626 server = NFS_SERVER(inode); 626 server = NFS_SERVER(inode);
@@ -629,14 +629,14 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync)
629 nfs_revalidate_inode(server, inode); 629 nfs_revalidate_inode(server, inode);
630} 630}
631 631
632struct nfs_open_context *alloc_nfs_open_context(struct path *path, struct rpc_cred *cred, fmode_t f_mode) 632struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode)
633{ 633{
634 struct nfs_open_context *ctx; 634 struct nfs_open_context *ctx;
635 635
636 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); 636 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
637 if (ctx != NULL) { 637 if (ctx != NULL) {
638 ctx->path = *path; 638 nfs_sb_active(dentry->d_sb);
639 path_get(&ctx->path); 639 ctx->dentry = dget(dentry);
640 ctx->cred = get_rpccred(cred); 640 ctx->cred = get_rpccred(cred);
641 ctx->state = NULL; 641 ctx->state = NULL;
642 ctx->mode = f_mode; 642 ctx->mode = f_mode;
@@ -658,7 +658,8 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
658 658
659static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) 659static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
660{ 660{
661 struct inode *inode = ctx->path.dentry->d_inode; 661 struct inode *inode = ctx->dentry->d_inode;
662 struct super_block *sb = ctx->dentry->d_sb;
662 663
663 if (!list_empty(&ctx->list)) { 664 if (!list_empty(&ctx->list)) {
664 if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock)) 665 if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock))
@@ -671,7 +672,8 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
671 NFS_PROTO(inode)->close_context(ctx, is_sync); 672 NFS_PROTO(inode)->close_context(ctx, is_sync);
672 if (ctx->cred != NULL) 673 if (ctx->cred != NULL)
673 put_rpccred(ctx->cred); 674 put_rpccred(ctx->cred);
674 path_put(&ctx->path); 675 dput(ctx->dentry);
676 nfs_sb_deactive(sb);
675 kfree(ctx); 677 kfree(ctx);
676} 678}
677 679
@@ -741,7 +743,7 @@ int nfs_open(struct inode *inode, struct file *filp)
741 cred = rpc_lookup_cred(); 743 cred = rpc_lookup_cred();
742 if (IS_ERR(cred)) 744 if (IS_ERR(cred))
743 return PTR_ERR(cred); 745 return PTR_ERR(cred);
744 ctx = alloc_nfs_open_context(&filp->f_path, cred, filp->f_mode); 746 ctx = alloc_nfs_open_context(filp->f_path.dentry, cred, filp->f_mode);
745 put_rpccred(cred); 747 put_rpccred(cred);
746 if (ctx == NULL) 748 if (ctx == NULL)
747 return -ENOMEM; 749 return -ENOMEM;