summaryrefslogtreecommitdiffstats
path: root/sysfs.c
Commit message (Collapse)AuthorAgeFilesLines
* Generate 'change' uevents when arrays change in non-obvious ways.NeilBrown2008-11-041-0/+16
| | | | | | | | | | | When a 'container' gets started, we need udev to notice, but the kernel has no way of knowing that a KOBJ_CHANGE event is needed. So send one directly via the 'uevent' sysfs attribute. Also, uevents don't get generated when md arrays are stopped (prior to 2.6.28) so send 'change' events then too. Signed-off-by: NeilBrown <neilb@suse.de>
* Move recently merged /sys/dev/ lookup into stat2devnum.NeilBrown2008-11-041-37/+9
| | | | | | | | But sysfs_init and stat2devnum try to convert stat information into an md devnum. Combine all the value of both pieces of code into stat2devnum and have sysfs_init call that. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.0NeilBrown2008-10-301-3/+26
|\
| * Adjust major number testing to allow for extended minor number in 2.6.28NeilBrown2008-10-301-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | From 2.6.28, normal md device will be able to have partitions. These partitions will have a different major number. Sometimes mdadm tests the major number and so can get confused. Change these tests to test against get_mdp_major(). mdp does not use extended minor number and so this test will always be accurate. Also use /sys/dev links to map major/minor to devnum in sysfs. Signed-off-by: NeilBrown <neilb@suse.de>
* | sysfs_open leaks devnum2devname() resultDan Williams2008-10-151-1/+6
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | --wait-clean: shorten timeoutDan Williams2008-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: dprintf when we fail to write a sysfs fileDan Williams2008-10-151-1/+4
| | | | | | | | | | | | | | When arrays do not startup correctly it would be nice to know why. Need to move the dprintf definition to mdadm.h Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-30/+48
| | | | | | | | | | | | | | | | | | | | When we assemble an array, there are three different approaches depending on whether metadata is internal or external, and on kernel version. Move all this to a common helper instead of duplicating in 3 places. Signed-off-by: NeilBrown <neilb@suse.de>
* | Factor out add-disk codeNeilBrown2008-09-181-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
* | sysfs: detect disks that are in the process of being removedDan Williams2008-09-151-5/+24
| | | | | | | | | | | | | | | | | | When removing a disk there is a window where the 'slot' attribute of md/dev-$name will return -EBUSY to read attempts. When this happens look at the the 'block' link, if it is removed then we can be sure the device has been removed, versus some other error. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | 'mdadm --wait-clean' wait for array to be marked cleanDan Williams2008-09-151-0/+55
| | | | | | | | | | | | | | | | | | For use in distro shutdown scripts with a RAID root file system. Returns immediately if the array is 'readonly', or not an externally managed array. It is up to the distro's scripts to make sure no new writes hit the device after this returns 'true'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-151-0/+13
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | mdmon: allow degraded arrays to be monitoredDan Williams2008-08-151-0/+6
| | | | | | | | | | | | | | manage_new is too strict in the face of failed devices. Teach it to monitor degraded arrays. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: deprecate sysfs_disk_to_sgDan Williams2008-07-241-0/+2
| | | | | | | | | | | | | | | | | | | | The cmd_filter patch merged for 2.6.27 broke retrieving the serial number via an ioctl to /dev/sgN. In debugging this I found that other utilities like sdparm simply run the ioctl on /dev/sdX. So just convert to that for protection in numbers, but scream on the mailing list for the inconvenience grr... Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: avoid possible data corruption in sys_load.NeilBrown2008-07-181-1/+1
| | | | | | | | | | | | Don't retry to remove a newline from the end of an empty string. Signed-off-by: Neil Brown <neilb@suse.de>
* | Correct readlink usage in sysfs.cNeilBrown2008-07-181-2/+4
| | | | | | | | | | | | | | readlink doesn't nul-terminate the returned string, so we must be sure to do that. Signed-off-by: Neil Brown <neilb@suse.de>
* | Introduce devname2devnumNeil Brown2008-07-121-7/+1
| | | | | | | | and use it instead of opencoding.
* | Correct unit conversion for component_size and dev/size in sysfs.Neil Brown2008-07-121-2/+2
| | | | | | | | These are both Kilobytes, so do the conversion to sectors properly.
* | Handle device removal from containerNeil Brown2008-07-121-0/+63
| | | | | | | | | | | | | | This really should be done in mdadm, not mdmon. We ensure the device won't be suddenly commited as a hot-spare using O_EXCL, then check the 'holders' sysfs directory to make sure it is only in use once.
* | Remove 'major' from superswitch.Neil Brown2008-07-121-1/+3
| | | | | | | | It isn't generally meaningful.
* | sysfs: helper routine to retrieve the scsi idDan Williams2008-06-131-0/+49
| | | | | | | | | | | | imsm records this information in its metadata Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: provide a helper function for locating scsi_generic interfacesDan Williams2008-06-131-0/+65
| | | | | | | | | | | | imsm records and validates this data in its metadata Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Add DDF code for activate_spareNeil Brown2008-06-121-0/+1
| | | | | | | | Plus various bug fixes etc.
* | Don't ignore errors in sysfs_add_disk.Neil Brown2008-06-121-5/+6
| | | | | | | | | | i.e. if the add fails, don't add the device to the internal data structures.
* | 'errno' is a positive number, not negative.Neil Brown2008-05-271-1/+1
| | | | | | | | I've been living in the kernel too long ;-)
* | Remember to close directories when we are finished with them.Neil Brown2008-05-271-1/+4
| |
* | Remove 'fd' arg from sysfs_add_diskNeil Brown2008-05-271-1/+1
| | | | | | | | | | It it never used, and removing means there are several 'open's that can go.
* | Merge mdmonNeil Brown2008-05-151-0/+29
| |
* | set resync_start in Incremental_containerDan Williams2008-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | From: Dan Williams <dan.j.williams@intel.com> Metadata handlers set mdinfo.resync_start depending on the state of the array. By default mdadm assumes the array is dirty and needs a full resync. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Create a container memberNeil Brown2008-05-151-1/+2
| | | | | | | | From: Neil Brown <neilb@suse.de>
* | More ddf stuffNeil Brown2008-05-151-0/+53
|/
* Compiple fixes for mdassemble and diet-libcNeil Brown2008-05-151-4/+4
|
* Recent change broken handling of metadata-less arrays.Neil Brown2008-05-151-2/+3
| | | | | In particular, failing a device would give a silly error message.
* Use sysfs info for metadata version info in Detail and elsewhere.Neil Brown2007-12-141-1/+5
|
* Replace sysarray with mdinfoNeil Brown2007-12-141-27/+32
| | | | | Sure, mdinfo is bigger, but having a uniform structure for lots of things will make life easier.
* Use 'mdinfo' instead of special 'sysdev' structure.Neil Brown2007-12-141-17/+17
| | | | | there is needless duplicatiion between mdinfo and sysdev, so discard the latter.
* Make sure sysfs_read never succeeds for a non-MD device.Neil Brown2007-12-141-1/+4
| | | | ... just in case.
* Add new mode: --incrementalNeil Brown2006-12-211-6/+24
| | | | | --incremental allows arrays to be assembled one device at a time. This is expected to be used with udev.
* When resync finished, report the mismatch count if there is one.Neil Brown2006-12-141-0/+6
| | | | | This doesn't get mailed out, but will appear in syslog... Maybe it should be mailed if it was a 'check' or 'repair' pass...
* Increase raid456 stripe cache size if needed to --grow the array.Neil Brown2006-12-141-0/+6
| | | | | The setting used unfortunately requires intimate knowledge of the kernel, and it not reset when the reshape finishes.
* Fix problem with sector/KB size confuision for bitmap sizing.Neil Brown2006-05-151-2/+2
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* [PATCH] Get the name for partitioned devices in sysfs correct.Neil Brown2006-04-281-2/+2
| | | | | | | | | | | | There are 64 partitions per device, not 16. Signed-off-by: Neil Brown <neilb@suse.de> ### Diffstat output ./sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff ./sysfs.c~current~ ./sysfs.c
* Support restarting of a reshape on --assembleNeil Brown2006-03-201-0/+4
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Initial reshape supportNeil Brown2006-03-131-0/+265
Needs work for other levels etc. Signed-off-by: Neil Brown <neilb@suse.de>