Re: [PATCH][v3.2 stable tree] dcache: Balance rcu_read_lock in have_submounts()

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

 



On Wed, 11 Feb 2015 03:15:37 +0000
Ben Hutchings <ben@xxxxxxxxxxxxxxx> wrote:

> I've reviewed locking contexts in all three functions that I changed
> when backporting "deal with deadlock in d_walk()".  It's actually worse
> than you say:
> 
> - We don't hold this_parent->d_lock at the 'positive' label in
> have_submounts(), but it is unlocked after 'rename_retry'.
> - There is an rcu_read_unlock() after the 'out' label in
> select_parent(), but it's not held at the 'goto out'.
> 
> Does the following patch work for you?

I booted the original 3.2 kernel 3 times and it succeeded once, and
crashed the other two.

I applied this patch and booted it 5 times, and it succeeded every time.

I removed the patch, and it crashed on the very next boot.

Thus, I'd say it seems to have fixed the issue for me.

Tested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

-- Steve

> 
> Ben.
> 
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -1035,7 +1035,7 @@ ascend:
>  	return 0; /* No mount points found in tree */
>  positive:
>  	if (!locked && read_seqretry(&rename_lock, seq))
> -		goto rename_retry;
> +		goto rename_retry_unlocked;
>  	if (locked)
>  		write_sequnlock(&rename_lock);
>  	return 1;
> @@ -1045,6 +1045,7 @@ rename_retry:
>  	rcu_read_unlock();
>  	if (locked)
>  		goto again;
> +rename_retry_unlocked:
>  	locked = 1;
>  	write_seqlock(&rename_lock);
>  	goto again;
> @@ -1109,6 +1110,7 @@ resume:
>  		 */
>  		if (found && need_resched()) {
>  			spin_unlock(&dentry->d_lock);
> +			rcu_read_lock();
>  			goto out;
>  		}
>  
> --- END ---
> 

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]