Bug #1667

disklabel / disklabel64 change needs reboot / disk change

Added by thomas.nikolajsen over 4 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:alexh% Done:

0%

Category:-
Target version:-

Description

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

#1 Updated by dillon over 4 years ago

: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

#2 Updated by alexh over 4 years ago

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

#3 Updated by thomas.nikolajsen over 4 years ago

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

#4 Updated by alexh over 2 years ago

  • Status changed from New to Closed

Fixed in 523f068048e2f8f3caaaf6c86c8073dd233c0f62

Also available in: Atom PDF