Re: [PATCH 2/3] mm, swap: distinguish a malformed swap entry from a dying device

"David Hildenbrand (Arm)" <[email protected]>
Newsgroups org.kvack.linux-mm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/12/26 12:48, Breno Leitao wrote:
> Hello David,
> 
> On Tue, Aug 11, 2026 at 05:36:31PM +0200, David Hildenbrand (Arm) wrote:
>> On 8/10/26 18:26, Breno Leitao wrote:
>>> +	return ERR_PTR(-EINVAL);
>>>  }
>>
>> Is -EINVAL really the logical right return value? Running into bad swap entries
>> sounds more serious to me than "-EINVAL" :)
> 
> Good point, maybe we need a strong drug here, what about -EIO?
> 
> I picked -EINVAL because it is what the swap code already returns for
> this exact condition. 
> 
> 
> 	* Returns -EINVAL if the swap entry is invalid, which might
> 	* occur if a page table entry has got corrupted.
> 	*/
> 	int swap_dup_entry_direct(swp_entry_t entry)
> 	{
> 		si = swap_entry_to_info(entry);
> 		if (WARN_ON_ONCE(!si)) {
> 			pr_err("%s%08lx\n", Bad_file, entry.val);
> 			return -EINVAL;
> 
> But, I do agree -EINVAL is too soft given the situation we are in.
> 
> I will return -EIO in the next version, if I don't hear any concern.

Sounds definitely better.

-- 
Cheers,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.