History log of /freebsd-current/sys/geom/mirror/g_mirror_ctl.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 7f053a44 13-Jul-2021 Mark Johnston <markj@FreeBSD.org>

gmirror: Zero the metadata block before writing

The mirror metadata fields contain string buffers and pad bytes, neither
were being zeroed before metadata was written to disk. Also, the
metadata structure is smaller than the sector size, and in one case
gmirror was failing to zero-fill the full buffer before writing.

Fix these problems by pre-zeroing the metadata structure and the sector
buffer.

Reported by: KMSAN
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# d22ff249 18-Oct-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make g_attach() return ENXIO for orphaned providers; update various
classes to add missing error checking.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26658


# fcf69f3d 21-Jul-2020 Xin LI <delphij@FreeBSD.org>

Consistently use gctl_get_provider instead of home-grown variants.

Reviewed by: cem, imp
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D25739


# 8510f61a 08-Jul-2020 Xin LI <delphij@FreeBSD.org>

sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".

Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25565


# 844b743d 11-May-2020 Conrad Meyer <cem@FreeBSD.org>

geom(4) mirror: Do not panic on gmirror(8) insert, resize

Geom_mirror initialization occurs in spurts and the present of a
non-destroyed g_mirror softc does not always indicate that the geom has
launched (i.e., has an sc_provider).

Some gmirror(8) commands (via g_mirror_ctl) depend on a g_mirror's
sc_provider (insert and resize). For those commands, g_mirror_ctl is
modified to sleep-poll in an interruptible way until the target geom is
either launched or destroyed.

Reviewed by: markj
Tested by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24780


# c4c88d47 05-Dec-2019 Alexander Motin <mav@FreeBSD.org>

Remove duplicate g_debugflags declaration.

While there, define G_F_FOOTSHOOTING instead of numeric constants.

MFC after: 13 days
X-MFX-with: r355412


# ac03832e 07-Aug-2019 Conrad Meyer <cem@FreeBSD.org>

GEOM: Reduce unnecessary log interleaving with sbufs

Similar to what was done for device_printfs in r347229.

Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an
sbuf; documented in g_bio.9.

Reviewed by: markj
Discussed with: rlibby
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21165


# 8b0a00b7 08-Jan-2018 Mark Johnston <markj@FreeBSD.org>

Sort and remove unneeded includes.

MFC after: 1 week
Sponsored by: Dell EMC Isilon


# 3728855a 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/geom: adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# b6fe583c 30-Nov-2016 Alexander Motin <mav@FreeBSD.org>

Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.

It is quite specific mode of operation without storing on-disk metadata.
It can be useful in some cases in combination with some external control
tools handling mirror creation and disks hot-plug.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 5a236b0e 06-Oct-2016 Alexander Motin <mav@FreeBSD.org>

Fix possible geom destruction before final provider close.

Introduce internal counter to track opens. Using provider's counters is
not very successfull after calling g_wither_provider().

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# ae3bc0ac 26-Dec-2013 Andrey V. Elsukov <ae@FreeBSD.org>

Add an ability to stop gmirror and clear its metadata in one command.
This fixes the problem, when gmirror starts again just after stop.

The problem occurs when gmirror's component has geom label with equal size.
E.g. gpt and gptid have the same size as partition, diskid has the same
size as entire disk. When gmirror's geom has been destroyed, glabel
creates its providers and this initiate retaste.

Now "gmirror destroy" command is available. It destroys geom and also
erases gmirror's metadata.

MFC after: 2 weeks


# 7c5710db 19-Dec-2013 Andrey V. Elsukov <ae@FreeBSD.org>

Prevent users from deactivating the last component of a mirror.

PR: 184985
MFC after: 1 week


# 32cea4ca 19-Nov-2013 Andrey V. Elsukov <ae@FreeBSD.org>

Add "resize" verb to gmirror(8) and such functionality to geom_mirror(4).
Now it is easy to expand the size of the mirror when all its components
are replaced. Also add g_resize method to geom_mirror class. It will write
updated metadata to new last sector, when parent provider is resized.

Silence from: geom@
MFC after: 1 month


# f931cd70 18-May-2012 Andrey V. Elsukov <ae@FreeBSD.org>

Prevent removing of the last active component from a mirror.

PR: kern/154860
Reviewed by: pjd
MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# a478ea74 13-Sep-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Allow to specify value as const pointers.
- Make optional string values always an empty string.


# e99e819f 08-Dec-2009 Alexander Motin <mav@FreeBSD.org>

MFC r196879:
Add support for changing providers priority.


# b740e905 06-Sep-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Add support for changing providers priority.

Submitted by: Mel Flynn


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 501250ba 01-Nov-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Now, that we have gjournal in the tree add possibility to configure
gmirror and graid3 in a way that it is not resynchronized after a
power failure or system crash.
It is safe when gjournal is running on top of gmirror/graid3.


# 86ed3c25 13-Jul-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Always allow to specify components with /dev/ prefix.

MFC after: 3 days


# 712fe9bd 10-Apr-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Introduce and use delayed-destruction functionality from a pre-sync hook,
which means that devices will be destroyed on last close.

This fixes destruction order problems when, eg. RAID3 array is build on
top of RAID1 arrays.

Requested, reviewed and tested by: ru
MFC after: 2 weeks


# 9bfdf598 18-Mar-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Update copyright for 2006.


# 855761d5 12-Mar-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Speed up synchronization process by using configurable number of I/O
requests in parallel.
+ Add kern.geom.mirror.sync_requests tunable which defines how many parallel
I/O requests should be used.
+ Retire kern.geom.mirror.reqs_per_sync and kern.geom.mirror.syncs_per_sec
sysctls.
- Fix race between regular and synchronization requests.
- Reimplement mirror's data synchronization - do not use the topology lock
for this purpose, as it may case deadlocks.
- Stop synchronization from pre-sync hook.
- Fix some other minor issues.

MFC after: 3 days


# 9d793bdd 10-Mar-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

When inserting a new component md_provsize metadata field wasn't set, which
means that old problem was triggered (when two providers end at the same
offset, eg. ad0 and ad0s1 and the wrong was is picked up by gmirror/graid3).

Reported by: Michal Suszko <dry@dry.pl>
MFC after: 3 days


# 38ea96ac 31-Jan-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Remove trailing spaces.


# 3865ca2e 25-Apr-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Fix provider's size check for 'insert' command.
Before this fix one was able to insert one sector too small provider.

MFC after: 3 days


# cc6aa917 26-Mar-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Check for return values.

Submitted by: sam
Found by: Coverity Prevent analysis tool


# 0218292c 16-Feb-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Update copyright in files changed this year.


# da844167 03-Jan-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Spoiling is now not possible, because we keep consumers open for writing
all the time. Remove unused code then.

MFC after: 4 days


# fd6d3120 03-Jan-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Fix 'rebuild' command (we ignore retaste event now, so don't relay on it).


# 9a9f5041 22-Dec-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Add genid field to the metadata which will allow to improve reliability a bit.
After this change, when component is disconnected because of an I/O error,
it will not be connected and synchronized automatically, it will be logged
as broken and skipped. Autosynchronization can occur, when component is
disconnected (on orphan event) and connected again - there were no I/O
error, so there is no need to not connected the component, but when there were
writes while it wasn't connected, it will be synchronized.
This fix cases, when component is disconnected because of I/O error and can be
connected again and again.
- Bump version number.
- Add version change history.
- Implement backward compatibility mechanism. After this change when metadata in
old version is detected, it is automatically upgraded to the new (current)
version.


# c37e2f9b 19-Dec-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Don't quit on first failure, just skip failures.


# c38d2f4e 10-Aug-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Forgot to commit those: introduce hardcoded provider functionality,
which allow to store provider's name in the metadata and avoid
problems when few providers share the same last sector.


# 55d6eb9f 30-Jul-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Add '-p' option for 'insert' command which allows to specify priority
of the new component.
Version number wasn't bumped (it should be), because I think there are
no geom_mirror users yet.


# ff9160f5 30-Jul-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Check if 'slice' argument was given.
- Check if disk isn't already the mirror component.


# fa4a1feb 30-Jul-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Add GEOM_MIRROR class which provide RAID1 functionality and has many useful
features. The gmirror(8) utility should be used for control of this class.
There is no manual page yet, but I'm working on it with keramida@.

Many useful tests provided by: simon (thank you!)
Some ideas from: scottl, simon, phk