Re: [PATCH v2] NFS: handle inode==NULL in __put_nfs_open_context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-09-23 at 18:17 +0200, Benny Halevy wrote:
> 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@xxxxxxxxxxx>
> ---
>  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 2ff8142..702ed09 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)
>  {
>  	struct inode *inode = ctx->path.dentry->d_inode;
>  
> -	if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock))
> +	if (inode) {
> +		if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock))
> +			return;
> +		list_del(&ctx->list);
> +		spin_unlock(&inode->i_lock);
> +		NFS_PROTO(inode)->close_context(ctx, is_sync);
> +	} else if (!atomic_dec_and_test(&ctx->lock_context.count))
>  		return;
> -	list_del(&ctx->list);
> -	spin_unlock(&inode->i_lock);
> -	NFS_PROTO(inode)->close_context(ctx, is_sync);
>  	if (ctx->cred != NULL)
>  		put_rpccred(ctx->cred);
>  	path_put(&ctx->path);

Thank you! Applied...
  Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux