diff options
author | Benny Halevy <bhalevy@panasas.com> | 2010-09-23 12:22:09 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-23 12:22:09 -0400 |
commit | ef84303ebc77a9041265faaccd56b7fcef151077 (patch) | |
tree | 971755468ab947358ee3d1348a6aca2df08bcc49 /fs/nfs | |
parent | 5eebde23223aeb0ad2d9e3be6590ff8bbfab0fc2 (diff) |
NFS: handle inode==NULL in __put_nfs_open_context
inode may be NULL when put_nfs_open_context is called from nfs_atomic_lookup
before d_add_unique(dentry, inode)
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/inode.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2ff814272dcf..702ed096e790 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -654,11 +654,14 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) | |||
654 | { | 654 | { |
655 | struct inode *inode = ctx->path.dentry->d_inode; | 655 | struct inode *inode = ctx->path.dentry->d_inode; |
656 | 656 | ||
657 | if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock)) | 657 | if (inode) { |
658 | if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock)) | ||
659 | return; | ||
660 | list_del(&ctx->list); | ||
661 | spin_unlock(&inode->i_lock); | ||
662 | NFS_PROTO(inode)->close_context(ctx, is_sync); | ||
663 | } else if (!atomic_dec_and_test(&ctx->lock_context.count)) | ||
658 | return; | 664 | return; |
659 | list_del(&ctx->list); | ||
660 | spin_unlock(&inode->i_lock); | ||
661 | NFS_PROTO(inode)->close_context(ctx, is_sync); | ||
662 | if (ctx->cred != NULL) | 665 | if (ctx->cred != NULL) |
663 | put_rpccred(ctx->cred); | 666 | put_rpccred(ctx->cred); |
664 | path_put(&ctx->path); | 667 | path_put(&ctx->path); |