Commit Graph

42 Commits

Author SHA1 Message Date
Paul Menzel 8e41153c91 Use more secure HTTPS URLs
All URLs in the source are available over HTTPS, so convert all URLs to
HTTPS with the command below.

    git grep -l 'http://' | xargs sed -i 's,http://,https://,g'

Revert the changes to announcement files `ANNOUNCE-*` as requested by
the maintainer.

Cc: linux-raid@vger.kernel.org
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-06-12 10:48:43 -04:00
Guoqing Jiang d92cee7b37 restripe: fix ignoring return value of ‘read’ and lseek
Got below error when run "make everything".

restripe.c: In function ‘test_stripes’:
restripe.c:870:4: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result]
    read(source[i], stripes[i], chunk_size);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix it by check the return value of ‘read’, and free memory
in the failure case.

And check the return value of lseek as well per Jes's comment.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-05-18 20:24:29 -04:00
Jes Sorensen d16a749444 mdadm: Fixup != broken formatting
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 14:09:57 -04:00
Jes Sorensen d7be7d8736 mdadm: Fixup more broken logical operator formatting
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 13:59:43 -04:00
NeilBrown 681b7ae245 Fix some issues found by clang
The clang compiler complained about each of these.

The mdmon.h error will only affect 'far' RAID10 arrays using intel or DDF
metadata, and there is no such thing.

The mdopen.c will cause a problem if there are no free md device
numbers in the first 512.  That is fairly unlikely.

The restripe.c error would only affect the 'test_stripe' command, and
probably doesn't change its behaviour.

The super-intel.c fix is purely cosmetic.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2016-10-07 11:47:48 -04:00
Jes Sorensen f1bbb5ff6d restripe: Avoid if and return on the same line
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2016-08-11 15:51:00 -04:00
NeilBrown ef639064b6 restripe: fix compilation of "make test"
Signed-off-by: NeilBrown <neilb@suse.com>
2016-01-13 10:01:02 +11:00
NeilBrown eae01ef02f restripe: fix data block order in raid6_2_data_recov
... rather than relying on the caller getting them in the
correct order.
This is better engineering and fixes a bug, but because the
failed_slotX numbers are used later with assumption that
they weren't swapped

Signed-off-by: NeilBrown <neilb@suse.de>
2015-07-20 17:15:13 +10:00
NeilBrown 50786d4731 raid6check: various cleanup/fixes
- document meaning of various arrays. In particular:
   stripes[]
   blocks[]
   blocks_page[]
   block_index_for_slot[]

  It needs to be clear if these are indexed by raid_disk
  number or syndrome number.

- changed meaning of block_index_for_slot[].  It didn't seem
  to be used consistently.  It also made use of the block numbers
  in array data ordering, which is not directly relevant for syndrome
  calculations.

- reduced number of args to autorepair and manual_repair
  There don't need both stripes[] and blocks[].  And they don't need
  diskP or diskQ.
  blocks[-1] is the P chunk, blocks[-2] is the Q chunk.
  block_index_for_slot[] can be used to find the target device for
  a particular syndrome block.

- remove stripe locking from within manual_repair, and instead
  use the global stripe locking used for check and autorepair.

- this necessitated changes to raid6_datap_recov and raid5_2data_reov
  so the P and Q blocks could be before or after the data blocks.



Signed-off-by: NeilBrown <neilb@suse.de>
2015-07-20 14:11:33 +10:00
NeilBrown ad1a3c2f08 raid6check
fix checking of DDF layouts.

Stuff probably still broken.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-07-16 12:07:54 +10:00
NeilBrown 42129b3f80 Add "Name" defines to some ancillary programs
All programs now need to declare their "Name".

Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: d56dd607ba ("Change way of printing name of a process")
2015-05-07 14:46:05 +10:00
NeilBrown 7a862a020f Don't break long strings onto multiple lines.
It is best to keep strings all together so that they
are easier to search for in the source code.
If a string is so long that it looks ugly one line,
them maybe it should be broken into multiple lines
for display too.

Only strings which contain a newline can be broken
into multiple lines:

 "It is OK to\n"
 "break this string\n"


Signed-off-by: NeilBrown <neilb@suse.de>
2015-02-12 13:46:53 +11:00
NeilBrown 1011e8344a Remove lots of unnecessary white space.
Now that I am using white-space mode in Emacs I can see all of this,
and I don't like it :-)

Signed-off-by: NeilBrown <neilb@suse.de>
2013-06-19 12:31:45 +10:00
Robert Buchholz 1cc101f3f8 Move xmalloc et al into their own file
This avoid code duplication for utilities that do not link to
util.c and everything that comes with it, such as test_restripe and
raid6check

Signed-off-by: NeilBrown <neilb@suse.de>
2012-09-10 17:23:59 +10:00
Robert Buchholz 59679536c5 Extract function to generate zeroes and expose xor function
Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:22:38 +10:00
NeilBrown 503975b9d5 Remove scattered checks for malloc success.
malloc should never fail, and if it does it is unlikely
that anything else useful can be done.  Best approach is to
abort and let some super-daemon restart.

So define xmalloc, xcalloc, xrealloc, xstrdup which don't
fail but just print a message and exit.  Then use those
removing all the tests for failure.

Also replace all "malloc;memset" sequences with 'xcalloc'.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:14:16 +10:00
Lukasz Dorau 758be4f1c9 Fix serious memory leak
During reshape function restore_stripes is called periodically
and every time the buffer stripe_buf (of size raid_disks*chunk_size)
is allocated but is not freed. It happens also upon successful completion.
In case of huge arrays it can lead to the seizure of the entire
system memory (even of the order of gigabytes).

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-09-19 13:26:05 +10:00
Adam Kwolek ccced3dc40 FIX: Move buffer to next location
When no output file is given save_stripes() should collect amount of stripes
in passed buffer. Currently all stripes are saved in the same area in passed
buffer. This causes that last stripe is returned on buffer begin only.
Increase buffer (buf) pointer when save_stripes() is about switch to next
stripe operation. This allows for proper buffer filling as input parameter
length directs.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
NeilBrown c071a1cd8d restripe: fix compile error in stand-alone program.
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:46 +10:00
Adam Kwolek 2fcb75aea1 Support restore_stripes() from the given buffer
For external metadata backup location and saving methods depends
on metadata specific implementation details. Currently restore_stripes()
function is able to restore data only from the given backup file handles
and it is used only for assembling partially reshaped arrays.
As this function will be very helpful for external metadata backup
mechanism, add the support for restoring data from the given source buffer.
Add possibility for save_stripes() to work without designation targets.
Save_stripes() can now prepare data for restore_stripes() only.

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 16:24:48 +10:00
NeilBrown d47a29257a restripe: make sure zero buffer is always large enough.
If restripe is called to restore stripes of one size and then
save stripes with a larger chunk size, the 'zero' buffer will not
be large enough and a double-degraded RAID6 will over-run the buffer.

So record the current size of the zero buffer and use it when deciding
if we need to allocate a new buffer.

Reported-by: Brad Campbell <lists2009@fnarfbargle.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-04-05 21:43:52 +10:00
Piergiorgio Sartor 6f38d7ae10 restripe: allow test code to have an offset on each device.
If device name ends :number, e.g.
   /dev/sda0:1234

then assume the RAID data starts that many sectors from start of
device.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-22 10:09:38 +11:00
Piergiorgio Sartor 979afcb82b RAID-6 check standalone
Hi Neil,

please find attached a patch, to mdadm-3.2 base, including
a standalone versione of the raid-6 check.

This is basically a re-working (and hopefully improvement)
of the already implemented check in "restripe.c".

I splitted the check function into "collect" and "stats",
so that the second one could be easily replaced.
The API is also simplified.

The command line option are reduced, since we only level
is raid-6, but the ":offset" option is included.

The output reports the block/stripe rotation, P/Q errors
and the possible HDD (or unknown).

BTW, the patch applies also to the already patched "restripe.c",
including the last ":offset" patch (which is not yet in git).

Other item is that due to "sysfs.c" linking (see below) the
"Makefile" needed some changes, I hope this is not a problem.

Next steps (TODO list you like) would be:

1) Add the "sysfs.c" code in order to retrieve the HDDs info
from the MD device. It is already linked, together with the
whole (mdadm) universe, since it seems it cannot leave alone.
I'll need some advice or hint on how to do use it. I checked
"sysfs.c", but before I dig deep into it maybe better to
have some advice (maybe just one function call will do it).

2) Add the suspend lo/hi control. Fellow John Robinson was
suggesting to look into "Grow.c", which I did, but I guess
the same story as 1) is valid: better to have some hint on
where to look before wasting time.

3) Add a repair option (future). This should have different
levels, like "all", "disk", "stripe". That is, fix everything
(more or less like "repair"), fix only if a disk is clearly
having problems, fix each stripe which has clearly a problem
(but maybe different stripes may belong to different HDDs).

So, for the point 1) and 2) would be nice to have some more
detail on where to look what. Point 3) we will discuss later.

Thanks, please consider for inclusion,

bye,

pg

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-21 13:52:44 +11:00
Piergiorgio Sartor c4db530180 User space RAID-6 access fix
> I have applied some patch - with some formatting changes to make it consistent
> with the rest of the code.
>
> I don't really have time to look more deeply at it at the moment.
> Maybe someone else will?...

Hi Neil,

thanks for including this in git.

Actually I did it look at it :-) and I already found a
couple of issues, below is a small fix patch.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-18 23:51:19 +11:00
Piergiorgio Sartor 9d0e78406a User space RAID-6 access
> test_stripe assumes that the data starts at the start of each device.
> AS you are using 1.2 metadata (the default), data starts about 1M in to
> the device (I think - you can check with --examine)
>
> You could fix test_stripe to put the right value in the 'offsets' array,
> or you could create the array with 1.0 or 0.90 metadata.

Hi Neil,

thanks for the info, maybe this should be a second patch.

In the meantime, please find attached a patch to restripe.c
of mdadm 3.2 (latest, I hope).

This should add the functionality to detect, in RAID-6,
which of the disks potentially has problems, in case of
parity errors.

Some checks take place in order to avoid false positives,
I hope these are correct and enough.

I'm not 100% happy of the interface (too much redundancy),
but for the time being it could be OK.

Of course, any improvement is welcome.

Please consider to include these changes to the next mdadm
whatever release.

bye,

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-08 11:44:23 +11:00
Adam Kwolek b6e317c83a FIX: Do not use layout for raid4 and raid0 while geo map computing
After takeover, layout has no meaning for computing geo map for raid0
and raid4.  Set layout to 0 for such cases.  It can happen after
takeover operation when not all array information is reread.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-03 15:03:25 +11:00
NeilBrown f21e18ca89 Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 13:13:02 +10:00
NeilBrown fcf5762500 Add _FORTIFY_SOURCE to mdadm.O2 build.
When building mdadm.O2, set _FORTIFY_SOURCE to get more
warnings, and also build mdmon.O2 to find warnings in that
code too.
Then fix the warnings.

Suggested-by: Luca Berra <bluca@comedia.it>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 10:54:17 +11:00
NeilBrown 1eac9f8454 restripe: fix assignment of raid6 blocks for syndrome calculation.
Particularly for the _6 style.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-16 17:50:06 +11:00
NeilBrown 521f349cb0 restripe: fix compile warning.
Just a type cast...

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-12 17:00:23 +11:00
NeilBrown cc50ccdc29 restripe : various fixed for RAID6 2-failure recovery.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-12 16:57:22 +11:00
NeilBrown ca4f89a3b7 Merge branch 'master' into devel-3.1
Conflicts:
	mdadm.8
2009-10-01 16:58:40 +10:00
NeilBrown e38cc2d87b Fix raid6 error recovery in 'restripe' code.
Thanks to Matthias Urlichs for discovering and reporting this.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-09-25 17:23:33 +10:00
NeilBrown e9e43ec367 Grow: support restart of new migrations. 2009-08-13 11:12:54 +10:00
NeilBrown 7236ee7ad4 Handle extra 'grow' variations.
UNFINISHED
2009-08-11 13:02:49 +10:00
NeilBrown a628848379 restripe: support saving when not all devices are present. 2009-07-14 15:12:30 +10:00
NeilBrown e736b62389 Update copyright dates and remove references to @cse.unsw.edu.au
Also removed 'paper' addresses.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-06-02 14:35:45 +10:00
NeilBrown e0d95aac96 restripe: add support for new layouts including DDF
md supports new raid6 layouts to support conversion to and from
raid5 and well as DDF.  Make sure restripe handles those, including
getting the order right for Q-syndrome calculation.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-25 10:52:31 +10:00
NeilBrown 94a20f0c80 Fix alignment for backup of reshape data.
Since we introduced O_DIRECT for device access we need
properly aligned buffers and IO requests.  The reshape code
missed out on the conversion.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:55:15 +10:00
Neil Brown 48327135d6 Teach restripe to calculate Q syndrome for raid6.
This allows mdadm to correctly restart a raid6 grow that
crashed during the critcal phase.
2007-02-22 14:59:19 +11:00
Neil Brown 353632d927 Support restarting of a reshape on --assemble
Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-20 03:17:31 +00:00
Neil Brown e86c9dd6d8 Initial reshape support
Needs work for other levels etc.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-13 05:51:32 +00:00