Subject: Broken badsect(8)?
To: None <current-users@NetBSD.ORG>
From: Curt Sampson <curt@portal.ca>
List: current-users
Date: 09/12/1996 16:09:33
I had, unfortunately, an opportunity to try to use badsect(8) the
other day. Unfortunately, it didn't work, giving me an error that
I now cannot remember (it was 3 a.m. at the time :-)) but indicating
that it couldn't write to that device (I believe it was `device
busy', come to think of it).
Feeling a bit silly, since the filesystem was mounted, I shut down
into single-user mode and securelevel 0 and tried again, but still
had the same problem. A bit of mucking about with gdb showed that
it was going through /dev looking for a device with the same device
number as the file system was mounted on, coming up with the block
device, and then failing. I quickly hacked the code to skip the
search and just use that particular raw device, and it then worked.
So I take it it's normal for block devices to be unwritable when
they are mounted, regardless of securelevel, and that one should
use the raw device instead? How is this activity affected by the
buffer cache (i.e., can a dirty block being flushed from the buffer
overwrite what I've just written)?
And should I fix this and submit a PR?
cjs
Curt Sampson curt@portal.ca Info at http://www.portal.ca/
Internet Portal Services, Inc.
Vancouver, BC (604) 257-9400 De gustibus, aut bene aut nihil.