Re: [PATCH 0/3] fs: return ERR_PTR() from iget_locked() and friends

From: Jan Kara

Date: Wed Dec 02 2026 - 06:23:06 EST


On Tue 01-12-26 11:09:17, Jan Harkes wrote:
> On Tue, Dec 01, 2026 at 04:34:50PM +0300, Konstantin Adzer wrote:
> > iget_locked(), iget5_locked(), iget5_locked_rcu() and inode_insert5()
> > return NULL for a failed allocation and also for an inode under
> > creation, which find_inode() and find_inode_fast() report as -ESTALE.
> > Callers read NULL as -ENOMEM. As reported in [1], open_by_handle_at() on
> > ext4 then fails with ENOMEM, and nfsd returns a jukebox/DELAY error, for
> > the handle of a deleted inode whose number is being reused. Following
> > the discussion in [2], this series makes the helpers return ERR_PTR().
> >
> > Patches 1 and 2 make fuse_iget() and hfs_iget() return ERR_PTR(), so
> > that patch 3 can convert the four helpers and all their callers at once.
>
> (I had to remove a bunch of addresses from the CC list because Google
> was not allowing me to send my response to 'too many recipients'. sorry
> to anyone who got excluded)
>
> I don't like this change because this is an API used by external file
> system modules and they are expecting a NULL instead of an ERR_PTR.

If you mean out-of-tree kernel modules, yes, they'd be broken by this
change but they can update their code and this is the standard burden of
keeping some kernel module code out-of-tree and we aren't going to tolerate
problems in the kernel just to make life easier for out-of-tree modules...

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR