Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109634364
D9935.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9935.diff
View Options
Index: head/sbin/geom/class/label/geom_label.c
===================================================================
--- head/sbin/geom/class/label/geom_label.c
+++ head/sbin/geom/class/label/geom_label.c
@@ -53,6 +53,7 @@
static void label_clear(struct gctl_req *req);
static void label_dump(struct gctl_req *req);
static void label_label(struct gctl_req *req);
+static void label_refresh(struct gctl_req *req);
struct g_command PUBSYM(class_commands)[] = {
{ "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS,
@@ -74,6 +75,9 @@
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS,
"[-v] name dev"
},
+ { "refresh", 0, label_main, G_NULL_OPTS,
+ "dev ..."
+ },
{ "stop", G_FLAG_VERBOSE, NULL,
{
{ 'f', "force", NULL, G_TYPE_BOOL },
@@ -105,6 +109,8 @@
label_clear(req);
else if (strcmp(name, "dump") == 0)
label_dump(req);
+ else if (strcmp(name, "refresh") == 0)
+ label_refresh(req);
else
gctl_error(req, "Unknown command: %s.", name);
}
@@ -223,3 +229,28 @@
printf("\n");
}
}
+
+static void
+label_refresh(struct gctl_req *req)
+{
+ const char *name;
+ int i, nargs, fd;
+
+ nargs = gctl_get_int(req, "nargs");
+ if (nargs < 1) {
+ gctl_error(req, "Too few arguments.");
+ return;
+ }
+
+ for (i = 0; i < nargs; i++) {
+ name = gctl_get_ascii(req, "arg%d", i);
+ fd = g_open(name, 1);
+ if (fd == -1) {
+ printf("Can't refresh metadata from %s: %s.\n",
+ name, strerror(errno));
+ } else {
+ printf("Metadata from %s refreshed.\n", name);
+ (void)g_close(fd);
+ }
+ }
+}
Index: head/sbin/geom/class/label/glabel.8
===================================================================
--- head/sbin/geom/class/label/glabel.8
+++ head/sbin/geom/class/label/glabel.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 22, 2013
+.Dd March 12, 2017
.Dt GLABEL 8
.Os
.Sh NAME
@@ -57,6 +57,9 @@
.Cm dump
.Ar dev ...
.Nm
+.Cm refresh
+.Ar dev ...
+.Nm
.Cm list
.Nm
.Cm status
@@ -186,6 +189,8 @@
Clear metadata on the given devices.
.It Cm dump
Dump metadata stored on the given devices.
+.It Cm refresh
+Refresh / rediscover metadata from the given devices.
.It Cm list
See
.Xr geom 8 .
Index: head/sys/geom/part/g_part.c
===================================================================
--- head/sys/geom/part/g_part.c
+++ head/sys/geom/part/g_part.c
@@ -888,6 +888,10 @@
LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) {
if (!entry->gpe_deleted) {
+ /* Notify consumers that provider might be changed. */
+ if (entry->gpe_modified && (
+ entry->gpe_pp->acw + entry->gpe_pp->ace) == 0)
+ g_media_changed(entry->gpe_pp, 0);
entry->gpe_created = 0;
entry->gpe_modified = 0;
continue;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 8, 6:49 PM (20 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16530490
Default Alt Text
D9935.diff (2 KB)
Attached To
Mode
D9935: Add the capability to refresh the gpart label without need a reboot.
Attached
Detach File
Event Timeline
Log In to Comment