Home | History | Annotate | Download | only in raidframe
History log of /src/sys/dev/raidframe/rf_compat80.c
RevisionDateAuthorComments
 1.17  28-Jun-2022  oster RAIDframe must be initialized for the RAIDFRAME_FAIL_DISK80 ioctl.

Reported-by: syzbot+048387fcc9a1a3682638@syzkaller.appspotmail.com
Reported-by: syzbot+037d1813186571cb2d38@syzkaller.appspotmail.com
 1.16  11-Dec-2021  mrg remove clause 3 from all my licenses that aren't conflicting with
another copyright claim line. again. (i did this in 2008 and then
did not update all of my personal templates.)
 1.15  26-May-2021  mrg support different endian raidframe component label.

there are two on-disk formats in use in raidframe:
- the component label
- the parity map

the parity map is a bitmap implemented as bytes, so it has no
endian issue. the component label is the problem, as most of
the fields are 32 bit. this change only supports version 2 of
raidframe (active since the year 2000.)

as component labels are read and used before a raidPtr for the
raid set has been created, there is no obvious storage for the
swapped indicator, so the in-core version remains the on-disk
version, while the rest of in-core label is swapped.

in raidread_component_label() and raidwrite_component_label(),
check if the swapped version, and if so, call new rf_swap_label()
and ensure that the in-core label is native-byte order. for the
write method, an on-stack copy is modified before writing, so
that the in-core version remains valid. (this stack usage is
below other stack usage in similar functions here.)

adjust the label ioctls RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_GET_COMPONENT_LABEL80 to return the byte-swapped
version so that eg, raidctl -s reports the right version.

when performing final configuration of a raidset, report if a
label swapped, and also complain if there are differently swapped
versions on the other components.


tested on arm64, sparc64 and amd64
ok @oster
 1.14  12-Dec-2019  pgoyette branches: 1.14.12; 1.14.14;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.13  01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.12  09-Feb-2019  christos - Change the allocation macros to be more like function calls
- Change sizeof(type) -> sizeof(*variable)
- Use macros for the long buffer length allocations
- Remove "bit polishing" memsets() -- do them only once
- Remove unnecessary casts

Thanks to oster@ for finding bugs and testing.
 1.11  05-Feb-2019  christos - Redo all the ioctl compat stuff to use a standard "ioctl" interface,
and provide methods to the private softc
- Provide a function for constructing a RF_Raid_t from an RF_Config_t
- Factor out the big inline ioctl code into functions
 1.10  05-Feb-2019  christos use -> instead of .
 1.9  05-Feb-2019  christos - Fix the FAIL_DISK handling (it would prolly trash the wrong disk before
since the request structs are different and the row in the old struct is
the col in the new one).
- Restructure the way compat modules are loaded so that we only load them
for the ioctls that need them. Put a comment explaining why...
- Set retcode after loading compat (now that the fail disk passthrough
hack is gone), so that various ioctls don't always fail.
 1.8  03-Feb-2019  pgoyette Don't include the raidframe compat code in the main raid module, the
compat code lives in their own compat_raid_xx modules, which will now
be autoloaded if needed.

While here, extract the compat_netbsd32_raid code into its own module,
too.

Welcome to 8.99.34
 1.7  31-Jan-2019  christos Prevent integer overflow: ioctl commands are u_long.
For consistency move prototype to the _mod.h header.

XXX: Why are the compat files here? Shouldn't they be in compat/common?
Or because this could be a separate module, they belong with it?
 1.6  29-Jan-2019  pgoyette KNF - insert tab (thanks to mrg@)

NFCI
 1.5  29-Jan-2019  oster Need to return EPASSTHROUGH for ioctls that arn't handled in compat.
Thanks to mlelstv for finding this!
 1.4  29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.3  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.2  20-Jan-2018  mrg branches: 1.2.2; 1.2.4;
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.
 1.1  18-Jan-2018  mrg 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.
 1.2.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.1  10-Jun-2019  christos Sync with HEAD
 1.2.2.8  24-Jan-2019  pgoyette Need sys/module.h here
 1.2.2.7  24-Jan-2019  pgoyette The raidframe compat code lives in sys/dev/raidframe/ so move all the
module stuff there. Update the Makefiles appropriately.
 1.2.2.6  23-Jan-2019  pgoyette Another missing semicolon. grrrrr.
 1.2.2.5  23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.2.2.4  18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.2.2.3  17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.2.2.2  24-Mar-2018  pgoyette Finish clean-up of raidframe compat_80
 1.2.2.1  24-Mar-2018  pgoyette Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.
 1.14.14.1  31-May-2021  cjep sync with head
 1.14.12.1  17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed