summaryrefslogtreecommitdiffstats
path: root/Create.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Create: reduce the verbosity of 'default_layout'.NeilBrown2012-03-081-1/+1
| | | | | | | We only need this the first couple of times. Reporting it for every device is not necessary. Signed-off-by: NeilBrown <neilb@suse.de>
* Print error message if failing to write super for 1.x metadataJes Sorensen2012-02-221-3/+0
| | | | | | | | | | | | In addition remove attempt to print an error message if write_init_super() fails, as this is handled in the various write_init_super() functions. This avoids a segfault on error. Reported by Jim Meyering in https://bugzilla.redhat.com/show_bug.cgi?id=795461 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Verify if array name doesn't exist alreadyAdam Kwolek2011-12-221-0/+12
| | | | | | | | | | | | | | | | When e.g. array name (an) is correct and it is the same as container name (cn), file element creation /dev/md/an will replace /dev/md/cn. This can cause that user cannot access container using /dev/md/cn. Verify during array creation if chosen name is not already existing one. [Changed to use map_by_name() rather than stat() to determine prior existence - NeilBrown] Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create() check malloc() return valueJes Sorensen2011-10-221-0/+4
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create() don't leave the lock hanging on errorJes Sorensen2011-10-221-5/+8
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: improve messages from validate_geometry.NeilBrown2011-09-211-4/+14
| | | | | | | | | | | | | When validate_geometry finds that we haven't committed to a metadata yet and that the subdev is a member of 'our' container, it needs to report any errors it finds as Create() cannot report them effectively. So make a slight change to the semantics of the 'verbose' flag and allow validate_geometry to report if it printed any error messages. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: getinfo_super_imsm_volume() doesn't fill all disk informationNeilBrown2011-07-141-9/+0
| | | | | | | | | | | | | getinfo_super_imsm_volume doesn't correctly set info.disk fields because it doesn't know which disk to set them from. It should be the last disk passed to add_to_super. So add a field 'current_disk' to record this disk in add_to_super, and use it in getinfo_super. This allows us to remove a hack in Create.c Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Cannot create volumeAdam Kwolek2011-06-141-1/+9
| | | | | | | | | | getinfo_super() can clear entire 'inf' structure before filling with new information. Disk number required later is lost. Restore disk number information after getinfo_super() call. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* getinfo_super now clears the 'info' structure before filling it in.NeilBrown2011-06-081-1/+1
| | | | | | | | | | | | | | Some code currently clears 'info' before calling getinfo_super, some code doesn't. To be consistent, change it so no caller ever clears 'info', but ever getinfo_super function must clear it. Note that ->raid_disk may be meaningful if that 'map' is passed non-NULL. In that case it is copied out before the structure is zeroed. Signed-off-by: NeilBrown <neilb@suse.de>
* Restore ability to create imsm array from specific devices.NeilBrown2011-05-231-1/+7
| | | | | | | | | | | A recent change to improve error messages make it not possible to create an array from devices that are 'busy'. However if they are made busy by a container, then the create should be allowed. So move one of the error messages later. Reported-by: "Wojcik, Krzysztof" <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: add error checking for 'write_init_super'.NeilBrown2011-05-111-1/+7
| | | | | | If this fails, we really must fail the whole 'create'. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: give better error message if member device unusable.NeilBrown2011-05-101-0/+16
| | | | | | | Rather than just saying "unusable", report if device is busy or is no a block device. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: allow chunksize to be non-power-of-2.NeilBrown2011-05-101-0/+4
| | | | | | | RAID0 has accepted chunksizes that are not a power of 2 since 2.6.30. So it time mdadm allowed that to be used. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: fix size after setting default chunkCzarnowska, Anna2011-04-051-7/+18
| | | | | | | | | | | | | | When -e option is given then the first validate_geometry sets default chunk. Size must be rounded there and do_default_chunk needs to be set to 0 so that we don't repeat the message below. If we start without st then what we find on the the first disk determines the st and sets chunk. So after running validate_geometry on the first disk we need to fix the size too. At this point chunk should always be set but it is safer to keep the check. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: check for UnSet when looking at chunkCzarnowska, Anna2011-04-051-2/+2
| | | | | | | | | A default chunk size of 0 gets modified to UnSet, so any location that checks for !chunk really needs to check for !(chunk || chunk == UnSet). Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: ping_monitor() usage causes memory leaksAdam Kwolek2011-03-181-1/+1
| | | | | | | | | | When for ping_monitor() input devnum2devname() is used, received string pointer should be passed to free() for memory release. It is not made in several places. This use case should have function to avoid memory leak. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Warn the user about too small array sizeKrzysztof Wojcik2011-03-141-3/+3
| | | | | | | | | | | | 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>
* Fix chunksize defaulting.NeilBrown2011-03-091-2/+9
| | | | | | | | | the new code for defaulting chunksizes didn't work quite right - default was set to late in super1/super0/ddf - defaults would over-ride values of '0' imposed by some levels - default value wasn't applied to size properly. Signed-off-by: NeilBrown <neilb@suse.de>
* Partitions could be meaningful on single-drive RAID0Krzysztof Wojcik2011-02-271-1/+2
| | | | | | | | | | | | | | | | If we create a single-drive RAID0 array on partitioned drive, we do not lose information about disk structure after operation (partitions are visible on created array) Warning message: mdadm: partition table exists on /dev/sdX but will be lost or meaningless after creating array" is not necessary during creation single-drive RAID0 array. This patch removes the message. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* set default chunk in validate_geometryCzarnowska, Anna2011-02-221-11/+14
| | | | | | | | | | | | | | | | | | | | | | When chunk size is not set from command line we need to guess it depending on metadata given on command line or found on listed devices. Validate_geometry sets the default for it's metadata if chunk is not set. For external metadata chunk is set only when creating in a container. For imsm validate_geometry_imsm_orom is responsible for finding default chunk depending on container metadata loaded. Container will already know which controller it is attached to, and have this controllers orom available. do_default_chunk indicates that we need to find default chunk and if validate_geometry fails for some metadata it tells us to reset chunk that may have been set. Current solution would set default chunk correctly for imsm only if container device was given on command line. With the list of devices chunk was always set to 512. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: memory leak in CreateCzarnowska, Anna2011-02-211-1/+3
| | | | | | | | match_metadata_desc allocates memory for st which is not needed after validate_geometry fails Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Call free_super earlier when creating an array.NeilBrown2011-01-311-2/+1
| | | | | | | | | | | As free_super now closes fds for member devices, rather than write_init_super doing it, we need to call free_super earlier, so that the device (on which we hold an O_EXCL open) is closed before it is added to the array. So close at the end of pass-1 rather than after pass-2. Signed-off-by: NeilBrown <neilb@suse.de>
* Create/grow: improve checks on number of devices.NeilBrown2010-12-011-2/+10
| | | | | | | | | | 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>
* Create: report failure if array cannot be started.NeilBrown2010-12-011-4/+11
| | | | | | We weren't checking the result of writing 'active' to array_state Signed-off-by: NeilBrown <neilb@suse.de>
* Create: cleanup/unify default geometry handlingDan Williams2010-11-231-15/+6
| | | | | | | | Support metadata specific level, layout and chunksize defaults. Kill an uneeded superswitch methods ahead of adding more for the reshape case. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Replace various load_super calls with load_containerNeilBrown2010-11-221-5/+5
| | | | | | | When we call load_super expecting to find a container, we now just call load_container directly. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve type names for mddev_devNeilBrown2010-11-221-3/+3
| | | | | | | | | Remove the _t pointer typedef and remove the _s suffix for the structure, These things do not help readability. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: user container_dev rather than subarray for some tests.NeilBrown2010-11-221-3/+4
| | | | | | | | | It makes more sense to test for container_dev than for subarray for several places in Create where it then uses container_dev. This allows us to subsequently remove subarray. Signed-off-by: NeilBrown <neilb@suse.de>
* get_info_super: report which other devices are thought to be working/failed.NeilBrown2010-11-221-4/+4
| | | | | | | | | | | | | | To accurately detect when an array has been split and is now being recombined, we need to track which other devices each thinks is working. We should never include a device in an array if it thinks that the primary device has failed. This patch just allows get_info_super to return a list of devices and whether they are thought to be working or not. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2010-07-061-2/+6
|\
| * create: Check with OROM limit before setting default chunk sizeDave Jiang2010-06-161-2/+6
| | | | | | | | | | | | | | | | | | | | Make create check with the appropriate meta data handler and see what the largest chunk size is supported. The current 512K default is not supported by existing imsm OROM. [dan.j.williams@intel.com: trim the upper limit to 512k for future oroms] Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Create: fix typo in RAID10 default layout message.NeilBrown2010-06-171-1/+1
|/ | | | | | | It reports "layout defaults to n1" but it means "... to n2". Reported-by: Adrian Sandor <aditsu@yahoo.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: cleanup after failed create in duplicated array member caseDan Williams2010-04-191-2/+8
| | | | | | | | | | | | | | | | mdadm prevents creation when device names are duplicated on the command line, but leaves the partially created array intact. Detect this case in the error code from add_to_super() and cleanup the partially created array. The imsm handler is updated to report this conflict in add_to_super_imsm_volume(). Note that since neither mdmon, nor userspace for that matter, ever saw an active array we only need to perform a subset of the cleanup actions. So call ioctl(STOP_ARRAY) directly and arrange for Create() to cleanup the map file rather than calling Manage_runstop(). Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Don't attempt to create or read bitmaps where the metadata doesn't support it.NeilBrown2010-04-071-0/+5
| | | | | | | In particular, if the relevant bitmap method is NULL, don't try to call it, print an error instead. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: Improve warning message about booting from v1.xNeilBrown2010-02-011-2/+2
| | | | | | | | | | | Suggesting that if your boot loaded doesn't support v1.x, then use --metadata=1.0 doesn't make a lot of sense. Also, '/', isn't really important, it is /boot that matters. Hopefully people who have /boot on '/' realise that /boot is on '/' .... Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2009-12-301-1/+1
|\
| * Introduce MaxSectorDan Williams2009-12-211-1/+1
| | | | | | | | | | | | | | Replace occurrences of ~0ULL to make it clear we are talking about maximal resync/recovery position. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Check partition tables when creating array.Trela, Maciej2009-12-081-3/+14
|/ | | | | | | When creating an array, check if the devices have partition tables and print a warning if the table or the partitions might be destroyed by array creation. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: warn when creating a raid1 using default metadata.NeilBrown2009-11-191-0/+11
| | | | | | | | As a some/most bootloaders don't understand md metadata, it might be difficult to boot off an array with the default 1.0 metadata. So if this is used for a RAID1, ask for confirmation. Signed-Off-By: NeilBrown <neilb@suse.de>
* Improve error messages when metadata handler does not support request.NeilBrown2009-11-171-2/+2
| | | | | | | | | ->validate_geometry is called to validate overall parameters, and to validate each individual device. If it ever fails, it needs to report the reason, as common code cannot possible know. Signed-off-by: NeilBrown <neilb@suse.de>
* Increase default chunk size to 512KNeilBrown2009-11-171-1/+8
| | | | | | | | | | | This seems more appropriate for current (and recent) model drives than 64K. 64K is still the default for '--build' as changing that could corrupt data. 64K is also the default rounding for 'linear' on kernels older than 2.6.16. Signed-off-by: NeilBrown <neilb@suse.de>
* conditionally update uuids in the map file after Create()Dan Williams2009-08-011-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The map file needs to be updated after adding the first member array to an Intel metadata container. The uuid for an imsm container uses the ->family_num field of the metadata. This field is static, but is only set after the first member array has been created. Prior to this all devices are free floating spares and do not have any information that can identify specific container membership. At Create() time we take the uninitialized uuid from ->get_info_super() prior to updating the metadata. So the current result is: # mdadm --create /dev/md/imsm /dev/sd[b-e] -n 4 -e imsm # mdadm --create /dev/md/vol0 /dev/md/imsm -n 4 -l 0 # cat /var/run/mdadm/map md126 /md127/0 3e03aee2:78c3c593:1e8ecaf0:eefb53ed /dev/md/vol0 md127 imsm 53d6f8b1:7a783f24:f30483c5:705c48c7 /dev/md/imsm # mdadm -Ebs ARRAY metadata=imsm UUID=589d2d2c:4221a54d:acb63c06:c3907f52 ARRAY /dev/md/vol0 container=589d2d2c:4221a54d:acb63c06:c3907f52 member=0 UUID=57b89b63:5cd0eae1:17dd26b3:51cc78d4 So, before we write out the new metadata check to see if the member array uuid has changed as a result of this addition. If it has, update its uuid in the map file and flag its parent container for updating. In support of updating the container uuid the semantics of ->write_init_super are changed to clear any metadata specific member array cursors (e.g. ddf_super.currentconf or intel_super.current_vol) such that a subsequent call to ->getinfo_super returns container information. Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-7/+2
| | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* wait_for improvement.NeilBrown2009-04-071-2/+2
| | | | | | | | wait not only for the name to appear, but for it to refer to the correct device. Sometimes old symlinks left lying around can be confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: round to chunk sizeNeilBrown2009-04-061-0/+2
| | | | | | | There are probably other places where rounding size to chunksize is needed, or useful, but this is a good start. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: fixup 'insert_point', dependent on 'subdevs', for auto-layoutDan Williams2009-02-251-1/+5
| | | | | | | | | 'subdevs' is read from the container in the auto-layout case so reset subdevs dependent default values. 'insert_point' without this change is always 2 blocking creation of arrays with > 2 raid disks. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: wait_for container creationDan Williams2009-02-251-0/+1
| | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: warn when a metadata format's platform components are missingDan Williams2009-01-201-0/+8
| | | | | | | | | | | | | | If the metadata handler can not find its platform support components then there is no way for it to verify that the raid configuration will be supported by the option-rom. Provide a generic method for metadata handlers to warn the user that the array they are about to create may not work as intended with a given platform. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: allow per-metadata default layoutsDan Williams2009-01-201-25/+48
| | | | | | | | Let handlers specifiy their own defaults, specifically needed for the imsm-raid5 case where mdadm defaults to 'ls' and imsm to 'la'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Create: support autolayout when creating in a DDFNeilBrown2008-12-041-30/+56
| | | | | | | | | If, when creating an array, a signal target device is given which is a container, then allow the metadata handler to choose which devices to use. This is currently only supported for DDF. Signed-off-by: NeilBrown <neilb@suse.de>