Re: [Kernel Bug] WARNING in vfat_rmdir
From: Zhiyu Zhang
Date: Tue Dec 30 2025 - 03:01:45 EST
Hi Matthew,
Thanks for your reply!
> Ooh, -1 is a real errno, so -1 or errno is a bad API. I'd suggest just
> returning -ENOENT directly instead of translating it in the caller.
I agree with this advice. I can let fat_get_entry() return -ENOENT like:
static int fat__get_entry(struct inode *dir, loff_t *pos,
*bh = NULL;
iblock = *pos >> sb->s_blocksize_bits;
err = fat_bmap(dir, iblock, &phys, &mapped_blocks, 0, false);
- if (err || !phys)
- return -1; /* beyond EOF or error */
+ if (err)
+ return err; /* real error (e.g., -EIO)*/
+ if (!phys)
+ return -ENOENT; /* EOF */
Then I also need to re-handle the callers of fat_get_entry() as some
of them are still waiting for a "-1".
I'm willing to submit a patch to standardize the errno (though it
seems to unrelated to this bug), as long as it is approved :)
Best,
Zhiyu Zhang