Re: [BUG? liburing] io_uring_register_files_update with liburing 2.0 on 5.13.17

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

 



On 9/18/21 10:15 PM, Vito Caputo wrote:
> On Sat, Sep 18, 2021 at 05:40:51PM -0600, Jens Axboe wrote:
>> On 9/18/21 5:37 PM, Jens Axboe wrote:
>>>> and it failed with the same as before...
>>>>
>>>> io_uring_register(13, IORING_REGISTER_FILES, [-1, -1, -1, 3, 4, 5, 6, 7, 8,
>>>> 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>>>> -1, -1, -1, -1,
>>>> -1, ...], 32768) = -1 EMFILE (Too many open files)
>>>>
>>>> if you want i can debug it for you tomorrow? (in london)
>>>
>>> Nah that's fine, I think it's just because you have other files opened
>>> too. We bump the cur limit _to_ 'nr', but that leaves no room for anyone
>>> else. Would be my guess. It works fine for the test case I ran here, but
>>> your case may be different. Does it work if you just make it:
>>>
>>> rlim.rlim_cur += nr;
>>>
>>> instead?
>>
>> Specifically, just something like the below incremental. If rlim_cur
>> _seems_ big enough, leave it alone. If not, add the amount we need to
>> cur. And don't do any error checking here, let's leave failure to the
>> kernel.
>>
>> diff --git a/src/register.c b/src/register.c
>> index bab42d0..7597ec1 100644
>> --- a/src/register.c
>> +++ b/src/register.c
>> @@ -126,9 +126,7 @@ static int bump_rlimit_nofile(unsigned nr)
>>  	if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
>>  		return -errno;
>>  	if (rlim.rlim_cur < nr) {
>> -		if (nr > rlim.rlim_max)
>> -			return -EMFILE;
>> -		rlim.rlim_cur = nr;
>> +		rlim.rlim_cur += nr;
>>  		setrlimit(RLIMIT_NOFILE, &rlim);
>>  	}
>>  
>>
> 
> Perhaps it makes more sense to only incur the getrlimit() cost on the
> errno=EMFILE path?  As in bump the ulimit and retry the operation on
> failure, but when things are OK don't do any of this.

Yes, may as well. I've pushed a change that makes it incremental and
doesn't trigger it unless we hit EMFILE.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux