lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <C5DD162C-1991-40F1-93ED-62924E7916A9@gmail.com>
Date:   Mon, 21 Feb 2022 16:16:44 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     "Bayduraev, Alexey V" <alexey.v.bayduraev@...ux.intel.com>,
        Jiri Olsa <olsajiri@...il.com>
CC:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Alexander Antonov <alexander.antonov@...ux.intel.com>,
        Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH core] perf data: Adding error message if perf_data__create_dir fails



On February 21, 2022 3:45:55 PM GMT-03:00, "Bayduraev, Alexey V" <alexey.v.bayduraev@...ux.intel.com> wrote:
>
>On 21.02.2022 21:24, Jiri Olsa wrote:
>> On Mon, Feb 21, 2022 at 04:24:28PM +0300, Bayduraev, Alexey V wrote:
>>> On 21.02.2022 1:43, Jiri Olsa wrote:
>>>> On Fri, Feb 18, 2022 at 06:23:40PM +0300, Alexey Bayduraev wrote:
>>>>> There is no notification about data directory creation failure. Add it.
>>>>>
>>>>> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
>>>>> ---
>>>>>  tools/perf/builtin-record.c | 4 +++-
>>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>>>>> index 0bc6529814b2..0306d5911de2 100644
>>>>> --- a/tools/perf/builtin-record.c
>>>>> +++ b/tools/perf/builtin-record.c
>>>>> @@ -1186,8 +1186,10 @@ static int record__mmap_evlist(struct record *rec,
>>>>>  
>>>>>  	if (record__threads_enabled(rec)) {
>>>>>  		ret = perf_data__create_dir(&rec->data, evlist->core.nr_mmaps);
>>>>> -		if (ret)
>>>>> +		if (ret) {
>>>>> +			pr_err("Failed to create data directory: %s\n", strerror(errno));
>>>>
>>>> errno will be misleading in here, because perf_data__create_dir
>>>> calls other syscalls on error path
>>>
>>> Mostly I want to output something like:
>>>
>>>   Failed to create data dir: Too many open files
>>>
>>> This will trigger the user to increase the open files limit.
>>> Would it be better to place such message to perf_data__create_dir after 
>>> open() syscall?
>> 
>> how about something like below (with your change)
>
>Looks better, I will apply this to my patch.


Thanks a lot, I'll check when you post it.

Thanks for splitting that original patch, it was the correct thing to do in the first place, and now one of the patches got reviews I even missed :-)

- Arnaldo

>
>Thanks,
>Alexey
>
>> 
>> jirka
>> 
>> 
>> ---
>> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
>> index 15a4547d608e..d3382098d6f9 100644
>> --- a/tools/perf/util/data.c
>> +++ b/tools/perf/util/data.c
>> @@ -52,8 +52,10 @@ int perf_data__create_dir(struct perf_data *data, int nr)
>>  			goto out_err;
>>  
>>  		ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
>> -		if (ret < 0)
>> +		if (ret < 0) {
>> +			ret = -errno;
>>  			goto out_err;
>> +		}
>>  
>>  		file->fd = ret;
>>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ