Page MenuHomeFreeBSD

Don't use sleeping allocations for ufs dirhash blocks when holding directory vnode
ClosedPublic

Authored by dgmorris_earthlink.net on Mar 3 2021, 6:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 13 2024, 12:55 AM
Unknown Object (File)
Jan 20 2024, 6:28 AM
Unknown Object (File)
Dec 26 2023, 1:22 PM
Unknown Object (File)
Dec 23 2023, 3:30 AM
Unknown Object (File)
Dec 12 2023, 12:18 PM
Unknown Object (File)
Oct 15 2023, 7:22 PM
Unknown Object (File)
Oct 14 2023, 12:52 PM
Unknown Object (File)
Aug 15 2023, 1:26 AM
Subscribers
None

Details

Summary

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253992

System with a based-on-FreeBSD-12 kernel but with a timeout panic for the UFS root vnode lock paniced due to a ufsdirhash_build() call with M_WAITOK, UMA_ZONE_FIRSTTOUCH (the default) and a domain which was OOM. The ufsdirhash_build() code is invoked with the directory vnode exclusively locked (per ufs_lookup.c / the caller) and in all other places takes care to allocate M_NOWAIT to avoid such issues.

So it seems reasonable to make this one allocation also M_NOWAIT instead of M_WAITOK, especially given the FIRSTTOUCH default behavior where only the calling cpu's domain can satisfy the request.

Test Plan

Organizational stress testing, no unit test planned -- change is pretty straightforward.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Mar 3 2021, 7:50 PM
markj added reviewers: mckusick, kib.
markj added inline comments.
sys/ufs/ufs/ufs_dirhash.c
111

I would just drop the NOWAIT suffix, or get rid of the UMA wrappers entirely.

Took Mark's suggestion on dropping _NOWAIT suffix on allocation macro.
Left the macro for symmetry with the FREE macros in the file.

This revision now requires review to proceed.Mar 3 2021, 8:09 PM

This seems like a reasonable solution to the problem. The allocation will fail in a few cases where it previously would have succeeded, but hopefully those will be rare. The effect of failing will simply be slower lookups rather than unexpected errors to applications.

This revision is now accepted and ready to land.Mar 3 2021, 9:19 PM