NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57134: st_size of stat on vnd raw partition sometimes is 0, causing newfs to fail



The following reply was made to PR kern/57134; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/57134: st_size of stat on vnd raw partition sometimes is 0, causing newfs to fail
Date: Mon, 02 Jan 2023 15:43:34 +0700

     Date:        Mon,  2 Jan 2023 06:25:01 +0000 (UTC)
     From:        mlelstv%serpens.de@localhost (Michael van Elst)
     Message-ID:  <20230102062501.671A91A923A%mollari.NetBSD.org@localhost>
 
   |  > This assumption is wrong for this sequence:
   |  > 
   |  > fd = open("/dev/rvnd0",)
   |  > ioctl(fd, VNDIOCSET,)
   |  > fstat(fd, &sbuf)
   |  > 
   |  > as the partition size changes AFTER open.
 
 newfs doesn't do that, so that should not be an issue for it.
 If something else is changing the vnd size while newfs is running
 we have a race condition that there's no way to avoid - but it is
 kind of unbelievable that that would be happening while sysinst is
 installing a system.
 
   |  Yes, sad behaviour of vnd that it uses an uninitialized unit to create
   |  a real unit. Makes lots of things difficult and you should better
   |  not rely on this detail.
 
 Maybe it would be better for newfs to simply ignore st_size for all
 devices (use it only when making a filesystem in a file) ?
 
 That would be trivial to make happen, just need to set st_size to 0
 in the code that handles devices (and calls getdiskinfo()).
 
 kre
 


Home | Main Index | Thread Index | Old Index