summaryrefslogtreecommitdiffstats
path: root/mdopen.c
Commit message (Collapse)AuthorAgeFilesLines
* Free some malloced memory that wasn't being freed.NeilBrown2009-10-221-1/+4
| | | | | | | | | | As mdadm is normally a short-lived program it isn't always necessary to free memory that was allocated, as the 'exit()' call will automatically free everything. But it is more obviously correct if the 'free' is there. So this patch add a few calls to 'free' Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: only use 'dev' as chosen name if it is a full path.NeilBrown2009-10-191-2/+1
| | | | | | | Otherwise using names like "r0" causes problem. They are handled sufficiently by other paths in the code. Signed-off-by: NeilBrown <neilb@suse.de>
* 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>
* create_mddev: don't replace /dev/mdX with /dev/md/XNeilBrown2009-05-111-1/+4
| | | | | | | | If someone creates/assemble an array called "/dev/md0", don't force it to be "/dev/md/0". Doing so isn't really necessary and it likely to confuse people. Signed-off-by: NeilBrown <neilb@suse.de>
* create_dev - allow array names like mdX and /dev/mdX to appear 'numeric'NeilBrown2009-05-111-3/+11
| | | | | | | | | | | | | | When choosing the minor number to use with an array, we currently base the number of the 'name' stored in the metadata if that name is numeric. Extend that so that if it looks like a number md device name (/dev/md0 or just md0 or even /dev/md/0), then we use the number at the end to suggest a minor number. The means that if someone creates and array with "--name md0" or even "--name /dev/md0" it will continue to do what they expect. Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: be more careful when adding digit to names.NeilBrown2009-03-101-1/+1
| | | | | | | | If we need to add digits to a name to make it unique, but don't have to add '_', we need to avoid adding a digit immediately after a digit. So if the last character of the name is a digit, add the '_' anyway. Signed-off-by: NeilBrown <neilb@suse.de>
* some warn_unused_result fixupsDan Williams2008-11-271-5/+9
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdopen: typo in buffer-length for a sprintf.NeilBrown2008-11-071-1/+1
| | | | | | | That '10000' should have been '1000'. Make it a 'sizeof' to avoid such carelessness. Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: only let numeric name set minor number if it doesn't cause a conflict.NeilBrown2008-11-041-1/+4
| | | | | | | So if the array with minor number matching the name of a new array already exists, just assemble with a different minor number. Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: use small sequence number for uniquifying array names.NeilBrown2008-11-041-9/+23
| | | | | | | | | Rather than appending the md minor number, we now append a small sequence number to make sure name in /dev/md/ that aren't LOCAL are unique. As the map file is locked while we do this, we are sure of no losing any races. Signed-off-by: NeilBrown <neilb@suse.de>
* Quiet unitialized variable warningsDan Williams2008-11-041-2/+3
| | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdopen: fix up name parsing.NeilBrown2008-11-041-9/+24
| | | | I think this is closer to what I want. Fewer surprises anyway.
* Incremental: adjust to the new naming scheme.NeilBrown2008-11-041-80/+0
| | | | | --incremental now uses exactly the same create_mddev that other code uses.
* mdopen: Restore creation of partition devices and symlink.NeilBrown2008-11-041-33/+36
| | | | | Using the 'new' name scheme we restore the creation of partition links (in the case the udev isn't used).
* mdopen: Introduce new rules for creating device name.NeilBrown2008-11-041-129/+205
| | | | MORE CONTENT HERE
* Introduce new open_mddev which just does an open.NeilBrown2008-11-041-8/+23
| | | | | | | Some cases we aren't interested in creating the mddev, just opening it. Make those more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Rename open_mddev to create_mddevNeilBrown2008-11-041-2/+2
| | | | | | | This reflect that fact that more often than not it is creating things in /dev, and allows for a new open_mddev which does just that. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.0NeilBrown2008-10-301-1/+1
|\ | | | | | | | | | | | | | | Conflicts: Incremental.c super0.c super1.c
| * Incremental: allow assembly of foreign array.NeilBrown2008-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | If a foreign (i.e. not known to be local) array is discovered by --incremental assembly, we now assemble it. However we ignore any name information in the array so as not to potentially create a name that conflict with a 'local' array. Also, foreign arrays are always assembled 'read-auto' to avoid writing anything until the array is actually used. Signed-off-by: NeilBrown <neilb@suse.de>
* | Lots of fixes to make incremental assembly of containers work.NeilBrown2008-09-181-1/+1
|/ | | | | | | | So: mdadm -I /dev/whatever will (if appropriate) add whatever to a container, then start any arrays inside the container.
* Clean up usage of open()Doug Ledford2008-07-241-2/+2
| | | | | | | | Fix on call that passed an invalid mode to open Don't pass a third arg unless we also pass O_CREAT Use symbolic args for 2nd and 3rd args Signed-off-by: Doug Ledford <dledford@redhat.com>
* Make device-special files for partitions when using --incrementalNeil Brown2008-05-051-3/+7
|
* Unify code into find_free_devnum.Neil Brown2008-05-051-31/+5
| | | | | Two places have code to find a free md device number. Make this a subroutine.
* Simplistig locking for --incremental.Bill Nottingham2008-05-051-1/+14
| | | | | | | | | | | | | | | | | | From: Bill Nottingham <notting@redhat.com> mdadm --incremental doesn't really do any locking. If you get multiple events in parallel for the same device (that has not yet started), they will all go down the path to create the array. One will succeed, the rest will have SET_ARRAY_INFO die with -EBUSY (md: array mdX already has disks!) and will exit without adding the disk. Original bug report is: https://bugzilla.redhat.com/show_bug.cgi?id=433932 This is solved by adding very very rudimentary locking. Incremental() now opens the device with O_EXCL to ensure only one invocation is frobbing the array at once. A simple loop just tries to open 5 times a second for 5 seconds. If the array stays locked that long, you probably have bigger issues.
* Create /dev/md if needed and it doesn't exist.Bill Nottingham2008-05-051-0/+14
| | | | From: Bill Nottingham <notting@redhat.com>
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-1/+1
|
* Make sure --auto=mdp is honoured properlyNeil Brown2007-10-171-0/+1
| | | | | This would only create partitioned devices if the device name was a 'standard' name. This this patch, any name will work.
* mdopen.c don't shadow major() and minor()maximilian attems2007-09-271-32/+32
| | | | | | | s/(major|minor)/\1_num/ Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Neil Brown <neilb@suse.de>
* Add new mode: --incrementalNeil Brown2006-12-211-0/+48
| | | | | --incremental allows arrays to be assembled one device at a time. This is expected to be used with udev.
* Default to --auto=yesNeil Brown2006-12-141-7/+7
| | | | | so the array devices with 'standard' names get created automatically, as this is almost always what is wanted.
* Check error return on a couple of syscalls.Michael Labuschke2006-10-231-3/+6
| | | | From: "Michael Labuschke" <michael@labuschke.de>
* Don't fail md_open if array already active.Luca Berra2006-10-161-12/+3
| | | | | | From: Luca Berra <bluca@comedia.it> There is no need and it causes occasional problems.
* Allow symlink creation to be disabled from command line or mdadm.confNeil Brown2006-08-111-5/+5
|
* Create symlinks from /dev into /dev/mdNeil Brown2006-08-111-0/+28
| | | | | When (auto)creating devices in /dev/md/, create an appropriate symlink from /dev to avoid confusion.
* More consistent honoring of --configfileNeil Brown2006-06-261-1/+1
| | | | | Never use /etc/mdadm.conf if --config file is given (previously some code used one, some used the other).
* Support auto-assembling of stacked devicesNeil Brown2006-05-261-1/+1
| | | | | | and assorted bugfixes. Signed-off-by: Neil Brown <neilb@suse.de>
* Never remove device nodes of active devices.Neil Brown2006-05-261-1/+3
| | | | | | This is just too risky. Signed-off-by: Neil Brown <neilb@suse.de>
* Choose better devnumbers and tidy up some issues with finding names.Neil Brown2006-05-261-2/+5
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Just updaqte copyright dates and email addressNeil Brown2006-05-191-1/+1
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Arrange the 'auto' setting in mdadm.conf can choose default type.Neil Brown2006-05-161-34/+59
| | | | | | | | | | | | So when you say auto=md or auto=part in mdadm.conf, it give a preference for type of array, but standard name will override. But --auto=md is more insistant. FIXME I'm not at all happy about handling of names that already exist. I don't think that should be removed if the device is active. Signed-off-by: Neil Brown <neilb@suse.de>
* Allow default creation info to to be stored in mdadm.confNeil Brown2006-05-151-2/+11
| | | | | | Default owner, group, mode and 'auto' flag can be given in a 'CREATE' line. Signed-off-by: Neil Brown <neilb@suse.de>
* Create missing /dev files where needed.Neil Brown2006-03-281-1/+1
| | | | | | | Whenever we need a device file to open, if one cannot be found in /dev, create a temporary one. Signed-off-by: Neil Brown <neilb@suse.de>
* Release some compile fixes.Neil Brown2006-02-061-5/+10
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Sort mdstat entries so that composites are well-ordered.Neil Brown2006-01-311-1/+1
| | | | | | | This means that "-Ds" lists arrays in an approprate order for assembly. Signed-off-by: Neil Brown <neilb@suse.de>
* Replace sprintf calls with snprintfNeil Brown2005-06-141-2/+3
| | | | | | To quiet diet-libc Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add device files created with --auto to list of known device files.Neil Brown2005-06-141-0/+4
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Avoid using lstat, it isn't right.Neil Brown2005-06-141-1/+1
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Fix uninitialised variable compile warning.Neil Brown2005-04-041-1/+1
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Document new --auto behaviourNeil Brown2005-04-041-0/+4
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Change MAJOR() etc to major() etcNeil Brown2005-04-041-8/+13
| | | | | | | | | This allows for larger device number if glibc supports it (requires 2.3.3). Also fail before creating larger device number if glibc support isn't present. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>