Commit Graph

994 Commits

Author SHA1 Message Date
oster 362990b68f Fix two mis-spellings in comments. No functional changes. 2018-06-09 21:18:41 +00:00
christos 87fd18f8e5 s/static inline/static __inline/g for consistency. 2018-04-19 21:50:06 +00:00
pgoyette 9d1eb4704f Add "bufq_fcfs" requirement to all those driver modules that explicitly
request it in their calls to bufq_alloc().
2018-01-23 22:42:29 +00:00
mrg 9ca319869c fixes for the previous, noted by nakayama@.
- RAIDFRAME_CONFIGURE needs to be versioned as the rows was removed,
  adding RAIDFRAME_CONFIGURE80, rf_config80() etc.
- RAIDFRAME_CONFIGURE32 changes to match
- rf_get_info80() passed the wrong source to copyout()

some fixes to my original change were independantly made by nakayama@
who confirmed the changes work properly now.
2018-01-20 01:32:45 +00:00
skrll 3b4b657aca Fix some ARM kernel builds. ARM abuses compat32 for ABI compatibility and
this means some ioctls overlap.
2018-01-19 09:04:23 +00:00
mrg f2b04ca083 implement 32-bit compat support for raidframe.
convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly.  remove useless 'row' in a few
places.  add COMPAT_80 and put the old ioctls there.

raidframeio.h:
  RAIDFRAME_TEST_ACC
  - remove, unused
  RAIDFRAME_GET_COMPONENT_LABEL
  - convert to label not pointer to label
  RAIDFRAME_CHECK_RECON_STATUS_EXT
  RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
  RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
  - convert to progress info not pointer to info
  RAIDFRAME_GET_INFO
  - version entirely.
raidframevar.h:
  - rf_recon_req{} has row, flags and raidPtr removed (they're
    not a useful part of this interface.)
  - RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
  - RF_RaidDisk_s{} is re-ordered slightly to fix alignment
    padding - the actual data was already OK.
  - InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified.  for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.
2018-01-18 00:32:48 +00:00
christos a42bc43b7a check the result of pool_prime. 2017-11-14 14:27:54 +00:00
christos f890274f96 add a "booted_method" string to aid in debugging double boot matches. 2017-11-09 01:02:55 +00:00
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
jdolecek fe950f29d6 rf_get_component_caches(): remove useless condition 2017-04-05 20:30:55 +00:00
jdolecek f8c7987c1d add support for DIOCGCACHE; contrary to DIOCCACHESYNC, query any non-dead
disk in the set, even currently reconstring one
2017-04-05 19:40:26 +00:00
christos c0614acad2 more faithful to the original (from coypu) 2017-01-13 13:01:13 +00:00
christos 15a8367e55 Don't consider a disk hosed if we did not find a column for it; dedup code. 2017-01-13 04:22:16 +00:00
christos dd655a14e8 PR/51776: David Binderman: Remove unused variable. 2017-01-04 15:51:41 +00:00
christos 4778b6dcdc PR/51775: David Binderman: Remove unused variable. 2017-01-04 15:50:34 +00:00
nat daf039cf2e Ensure variables are initialized. Fixes error due to -Wmaybe-unitialized. 2016-12-11 05:27:00 +00:00
maya 7126f38657 raidframe: use existing routines to print an error and panic.
fixes the i386 ALL build with clang which complained about the
format string not being a string literal, and lets us get rid of
rf_panicbuf.

note: kern_assert is not KASSERT. it should panic as long as the
string is not NULL.

No functional change intended.
2016-12-10 23:03:27 +00:00
oster 5a54295bea Cleanup/remove unused asm_count. Reported by David Binderman in PR#51552.
Thanks!
2016-10-15 20:31:15 +00:00
jdolecek d0c39b253f fix mistake fallthrough in the ioctl switch introduced in previous commit 2016-09-19 23:37:10 +00:00
jdolecek 62548607cc fix DIOCCACHESYNC ioctl on ld(4) and raid(4) to work again; it got broken
when the code was switched over to dk_ioctl() - countrary to disk_ioctl(),
dk_ioctl() returns ENOTTY for ioctls it doesn't support, so must be called
as last resort, not first

bug was introduced in rev 1.83 (2015-05-02) for ld(4), and 1.335 (2016-01-03)
for raid(4)
2016-09-19 23:32:30 +00:00
christos 1b344bfff2 provide an empty DPRINTF 2016-04-27 02:47:39 +00:00
christos a863a5d590 Extend the "a" partition hack to also mean the first partition on the raid,
for non-disklabel based raidframe disks that need root.
2016-04-27 02:24:06 +00:00
joerg 7bee8e3459 Don't use for (...); by using an explicit continue as body. 2016-01-07 21:57:00 +00:00
christos 8e6dd2d0db gc unused flags 2016-01-07 14:15:26 +00:00
mlelstv 8740d774cf CID 1347189: Null pointer dereferences 2016-01-07 08:58:01 +00:00
christos dcde8e1440 Add a SET_LAST_UNIT ioctl. 2016-01-06 17:40:50 +00:00
christos e57a9c682c revert bp->b_error checking; biowait() is a no-op in that case and it is
valid to call biowait() after biodone. (thanks chuq)
2016-01-05 18:44:34 +00:00
mlelstv 9e8c8477e2 When autoconfiguring RAID sets:
Pseudo devices like vnd and cgd can be opened but may still
need some configuration. Ignore these quietly.
2016-01-05 17:06:34 +00:00
mlelstv 7b1b1bb768 handle possible errors from bdev_strategy. 2016-01-05 17:03:53 +00:00
mlelstv 478c72f7f4 prevent unconfigure/detach while background threads are running. 2016-01-04 13:15:17 +00:00
mlelstv 13bb06bfe5 Fix dump on raid.
- offset dump by RF_PROTECTED_SECTORS (thanks oster@ for noticing)
- call component dump function with byte count instead of block count
- return -1 instead of errno values in dk_size for error conditions.

There are still issues with dumping.
- the raid device must be open, neither reading the disklabel
  nor flushing the component labels in rfmarkdirty is possible
  when dumping.
- dumping to a wedge component fails because the wedge driver only
  allows dumping to swap partitions, not raid partitions.
2016-01-04 11:12:40 +00:00
mlelstv f86f7c2aab refactor driver to use common code in dksubr. 2016-01-03 08:17:24 +00:00
mlelstv 178b4da6ee No longer detach opened device directly in RAIDFRAME_SHUTDOWN ioctl,
instead just mark the device for shutdown and detach on last close.

Also don't manually print the detached message but leave this to
config_detach(). This avoids a duplicate message when shutting down.
2016-01-02 16:20:50 +00:00
mlelstv e7bab5c14b RAIDF_INITED state also includes disk attachments, don't undo operations
that haven't been committed.
2016-01-02 16:10:06 +00:00
mlelstv 3468e3dac4 Unlock and free in raid_detach to handle error paths. 2016-01-02 16:06:25 +00:00
mlelstv 6eec01b9bc use bdev_strategy wrapper to properly use KERNEL_LOCK. 2016-01-02 16:00:01 +00:00
pgoyette 1affdb8f45 Another use-after-free() 2015-12-26 21:50:43 +00:00
pgoyette 0e7668f123 If the "finalizer" should fail to register for any reason, just report
the situation (as a WARNING) and continue.  Don't return the error code
to the caller.  Failure to register should not really happen - if it
does, all we really lose is auto-configuration of raid-sets.
2015-12-26 12:59:00 +00:00
pgoyette beb5953719 Resolve a use-after-free reference to the softc. From mlelstv@ 2015-12-26 12:25:26 +00:00
pgoyette e05b240459 Modularize the raidframe driver, including rework of the unit attach
code to permit detaching (and possible module unloading).  Also,
convert tsleep()/wakeup() locking to use cv_wait_sig()/cv_broadcast().

Tested in non-modular, modular-builtin, and modular-loaded-at-runtime
environments.
2015-12-26 00:58:45 +00:00
christos 8d10f96266 Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
2015-12-08 20:36:14 +00:00
dholland 1fbab01a93 More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
2015-09-06 06:00:59 +00:00
christos e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
mrg 54ba879fe6 mark all the device entry points static. 2015-07-10 09:49:56 +00:00
mlelstv 6f00c789e1 Use C99-style initializers for struct dkdriver. 2015-04-26 15:15:19 +00:00
prlw1 9822db2110 Also print b_error in the IO Error message 2015-01-03 11:48:04 +00:00
christos c182898b0d We have three sets of DTYPE_ constants in the kernel:
altq		Drop 		Type
	disklabel	Disk 		Type
	file		Descriptor	Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
2015-01-02 19:42:05 +00:00
christos c60db2e923 make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
2014-12-31 19:52:04 +00:00
christos 3be6bb2414 Centralize wedge ioctls in disk_ioctl. 2014-12-31 17:06:48 +00:00
mlelstv bdddf44518 disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
2014-12-31 08:24:50 +00:00