Issue1667

Title disklabel / disklabel64 change needs reboot / disk change
Priority bug Status chatting
Superseder Nosy List alexh, thomas.nikolajsen
Assigned To alexh Keywords

Created on 2010-02-04.22:30:02 by thomas.nikolajsen, last changed by thomas.nikolajsen.

Messages
msg8190 (view) Author: thomas.nikolajsen Date: 2010-03-06.12:19:22
Patch supplied in prev. message didn't solve problem:
after applying patch disk slice is read-only after 'disklabel -W <slice>',
so dd fails (trying to zero initial part of slice).

Details on disk/slice:
fdisk -i ad4                # install MBR
disklabel64 -rw ad4s2 auto  # initially (slice empty) succeeds
disklabel64 -W ad4s2
dd if=/dev/zero of=/dev/ad4s2 bs=512 count=32  # succeedes on master; fails w/ 
patch (issue1667 Feb. 9th 2010) (read-only)
disklabel32 -rw ad4s2 auto  # fails 'disk already has a label of a different 
type'
disklabel64 ad4s2           # shows 64-bit label

 -thomas
msg8125 (view) Author: alexh Date: 2010-02-09.08:13:56
To fix this, please add the following lines in "case DIOCWLABEL:" 
(sys/kern/subr_diskslice.c)
disk_msg_send_sync(DISK_SLICE_REPROBE, dev->si_disk, sp);
devfs_config();
just after line 648:
set_ds_wlabel(ssp, slice, *(int *)data != 0);

I can't do it right now, but I'll be back to work on this and more on the 
weekend. 

This should solve the disklabel issue at least. Direct writes (e.g. dd) should 
be detected properly with the DSF_REPROBE magic. If not, please post some more 
info on the disk/slice structure.

Cheers,
Alex Hornung
msg8107 (view) Author: dillon Date: 2010-02-05.03:26:18
:Changing disk label from disklabel to disklabel64 format
:or vice versa needs reboot (or disk change, eg natacontrol detach / attach).
:
:This has worked without reboot earlier,
:as described in disklabel(8) & disklabel64(8);
:problem was introduced with devfs as I remeber.
:
:Problem seems to be that in kernel disklabel survives
:erasure of label on device (disklabel -W .. / dd if=/dev/zero of=DISK ..)
:
: -thomas

    Devfs is supposed to flag writes to the dos slice and/or label area
    and re-probe.  There's probably some logic missing.

						-Matt
msg8106 (view) Author: thomas.nikolajsen Date: 2010-02-04.22:30:02
Changing disk label from disklabel to disklabel64 format
or vice versa needs reboot (or disk change, eg natacontrol detach / attach).

This has worked without reboot earlier,
as described in disklabel(8) & disklabel64(8);
problem was introduced with devfs as I remeber.

Problem seems to be that in kernel disklabel survives
erasure of label on device (disklabel -W .. / dd if=/dev/zero of=DISK ..)

 -thomas
History
Date User Action Args
2010-03-06 12:19:22thomas.nikolajsensetmessages: + msg8190
2010-02-09 08:13:57alexhsetpriority: bug
assignedto: alexh
messages: + msg8125
nosy: + alexh
2010-02-05 03:26:19dillonsetstatus: unread -> chatting
messages: + msg8107
2010-02-04 22:30:02thomas.nikolajsencreate