getnewvnode() return code

Matthew Dillon dillon at apollo.backplane.com
Wed May 29 10:47:32 PDT 2013


:Hi,
:
:As far as I can see, getnewvnode() always returns 0. However the path to
:get a new vnode, which is:
:
:objcache_get() <- sysref_alloc() <- allovnode() <- getnewvnode()
:
:may return NULL via objcache_get.
:
:Filesystems like NFS for example use vx_put() on the vnode obtained via
:getnewvnode() in its nfsnode allocation path. In the case the returned
:vnode pointer was NULL that would cause a kernel panic.
:
:All filesystems check the return code from getnewvnode() but they don't
:check whether the returned vnode is NULL.
:
:In any case, I could be missing something; thoughts are appreciated.
:
:Cheers,
:Antonio Huete

    getnewvnode() should never return NULL.  If there are paths where the
    allocation can fail they are bugs.  I'm pretty sure the objcache is
    set to block on exhaustion and wait for the GC but I haven't looked
    at the code closely.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>



More information about the Kernel mailing list