diff options
author | rwatson <rwatson@FreeBSD.org> | 2008-07-05 13:10:10 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2008-07-05 13:10:10 +0000 |
commit | 051819b84758e212ecd632e9bd6f47e70f37aa3a (patch) | |
tree | fcde383ade7af0060da3dd095039791d9e423bee /sys/geom | |
parent | b754e07b66100e4e4d6ac8caa8f6302730552936 (diff) | |
download | FreeBSD-src-051819b84758e212ecd632e9bd6f47e70f37aa3a.zip FreeBSD-src-051819b84758e212ecd632e9bd6f47e70f37aa3a.tar.gz |
Introduce a new lock, hostname_mtx, and use it to synchronize access
to global hostname and domainname variables. Where necessary, copy
to or from a stack-local buffer before performing copyin() or
copyout(). A few uses, such as in cd9660 and daemon_saver, remain
under-synchronized and will require further updates.
Correct a bug in which a failed copyin() of domainname would leave
domainname potentially corrupted.
MFC after: 3 weeks
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/vinum/geom_vinum_drive.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c index 237d55e..a72937c 100644 --- a/sys/geom/vinum/geom_vinum_drive.c +++ b/sys/geom/vinum/geom_vinum_drive.c @@ -62,7 +62,9 @@ gv_config_new_drive(struct gv_drive *d) vhdr->magic = GV_MAGIC; vhdr->config_length = GV_CFG_LEN; + mtx_lock(&hostname_mtx); bcopy(hostname, vhdr->label.sysname, GV_HOSTNAME_LEN); + mtx_unlock(&hostname_mtx); strncpy(vhdr->label.name, d->name, GV_MAXDRIVENAME); microtime(&vhdr->label.date_of_birth); |