Page MenuHomeFreeBSD

Add the capability to refresh the gpart label without need a reboot.
ClosedPublic

Authored by araujo on Mar 10 2017, 2:23 AM.

Details

Summary

gpart has functionality to change the label of a (GPT) partition. This functionality works like it should, however, after a label change the /dev/gpt/ entries remain unchanged. glabel status output remains unchanged. The change only takes effect after a reboot.

The device was not in use or otherwise 'locked', gpart list shows the new label, but otherwise it appears that the gpart modify -l command does not actually change the device entries, as is expected and desired.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=162690

Test Plan
root@pipoca:/usr/src/sbin/geom/class/label # gpart list md1
Geom name: md1
modified: false
state: OK
fwheads: 64
fwsectors: 63
last: 2097111
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: md1p1
   Mediasize: 1071644672 (1.0G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 1048576
   Mode: r0w0e0
   rawuuid: 6729280a-0537-11e7-b64d-68f7285fdb52
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: newtest
   length: 1071644672
   offset: 1048576
   type: freebsd-zfs
   index: 1
   end: 2095103
   start: 2048
Consumers:
1. Name: md1
   Mediasize: 1073741824 (1.0G)
   Sectorsize: 512
   Mode: r0w0e0

root@pipoca:/usr/src/sbin/geom/class/label # gpart modify -i 1 -l asiabsdcon md1
md1p1 modified

root@pipoca:/usr/src/sbin/geom/class/label # gpart list md1
Geom name: md1
modified: false
state: OK
fwheads: 64
fwsectors: 63
last: 2097111
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: md1p1
   Mediasize: 1071644672 (1.0G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 1048576
   Mode: r0w0e0
   rawuuid: 6729280a-0537-11e7-b64d-68f7285fdb52
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: asiabsdcon
   length: 1071644672
   offset: 1048576
   type: freebsd-zfs
   index: 1
   end: 2095103
   start: 2048
Consumers:
1. Name: md1
   Mediasize: 1073741824 (1.0G)
   Sectorsize: 512
   Mode: r0w0e0


root@pipoca:/usr/src/sbin/geom/class/label # ls /dev/gpt/
efiboot	newtest	zfsboot

root@pipoca:/usr/src/sbin/geom/class/label # glabel refresh md1
Metadata from md1 refreshed.

root@pipoca:/usr/src/sbin/geom/class/label # ls /dev/gpt/
asiabsdcon	efiboot		zfsboot

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

araujo created this revision.Mar 10 2017, 2:23 AM
araujo edited the summary of this revision. (Show Details)
araujo edited the test plan for this revision. (Show Details)Mar 10 2017, 2:28 AM
araujo edited the test plan for this revision. (Show Details)
bcr accepted this revision.Mar 10 2017, 1:59 PM
bcr added a subscriber: bcr.

OK from manpages.

This revision is now accepted and ready to land.Mar 10 2017, 1:59 PM
bapt accepted this revision.Mar 11 2017, 7:04 AM

looks good to me beside the few style bug (inlined comment) please fix them before committing

sbin/geom/class/label/geom_label.c
247 ↗(On Diff #26103)

style bug

251 ↗(On Diff #26103)

style bug

allanjude accepted this revision.Mar 11 2017, 8:39 AM
This revision was automatically updated to reflect the committed changes.
trasz reopened this revision.Jun 22 2017, 4:24 PM
trasz added a subscriber: trasz.
trasz added inline comments.
head/sys/geom/part/g_part.c
893

Why not gpe_pp->acr as well?

This revision is now accepted and ready to land.Jun 22 2017, 4:24 PM
wblock added a subscriber: wblock.Jul 7 2017, 5:43 PM
wblock added inline comments.
head/sbin/geom/class/label/glabel.8
193

The slash with spaces form is usually ugly. Can't we just say "Rediscover" alone? Or "Reread"?

araujo closed this revision.Aug 1 2017, 7:38 AM

It has landed already!