Re: [kbuild] [mmotm:master 57/427] fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block

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

 



On 2014/9/30 5:08, Andrew Morton wrote:
> On Fri, 26 Sep 2014 17:36:37 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> 
>> commit: 8a09937cacc099da21313223443237cbc84d5876 [57/427] ocfs2: add orphan recovery types in ocfs2_recover_orphans
>>
>> ...
>>
>>>> fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
>>
> 
> this?

I think there is another deadlock case in ocfs2_recover_orphans.

*spin_lock(&oi->ip_lock)*
	ocfs2_inode_lock
		ocfs2_inode_lock_full_nested
			ocfs2_inode_lock_update
				*spin_lock(&oi->ip_lock)*

Since ip_lock only wants to protect ip_flags and the added new logic
ocfs2_del_inode_from_orphan has nothing to do with it, distinguish
them.

> 
> --- a/fs/ocfs2/journal.c~ocfs2-add-orphan-recovery-types-in-ocfs2_recover_orphans-fix
> +++ a/fs/ocfs2/journal.c
> @@ -2160,8 +2160,7 @@ static int ocfs2_recover_orphans(struct
>  			ret = ocfs2_inode_lock(inode, &di_bh, 1);
>  			if (ret) {
>  				mlog_errno(ret);
> -				spin_unlock(&oi->ip_lock);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ocfs2_truncate_file(inode, di_bh, i_size_read(inode));
>  			ocfs2_inode_unlock(inode, 1);
> @@ -2173,14 +2172,13 @@ static int ocfs2_recover_orphans(struct
>  					OCFS2_INODE_DEL_FROM_ORPHAN_CREDITS);
>  			if (IS_ERR(handle)) {
>  				ret = PTR_ERR(handle);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ret = ocfs2_del_inode_from_orphan(osb, handle, inode);
>  			if (ret) {
>  				mlog_errno(ret);
>  				ocfs2_commit_trans(osb, handle);
> -				spin_unlock(&oi->ip_lock);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ocfs2_commit_trans(osb, handle);
>  		}
> @@ -2200,7 +2198,10 @@ static int ocfs2_recover_orphans(struct
>  		inode = iter;
>  	}
>  
> -out:
> +	return ret;
> +
> +out_unlock:
> +	spin_unlock(&oi->ip_lock);
>  	return ret;
>  }
>  
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
> 
> 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]