The loop has to run because the head of the free list at this point can
never be LFS_UNUSED_INUM; but there is no way for GCC to know that.
I'll patch it momentarily.
Thanks,
-Konrad
On 9/15/2025 10:49 AM, David Holland wrote:
On Mon, Sep 15, 2025 at 04:15:00AM +0000, Konrad Schroder wrote:
> Modified Files:
> src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_alloc.c
>
> Log Message:
> If setting the head (or tail) of the inode free list to LFS_UNUSED_INUM,
also
> set the tail (resp. head) to LFS_UNUSED_INUM, as the list is now empty.
>
> Add a check to ensure that lfs_valloc_fixed will always terminate, even
> if the free list should contain a loop. Extend the ifile at the end if it
> is empty, to match the assumption of lfs_valloc() that the free list is
> never empty.
>
> Needed for roll-forward.
This seems to have resulted in build breakages on platforms where gcc
fails to realize that the loop involved runs at least once, e.g.
https://releng.netbsd.org/builds/HEAD/20250915064210Z/sparc64.build.failed
lfs_alloc.c:407:20: error: 'nextfree' may be used uninitialized
although looking at it I'm not immediately sure that the loop _does_
run at least once, so I'm reluctant to try to hack in a fix in a rush.
Can you attend to it? :-|