summaryrefslogtreecommitdiffstats
path: root/udev-md-raid.rules (unfollow)
Commit message (Collapse)AuthorFilesLines
2011-03-18Manage: fix the mess I made in earlier patch.NeilBrown1-4/+6
When I separated the 'native metadata' case more cleanly from the "external metadata" case for adding a drive, I left some 'external' code in the 'native' case, and didn't copy it to the 'external' case. When - in the external case - we add to super, we much check for mdmon first, so we know whether to do the metadata update ourselves or not, then afterwards call either flush_metadata_updates (to send to mdmon) or sync_metadata (to do it directly). Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-17--stop: separate 'is busy' test for 'did it stop properly'.NeilBrown1-2/+36
Stopping an md array requires that there is no other user of it. However with udev and udisks and such there can be transient other users of md devices which can interfere with stopping the array. If there is a transient users, we really want "mdadm --stop" to wait a little while and retry. However if the array is genuinely in-use (e.g. mounted), then we don't want to wait at all - we want to fail immediately. So before trying to stop, re-open device with O_EXCL. If this fails then the device is probably in use, so give up. If it succeeds, but a subsequent STOP_ARRAY fails, then it is possibly a transient failure, so try again for a few seconds. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15Fix regression when using 'grow' to add a bitmap.NeilBrown1-1/+1
When we allowed a devlist to accompany some --grow modes - but not --bitmap - we made --bitmap always fail, in stead of fail of a device was given to add. As 'devs_found' includes the md device, we need to compare against '1'. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15mdadm.man: added encouragement to shrink filesystem before array.NeilBrown1-3/+8
Suggesting by Rory Jaffe <rsjaffe@gmail.com> to make the danger of shrinking, and to recommended avoidance technique, more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15ddf: implement remove_from_superNeilBrown2-7/+60
This is needed to remove devices from mdmon's knowledge when the device is removed from the md container. Now that ddf have a remove_from_super we don't need the code that allows some personalities not to implement this. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15IMSM: Fix problem in mdmon monitor of using removed disk in imsm container.Labun, Marcin3-33/+186
Manager thread shall pass the information to monitor thread (mdmon) that some devices are removed from container. Otherwise, monitor (mdmon) might use such devices (spares) to rebuild the array that has gone degraded. This problem happens for imsm containers, since a list of the container disks is maintained in intel_super structure. When array goes degraded, the list is searched to find a spare disks to start rebuild. Without this fix the rebuild could be stared on the spare device that was a member of the container, but has been removed from it. New super type function handler has been introduced to prepare metadata format specific information about removed devices. int (*remove_from_super)(struct supertype *st, mdu_disk_info_t *dinfo) The message prepared in remove_from_super is later processed by process_update handler in monitor thread. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15DDF Allow a RAID1 to be 'partially optimal'.NeilBrown1-0/+2
If a RAID1 is meant to have more than 2 device and while it doesn't have that many, it still has more than 1, then according to the DDF spec it is "partially optional" rather than "degraded" So make that so. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15ddf: remove failed devices that are no longer in use.NeilBrown1-0/+42
The DDF spec requires we have a phys disk record for every physically attached device. But it isn't clear what that means in the case of soft raid in a general purpose Linux computer. So remove phys disk records for any failed device that is not active in any array. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15ddf: set Rebuilding flag when adding devices to a degraded arrayNeilBrown1-2/+15
This is a big fragile, but DDF has wierd rules that we aren't really set up to handle properly. When we add a device to a degraded array it must be a spare, so mark it as Rebuilding. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15ddf: use correct loop variable in activate_spareNeilBrown1-4/+5
Using 'i' when you mean 'j' just shows how silly it is to use variables named 'i' and 'j'. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15ddf: Don't consider 'dl' entries with state_fd < 0NeilBrown1-1/+2
These have been marked as invalid (recently failed) so don't trust the major/minor associated with them. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15managemon: Don't do spare assignment while any updates are pending.NeilBrown1-1/+6
Spare assignment requires full knowledge of array state. A pending update might modify that state (such as a pending spare assignment) so don't try while there are updates pending. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15Manage/external: for external metadata, add_to_super needs lock on container.NeilBrown1-5/+12
add_to_super could use information from the current superblock (ddf does), so add_to_super for external metadata should be called with the O_EXCL lock held on the container to ensure the update is complete before any other process tries to make any changes (like adding another device to array). Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14imsm: FIX: existing backup file fails unit testsAdam Kwolek1-2/+6
During normal test execution, backup file is deleted after test execution. If test is interrupted/broken, backup file can remain for next run. When backup file exists before unit test run, suits 12 and 13 fails. To avoid this remove backup file before grow is executed. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: implement remove_from_superNeilBrown2-7/+60
This is needed to remove devices from mdmon's knowledge when the device is removed from the md container. Now that ddf have a remove_from_super we don't need the code that allows some personalities not to implement this. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: zero space_list in ddf_activate_spare.NeilBrown1-0/+1
Currently ->space_list is uninitialised here, which is obviously bad. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: set vcnum correctly when creating a new virtual device in conflistNeilBrown1-0/+8
We weren't setting ->vcnum at all when an array was added. This meant that a subsequent device failure could be assigned to the wrong array. Reported-by: Albert Pauw <albert.pauw@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: teach set_disk to cope with new or changed devices.NeilBrown1-8/+33
When set_disk is called, we need to check if the disk has changed or recently appeared, and update everything properly if it has. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: free_super should be add_list as well.NeilBrown1-0/+9
It is possible there is data and even an open file descriptor on 'add_list' - so it must be freed too. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14ddf: minor activate_super fixes.NeilBrown1-2/+4
1/ ignore devices with "state_fd < 0" as these have been removed. 2/ Set update 'length' properly and clear 'space'. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14monitor: close recovery_fd when closing state_FdNeilBrown1-0/+1
These should be open or closed together. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14Warn the user about too small array sizeKrzysztof Wojcik3-5/+14
If single-disk RAID0 or RAID1 array is created, user may preserve data on disk. If array given size covers all partitions on disk, all data will be available on created array. If array size is too small (not covers all partitions), data will be not accessible. This patch introduces warning message during array creation if given size is too small. User may interrupt creation process to avoid data loss. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14platfrom_intel: find OROM based on Intel AHCI and SAS driver device idLabun, Marcin2-19/+61
We use PCI device id exposed by AHCI and ISCU drivers (SAS controller) to find OROM version table. In this way there is no need to maintain AHCI and ISCU device id list in mdadm. The consequence is that the OROM properties can be found by mdadm when AHCI or SAS drivers are loaded in the system. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14imsm: FIX: Store checkpoint in per disk unitsAdam Kwolek1-2/+6
While last_checkpoint is counter in per disk units, checkpoints should be stored in the same manner. Restoring from checkpoint should should recalculate checkpoint in to array position (reshape_progress). Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14FIX: Last_checkpoint has to be initialized in per disk unitsAdam Kwolek1-0/+9
last_checkpoint is variable that tracks sync_complete sysfs entry. sync_complete is per disk counter, so initializing during starting from checkpoint has to have this in mind and convert reshape position properly. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14FIX: Last checkpoint is not initialized on reshape restartAdam Kwolek1-0/+15
When reshape is restarted and active array in mdmon is being initialized, mdmon has to know last checkpoint, otherwise reshape will be restarted form '0' position. mdadm when reshaped array is assembled stores reshape_position in sysfs and runs mdmon. Initialize last_checkpoint in active array structure to value present in sysfs for reshaped array start. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14FIX: Unfreeze array on success onlyAdam Kwolek1-2/+3
Unfreeze array on success only. rv is initialized by restart variable so we have 2 cases. 1. regular reshape start rv == restart == 0 this means that real error (returned by reshape) can cause leaving container frozen If array is not touched by reshape it can be unfrozen 2. During reshape restart even untouched array under reshape is left unfrozen, If reshape is started do not unfreeze array on error also. This allows user for array repair action (mdmon will not change array state). Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10ddf: Failed should suppress Online and others.NeilBrown1-0/+3
so the notes say, so make it so. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Manage: be more careful about --add attempts.NeilBrown4-9/+59
If an --add is requested and a re-add looks promising but fails or cannot possibly succeed, then don't try the add. This avoids inadvertently turning devices into spares when an array is failed but the devices seem to actually work. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10ddf: remove duplicate container_member setting.NeilBrown1-1/+0
We were setting ->container_member twice in ddf get_info. Once to currentconf->vcnum, once to atoi(st->subarray). Both should be the same. For consistency with super-intel, use the first. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Fix warning about host-endian bitmaps.NeilBrown1-4/+4
Hostendian bitmaps should be warned about on all arch's. And fix a speeling mistake. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Grow: give useful message when adding bitmap gives EBUSY.NeilBrown1-1/+10
If adding a bitmap fails with EBUSY, then it is because the array is currently resyncing/recovering/reshaping. As this is non-obvious, give a message explaining the fact. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Assemble: add --update=no-bitmapNeilBrown4-6/+22
This allows an array with a corrupt internal bitmap to be assembled without the bitmap. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Assemble: call remove_partitions later.NeilBrown1-4/+6
We shouldn't call remove_partitions until we have made a really firm decision to include the device into the array. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10mdmon: don't copy an invalid chunk_sizeNeilBrown3-3/+0
As chunk_size in mdstat_ent is never set, we shouldn't copy it into a->info.array. In fact, it is safest to get rid of the field altogether. Reported-by: "Kwolek, Adam" <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10ddf: fail creation of new subarray with same name as old.NeilBrown2-0/+16
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Create: report failure if array cannot be started.NeilBrown2-4/+12
We weren't checking the result of writing 'active' to array_state Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Grow: disallow placing backup file on array being reshaped.NeilBrown1-0/+18
the tests here aren't perfect, but they could catch some cases. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Create/grow: improve checks on number of devices.NeilBrown3-16/+17
Check on upper limit of number of devices was in the wrong place. Result was could not create array with more than 27 devices without explicitly setting metadata, even though default metadata allows more. Fixed, and also perform check when growing an array. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10error check reading of 'degraded' from sysfs.NeilBrown1-1/+2
I'm seen mdadm spinning while failing to read 'degraded'. This doesn't really fix it, but is a reminder that it needs to be fixed. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10FIX: Reset disk state if disk is missingKrzysztof Wojcik1-0/+1
If we can't read actual disk state, it shoud be initiated to 0. Overwise it may be out of date value resulting false action later in code (e.g. set disk to improper state). Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10open_mddev: open RDONLY if RDWR doesn't work.NeilBrown1-0/+2
If an array is read-only then "mdadm -S" cannot open it to stop it without this fix. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Initialise all of file when opening backup file for reshape.NeilBrown1-1/+1
Due to a miscalculation we didn't initialise the whole file. There is 4K (8 sectors) for the metadata, then the data. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10mdadm.man add encouragement to shrink filesystem before shrinking array.NeilBrown1-0/+23
Before resizing an array with --size or --array-size, then filesystem should be resized. mdadm cannot do this so the user should. Reported-by: Gavin Flower <gavinflower@yahoo.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Detail: report subarrays of a container properly.NeilBrown1-1/+1
Due to the wrong variable being used, this part of --detail wasn't working at all. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10dev_open should always open read-only.NeilBrown1-1/+1
When opening an array to manipulate it we never need to write to the array and sometimes it might be read-only so the open for write will fail. So always open read-only. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Man page updates for new --grow options.NeilBrown2-20/+61
Describe all the new ways that mdadm can reshape arrays. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Grow: allow monitor thread to exit when there is nothing more to do.NeilBrown1-0/+5
When an array using native metadata is increasing in size, we don't need to keep monitoring it after the initial 'critical section'. So detect that case. If a final level-change is still needed mdadm will wait for that, otherwise it will simply exit. Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Grow: don't forget_backup when length of backup is zero.NeilBrown1-4/+8
This is just a waste of IO Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10Grow: make sure 'info' doesn't have confusing data.NeilBrown1-0/+1
We now test ->reshape_active, but don't set it in a common case. So just zero out the whole structure to be on the safe side. Signed-off-by: NeilBrown <neilb@suse.de>