Bug 178818

Summary: gmirror savecore support / gmirror(8) says to use rc.early which is no longer available
Product: Base System Reporter: Lawrence Chen <beastie>
Component: confAssignee: freebsd-rc mailing list <rc>
Status: Open ---    
Severity: Affects Some People CC: allanjude, beastie_t, chris, christian.baltini, debdrup, joelh, paul, rc
Priority: Normal Keywords: feature, needs-patch, needs-qa
Version: CURRENTFlags: koobs: mfc-stable11?
koobs: mfc-stable12?
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190152
Attachments:
Description Flags
gmirror(8) manpage patch none

Description Lawrence Chen 2013-05-21 19:20:00 UTC
	
	gmirror(8) has NOTES section on doing kernel dumps to gmirror
	providers and wanting to use a different balance algorithm through use
	of /etc/rc.early and /etc/rc.local.

	But, /etc/rc.early is no more.

Fix: 

Provide an alternative solution to /etc/rc.early, such as create
	an equilavalent /etc/rc.d/early? create some other /etc/rc.d/<file>
	that is "BEFORE: dumpon"?  Some other way?

	Plus the original early script wouldn't work, since it would get called
	after dumpon.  Since it is "REQUIRE: disks" while dumpon is
	"BEFORE: disks".
Comment 1 Chris Rees 2013-05-31 15:52:58 UTC
I think this shouldn't be too hard to automate in the dumpon script,
to be honest.

Please can you try the patch at [1], and set

dumpdev=/dev/mirror/*your_target_mirror*

in /etc/rc.conf, and let me know if it works OK?

Pawel, does this look sane?

Chris

[1] http://www.bayofrum.net/~crees/patches/gmirror-dumps.diff
Comment 2 Lawrence Chen 2013-11-06 13:56:05 UTC
Sorry for not replying sooner, but it didn't quite work for me and
forgot to come back later to see why, since what I hacked seemed to be
working...until recently.

So, I revisited this problem.

One change to your diff... http://lkc.me/5D



-- 
  Name: Lawrence "The Dreamer" Chen      Email: beastie@tardisi.com
 Snail: 1530 College Ave, A5              Blog: http://lawrencechen.net
        Manhattan, KS 66502-2768         Phone: 785-789-4132
Comment 3 Lawrence Chen 2014-04-29 20:18:52 UTC
On 2013-11-06 07:56, The BSD Dreamer wrote:
> Sorry for not replying sooner, but it didn't quite work for me and
> forgot to come back later to see why, since what I hacked seemed to be
> working...until recently.
> 
> So, I revisited this problem.
> 
> One change to your diff... http://lkc.me/5D

System: FreeBSD zen.lhaven.homeip.net 9.2-RELEASE-p4 FreeBSD 9.2-RELEASE-p4 
#0: Tue Apr  8 18:08:22 UTC 2014     
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

So, recently, I had the system panic twice, where it did dumps but they 
couldn't be found by /etc/rc.d/savecore.

Leads me to suspect that this rc script needs a similar tweak.

http://lkc.me/5I
Comment 4 Lawrence Chen 2014-06-10 14:08:00 UTC
Discovered the dumpon script wasn't working as expected...turns out its because I have /usr as a separate filesystem and dumpon is called before such things are mounted.  So it can't find 'grep' (/usr/bin/grep), other commands reside in /sbin or /bin....

But, in bug 190152 it sounds like the modification to dumpon is unnecessary.

Since my balance preference is for 'load' (the default) and savecore (at least) 
needs to get switched to 'prefer'...I just hard coded both dumpon and savecore on my system to switch to prefer and then back to load.

Perhaps, an rc.conf variable to specify what balance preference is used (possibly defaulting to 'load' if not set), to avoid trying to grep the output of 'gmirror list <name>'.

'grep' works in savecore, since its called much later...well after FILESYSTEMS (in fact between NETWORKING and SERVERS...closer to SERVERS.)  Guess its fortunate that nothing has touched swap during up to this point, because swapon is done a little after dumpon.
Comment 5 Christian Baltini 2019-06-11 04:29:32 UTC
I have addressed this like so:

This rc.d script fires before savecore and changes the balance to "prefer" and ensures that a specified GEOM provider has a specified priority.

https://github.com/openspork/freebsd-nas/blob/master/usr/local/etc/rc.d/gmirror_prefer

This rc.d script fires after savecore and changes the balance back to whatever is specified in rc.conf (or wherever).

https://github.com/openspork/freebsd-nas/blob/master/usr/local/etc/rc.d/gmirror_balance

I have tested it working.

In the longer term I think it would be nice if the base system could be smart enough to do something similar.  Until then this appears to do the trick.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 07:29:02 UTC
Can we get an updated patch against FreeBSD head (as of today), as an attachment in this issue, that incorporates any additions/changes/fixes from those referenced in comment 1, comment 2, comment 3 and comment 5 please where appropriate/necessary

If man page changes are required, please provide that as a second patch in this issue as well

^Triage: Issues shouldn't be " in progress" without a real assignee, re-open. Re-classify (product/component)
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 07:40:58 UTC
*** Bug 190152 has been marked as a duplicate of this bug. ***
Comment 8 Christian Baltini 2019-06-12 01:26:28 UTC
Created attachment 205001 [details]
gmirror(8) manpage patch

Patch for lib/geom/mirror/gmirror.8 that adds dumpon/savecore scripts for gmirror with modern rc ordering
Comment 9 Christian Baltini 2019-06-12 01:28:34 UTC
See attachment that adds handling scripts for gmirror dumpon/savecore support.
Tentative initial version.
Comment 10 Christos Chatzaras 2019-09-16 07:58:37 UTC
Can someone commit the patches? It would be great to get it in 12.1.
Comment 11 Christian Baltini 2019-10-06 23:10:59 UTC
(In reply to Christos Chatzaras from comment #10)
I would like if somebody could review and give their blessing before any merging, for I am but a scrub. :)