Re: Possible io_uring related race leads to btrfs data csum mismatch

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

 



On 8/20/23 12:18 PM, Matthew Wilcox wrote:
> On Sun, Aug 20, 2023 at 08:11:04AM -0600, Jens Axboe wrote:
>> +static int io_get_single_event(struct io_event *event)
>> +{
>> +	int ret;
>> +
>> +	do {
>> +		/*
>> +		 * We can get -EINTR if competing with io_uring using signal
>> +		 * based notifications. For that case, just retry the wait.
>> +		 */
>> +		ret = io_getevents(io_ctx, 1, 1, event, NULL);
>> +		if (ret != -EINTR)
>> +			break;
>> +	} while (1);
>> +
>> +	return ret;
>> +}
> 
> Is there a reason to prefer this style over:
> 
> 	do {
> 		ret = io_getevents(io_ctx, 1, 1, event, NULL);
> 	} while (ret == -1 && errno == EINTR);
> 
> (we need to check errno, here, right?  Or is io_getevents() special
> somehow?)

Honestly, don't really care about the style, mostly cared about getting
a bug fixed. io_getevents() returns number of events claimed, or -errno.

-- 
Jens Axboe




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux