summaryrefslogtreecommitdiffstats
path: root/Examine.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mdadm: add xmalloc.hMariusz Tkaczyk2024-09-271-3/+5
| | | | | | | | | | Move memory declaration helpers outside mdadm.h. They seems to be useful so keep them but include separatelly. Rework them to not reffer to Name[] declared internally in mdadm/mdmon. This is first step to start decomplexing mdadm.h. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Examine.c: Fix memory leaks in Examine()Anna Sztukowska2024-09-101-5/+17
| | | | | | | | | Fix memory leaks in Examine() reported by SAST analysis. Implement a method to traverse and free all the nodes of the doubly linked list. Replace for loop with while loop in order to improve redability of the code and free allocated memory correctly. Signed-off-by: Anna Sztukowska <anna.sztukowska@intel.com>
* Change update to enum in update_super and update_subarrayMateusz Kusiak2023-01-041-1/+1
| | | | | | | | | | Use already existing enum, change update_super and update_subarray update to enum globally. Refactor function references also. Remove code specific options from update_options. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Don't associate spares with other arrays during RAID ExamineOleksandr Shchirskyi2021-07-161-1/+1
| | | | | | | | | | | | | | | | Spares in imsm belong to containers, not volumes, and must go into a separate container when assembling the RAID. Remove association spares with other arrays and make Examine print separate containers for spares. Auto assemble without config file already works like this. So make creating a config file and assembling from it consistent with auto assemble. With this change, mdadm -Es will add this line to output if spares are found: ARRAY metadata=imsm UUID=00000000:00000000:00000000:00000000 Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: add verbose flag to compare_superMariusz Tkaczyk2021-03-081-1/+1
| | | | | | | | | | | IMSM does more than comparing metadata and errors reported directly from compare_super_imsm can be useful. Add verbose flag to compare_super method and make all not critical error printing configurable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* examine: tidy up some code.NeilBrown2017-03-061-36/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Michael Shigorin reports that the 'lcc' compiler isn't able to deduce that 'st' must be initialized in if (c->SparcAdjust) st->ss->update_super(st, NULL, "sparc2.2", just because the only times it isn't initialised, 'err' is set non-zero. This results in a 'possibly uninitialised' warning. While there is no bug in the code, this does suggest that maybe the code could be made more obviously correct. So this patch: 1/ moves the "err" variable inside the for loop, so an error in one device doesn't stop the other devices from being processed 2/ calls 'continue' early if the device cannot be opened, so that a level of indent can be removed, and so that it is clear that 'st' is always initialised before being used 3/ frees 'st' if an error occured in load_super or load_container. Reported-by: Michael Shigorin <mike@altlinux.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Release mdadm-3.3mdadm-3.3NeilBrown2013-09-031-1/+1
| | | | | | (and various cosmetic fixes) Signed-off-by: NeilBrown <neilb@suse.de>
* MISC: Add --examine-badblocks optionNeilBrown2012-12-051-0/+36
| | | | | | This will list the contents of the bad-blocks log, if one is present. Signed-off-by: NeilBrown <neilb@suse.de>
* Minor cosmetic fixes in various files.NeilBrown2012-08-131-7/+10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* change Examine to take a struct contextNeilBrown2012-07-091-19/+18
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: split 'verbose' out from 'brief'.NeilBrown2012-07-091-5/+6
| | | | | | | | | | The value of 'verbose' is sometimes mixed into 'brief', particularly for Examine. This is messy and confusing. So keep them separate. 'brief' still gets assumed when 'scan' is set, unless we are very verbose. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-091-1/+1
| | | | | | | | | | | | | | 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>
* Introduce pr_err for printing error messages.NeilBrown2012-07-091-4/+4
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* examine: allows to examine a disk metadata on non-metadata compliant systemsLabun, Marcin2011-03-231-0/+2
| | | | | | | | | | | | | Allow for loading metadata from disk attached to non-metadata compliant system. Affects mdadm --examine and guess_super. Added ignore_hw_compat in supertype to pass information to load_super handler. If ignore_hw_compat is set the handler should load metadata also from disks that do not comply with metadata requirements (i.e. disk is not attached to native controller, etc). Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't close fds in write_init_superNeilBrown2011-01-241-0/+1
| | | | | | | | | | | | | | | We previously closed all 'fds' associated with an array in write_init_super .. sometimes, and sometimes at bad times. This isn't neat and free_super is a better place to close them. So make sure free_super always closes the fds that the metadata manager kept hold of, and stop closing them in write_init_super. Also add a few more calls to free_super to make sure they really do get closed. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add must_be_container helper.NeilBrown2010-11-221-2/+1
| | | | | | | This checks a block device to see if it could be a container, and in particular cannot be a member device. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve type names for mddev_devNeilBrown2010-11-221-1/+1
| | | | | | | | | 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>
* Use new load_container in ExamineNeilBrown2010-11-221-7/+23
| | | | | | | This makes explicit the two different ways to use Examine And removes a user of container_loaded. Signed-off-by: NeilBrown <neilb@suse.de>
* get_info_super: report which other devices are thought to be working/failed.NeilBrown2010-11-221-2/+2
| | | | | | | | | | | | | | 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>
* Add mbr pseudo metadata handler.NeilBrown2010-09-061-1/+5
| | | | | | | | | | | | To support incorpating a new bare device into a collection of arrays - one partition each - mdadm needs a modest understanding of partition tables. The main needs to be able to recognise a partition table on one device and copy it onto another. This will be done using pseudo metadata types 'mbr' and 'gpt'. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: don't count containers as sparesDan Williams2009-09-151-1/+2
| | | | | | | | | | mdadm -Ebs will include containers in the scanned device list. Examine() falsely thinks they are spares when MD_DISK_SYNC is not set. This could be fixed by forcing all formats to set this flag for container devices, but this flag is currently used by imsm to identify free-floating spares. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Examine: fixup output in the presence of containers with sparesDan Williams2009-09-151-3/+9
| | | | | | | If we dump any 'spare' or 'device' information for a container in the 'brief' case then we need a newline before printing member array info. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Exmaine/brief: put member arrays after container arrays.NeilBrown2009-08-071-0/+2
| | | | | | | | | A previous patch moved move the '--examine --brief' reporting of member arrays to before their containers. This breaks "mdadm -As" assembly. So put them back, but still fix the problem addressed by previous patch. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2009-08-071-3/+1
|\
| * fix examine_brief segfaultDan Williams2009-08-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When performing an "-Ebs -e <metadata type>" we segfault because the superblock has been freed too early. We also leak memory for 'ddf' and 'imsm' because, unlike super[01], we do not implicitly free when ->load_super is called on an already loaded supertype. So, fix up imsm and ddf to match type 0 and 1 ->load_super() semantics, and update Examine to not free the superblock until all usages have been exhausted. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Examine: make --metadata= work with --briefNeilBrown2009-07-101-2/+4
|/ | | | | | They had different assumptions about the lifetime of 'st'. 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>
* Make --brief even briefer.NeilBrown2009-05-111-1/+1
| | | | | | | | | | | | | Because ---examine --brief, or --detail --brief are often used to create mdadm.conf, and because people don't want to have to update their mdadm.conf unnecessarily, we don't want to include information that might change. And now that level changing is supported, that is almost everything but UUID. So move some more fields into the "Only print with --verbose" class. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: add examine_export for ddf and avoid crashes.NeilBrown2009-03-091-1/+2
| | | | | | If the personality doesn't provide export_examine_super, don't crash. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: fix MD_DISK_SYNC is a bit not a flagDan Williams2008-10-281-1/+1
| | | | | | | Examine() is actually looking at the ACTIVE bit. This happened to work for imsm spares but now it needs to be fixed up. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* add --export option to --examineKay Sievers2008-05-061-1/+4
| | | | | | | From: Kay Sievers <kay.sievers@vrfy.org> Cc: David Zeuthen <david@fubar.dk> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
* Drop the superblock arg from all metadata methods.Neil Brown2007-12-141-12/+11
| | | | It is now in the 'supertype'
* Fix compare_super to take supertype instead of a superblock.Neil Brown2007-12-141-1/+1
| | | | | As this function takes 2 superblocks, the change is a bit more subtle, so is done separately.
* Add 'supertype' arg to almost all metadata methods.Neil Brown2007-12-141-9/+11
| | | | The 'superblock' will be moved into this structure soon.
* Allow metadata handlers to free their own superblock.Neil Brown2007-12-141-3/+3
| | | | | | As the metadata handler allocates the superblock, it should free it too. DDF will have a more complex 'superblock' which needs more complex freeing.
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-1/+1
|
* Fix error code from examine properly..Neil Brown2006-06-021-5/+6
| | | | | | The last one was wrong :-( Signed-off-by: Neil Brown <neilb@suse.de>
* Make sure homehost is set correctly when --update=uuidNeil Brown2006-05-231-1/+1
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Include homehost information in --examine as appropriateNeil Brown2006-05-191-2/+4
| | | | 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>
* Fix incorrect error status from --examine --scanNeil Brown2006-05-191-2/+3
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Remove ident arg from getinfo_super;Neil Brown2006-03-271-3/+2
| | | | | | Add a 'name' field to 'info' to compensate. Signed-off-by: Neil Brown <neilb@suse.de>
* Provide error message if --examine does find a valid superblockNeil Brown2006-01-271-4/+8
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Allow scanning of devices listed in /proc/partitions independant of /devNeil Brown2005-12-051-2/+2
| | | | | | | If a device found in /proc/partitions isn't listed in /dev, then mknod a temporary name and open that. Signed-off-by: Neil Brown <neilb@suse.de>
* Remvoe blank line from '--examine --brief' output.Neil Brown2005-11-221-1/+2
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Add 'quite' option and tidy up some tests.Neil Brown2005-08-151-1/+1
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Support nameing of version-1 arrays.Neil Brown2005-08-091-2/+3
| | | | | | | --name is recognised in --create and --assemble name= is recognised in config file. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Don't list device= in --examine --scan output.Neil Brown2005-06-141-4/+6
| | | | | | | As the device list isn't stable, recording it should be avoided. The device= list is still available if --verbose is given (once). Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* super1Neil Brown2005-05-041-13/+14
| | | | | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Fix raid5 creation with new code. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add a 'super-switch' so that different format superblocks can be used.Neil Brown2005-05-041-7/+15
| | | | | | | | This includes: adding --metadata= option to choose metadata format adding metadata= word to config file. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>