On Mon, Jun 03, 2013 at 03:26:45PM +0200, Peter Zijlstra wrote:
> On Thu, May 30, 2013 at 08:51:00AM -0400, Vince Weaver wrote:
> > > I'll go prod, thanks again!
> 
> 
> OK the below builds and seems to survive both test cases and about 10 minutes
> of fuzzing -- fingers crossed.
> 
> ---
> @@ -3779,12 +3834,21 @@ static int perf_mmap(struct file *file, struct 
> vm_area_struct *vma)
>               return -EINVAL;
>  
>       WARN_ON_ONCE(event->ctx->parent_ctx);
> +again:
>       mutex_lock(&event->mmap_mutex);
>       if (event->rb) {
> -             if (event->rb->nr_pages == nr_pages)
> -                     atomic_inc(&event->rb->refcount);
> -             else
> +             if (event->rb->nr_pages != nr_pages)
                {
>                       ret = -EINVAL;
                        goto unlock;
                }

Seems to cure it... I'm going to let it run over night.

> +
> +             if (!atomic_inc_not_zero(&event->rb->mmap_count)) {
> +                     /*
> +                      * Raced against perf_mmap_close() through
> +                      * perf_event_set_output(). Try again, hope for better
> +                      * luck.
> +                      */
> +                     mutex_unlock(&event->mmap_mutex);
> +                     goto again;
> +             }
>               goto unlock;
>       }
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to