Re: [PATCH 2/2] perf record: mmap output file - v4

From: Jiri Olsa
Date: Fri Nov 08 2013 - 04:35:38 EST


On Thu, Nov 07, 2013 at 09:23:25PM -0700, David Ahern wrote:

SNIP

>
> +static void mmap_output_fini(struct perf_record *rec)
> +{
> + off_t len;
> + int fd;
> +
> + if (!rec->mmap.use)
> + return;
> +
> + rec->mmap.use = false;
> +
> + len = rec->session->header.data_offset + rec->bytes_written;
> + fd = rec->file.fd;
> +
> + munmap(rec->mmap.addr, rec->mmap.out_size);
> + rec->mmap.addr = NULL;
> +
> + if (ftruncate(fd, len) != 0)
> + pr_err("ftruncate failed\n");

I think we should fail here and dont let the finishing
code run on probably corrupted file.

the code that process build IDs could even get stuck

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/