Whamcloud - gitweb
LU-18163 obdclass: fix sysfs_memparse()/string_to_size()
The patch reworks string_to_size() to avoid string copies and handle
default unit directly in __string_to_size().
Also, this would handle more gracefully fractional value with huge
unit (like 0.5EiB).
This implementation fixes the parsing of the following invalid
strings:
- "10.badbadMib"
- "10MiBbadbad"
- "10MBAD"
- "10.123badMib"
- "1024.KG"
The patch change the way to handle decimal fractional part: a maximum
of 9 digits are supported.
It fixes test_string_to_size_err() to actually return an error if a
test failed and then prevents the module to load.
It fixes obdclass_init() to avoid a crash if obd_init_checks()
failed.
Add regression tests in obd_init_checks.
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: Ic20d11368fc7608637e8123d7c6c5a2ab2cf4a4b
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56135
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>