perf: Roll back callchain buffer refcount under the callchain mutex
perf: Roll back callchain buffer refcount under the callchain mutex

When we fail to allocate the callchain buffers, we roll back the refcount
we did and return from get_callchain_buffers().

However we take the refcount and allocate under the callchain lock
but the rollback is done outside the lock.

As a result, while we roll back, some concurrent callchain user may
call get_callchain_buffers(), see the non-zero refcount and give up
because the buffers are NULL without itself retrying the allocation.

The consequences aren't that bad but that behaviour looks weird enough and
it's better to give their chances to the following callchain users where
we failed.

Reported-by: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Signed-off-by: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Acked-by: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Signed-off-by: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Link: http://lkml.kernel.org/r/1375460996-16329-2-git-send-email-e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs