summaryrefslogtreecommitdiffstats
path: root/daemons/cmirrord/functions.c
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: replace memset with struct initilizationZdenek Kabelac2012-06-221-6/+2
| | | | | Simplifies the code, properly detects too long socket paths, drops unused parameter.
* cmirrord: fix cut&pasteZdenek Kabelac2012-06-201-1/+1
|
* cmirrord: add test for closedir() and close()Zdenek Kabelac2012-06-201-4/+9
|
* Remove some whitespaces.Milan Broz2012-03-101-4/+4
| | | | (test commit)
* Remove unneeded assignmentsZdenek Kabelac2012-02-081-1/+1
| | | | Variables have (or will have) those values set.
* Keep page_size as signed numberZdenek Kabelac2012-02-081-1/+1
| | | | Since it's return value from sysconf and is checked for <0.
* cmirrord now returns log name to kernel in CTR so it can be registeredJonathan Earl Brassow2011-10-141-1/+4
| | | | | | | | | | | | Version 2 of the userspace log protocol accepts return information during the DM_ULOG_CTR exchange. The return information contains the name of the log device that is being used (if there is one). The kernel can then register the device via 'dm_get_device'. Amoung other things, this allows for userspace to assemble a correct dependency tree of devices - critical for LVM handling of suspend/resume calls. Also, update dm-log-userspace.h to match the kernel header associated with this protocol change. (Includes a version inc.)
* Check for failing 'stat' and skip this loop iterationZdenek Kabelac2011-09-211-3/+14
| | | | | | | | | | | | | (since data in statbuf are invalid). Check whether sysconf managed to find _SC_PAGESIZE. Report at least debug warning about failing unlink (logging scheme here seems to be a different then in lvm). Duplicate terminal FDs and use similar code as is made in clvmd and cleanup warns about missing open/close tests. FIXME: Looks like we already have 3 instancies of the same code in lvm repo.
* Detect sscanf recovering_region input errorZdenek Kabelac2011-09-061-2/+5
| | | | Missing check for sscanf found by static analyzer.
* Removed unused pointerZdenek Kabelac2010-12-201-3/+2
| | | | Pointer 'duplicate' is unused.
* Use dm_free for dm_malloc-ed areas in _clog_ctr/_clog_dtr (cmirrord).Zdenek Kabelac2010-12-201-15/+12
| | | | | | Use dm_zalloc to obtain zeroed memory block. Use dm_free for dm_ allocated memory blocks. Test close() for error.
* Add missing return for NULL passed bufferZdenek Kabelac2010-10-261-1/+3
| | | | | | Function pull_stateo() checks for NULL 'buf' - but return for this error path was missing. cmirror code never calls this function with NULL 'buf', so this fix has no effect on current code base, but makes clang happier.
* This patch fixes an issue where cluster mirror write I/OJonathan Earl Brassow2010-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | can be opprobriously slow if created with '--nosync'. One of the ways cluster mirrors coordinate I/O and recovery amoung the different machines is by the use of the log function 'is_remote_recovering()' which lets nodes know if a region they wish to perform a write on is currently being recovered on another node. If the region is being recovered, the I/O is delayed. The 'is_remote_recovering' routine has been optimized to avoid the deluge of requests that would be issued to the userspace log server by maintaining a marker of how far the recovery has gotten. It can then immediately return 'not recovering' if the region being inquired about is less than this mark. Additionally, if the region of concern is greater than the mark, the function will limit the number of transmissions to userspace by assuming the region /is/ being recovered when skipping the transmission. This limits the amount of processing and updates the mark in 1/4 sec time steps. This patch fixes a problem where 'the mark' is not being updated because of faulty logic in the userspace log daemon. When '--nosync' is used to create a cluster mirror, the userspace log daemon never has a chance to update the mark in the normal way. The fix is to set the mark to "complete" if the mirror was created with the --nosync flag.
* Fix for bug 596453: multiple mirror image failures cause lvm repair...Jonathan Earl Brassow2010-08-171-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lvm repair issues I believe are the superficial symptoms of this bug - there are worse issues that are not as clearly seen. From my inline comments: * If the mirror was successfully recovered, we want to always * force every machine to write to all devices - otherwise, * corruption will occur. Here's how: * Node1 suffers a failure and marks a region out-of-sync * Node2 attempts a write, gets by is_remote_recovering, * and queries the sync status of the region - finding * it out-of-sync. * Node2 thinks the write should be a nosync write, but it * hasn't suffered the drive failure that Node1 has yet. * It then issues a generic_make_request directly to * the primary image only - which is exactly the device * that has suffered the failure. * Node2 suffers a lost write - which completely bypasses the * mirror layer because it had gone through generic_m_r. * The file system will likely explode at this point due to * I/O errors. If it wasn't the primary that failed, it is * easily possible in this case to issue writes to just one * of the remaining images - also leaving the mirror inconsistent. * * We let in_sync() return 1 in a cluster regardless of what is * in the bitmap once recovery has successfully completed on a * mirror. This ensures the mirroring code will continue to * attempt to write to all mirror images. The worst that can * happen for reads is that additional read attempts may be * taken.
* A misunderstanding of the return value of 'dm_bit' has been causing a dataJonathan Earl Brassow2010-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | corruption bug in cmirror. 'dm_bit' is only ever used as a boolean operation within LVM, but it can return a range of values. If the bit is set, a power of 2 is returned. If the bit is unset, 0 is returned. 'log_test_bit' (a function in the cluster mirror log daemon code) has switched to using the dm bit operations in rhel6. There are two places in the daemon code where 'log_test_bit' is not used merely as a boolean, but rather the return value is used as the return value for the log functions 'is_clean' and 'in_sync' - having assumed that 'dm_bit' was returning 0 or 1 only. One place the 'in_sync' function is utilized is in 'dm_rh_get_state' - a function that informs the mirroring code how to treat I/O and which devices to read/write from. 'dm_rh_get_state' was checking if the return value of 'in_sync' was 1 to determine if the region was DM_RH_CLEAN. Since 'dm_bit' (and by extension 'log_test_bit' and 'in_sync') was returning powers of 2, DM_RH_CLEAN was rarely being reported as it should have been. Thinking the region was out-of-sync, the mirroring code would write only to the primary device. When the primary device was failed, all of those writes were lost - leaving the entire mirror corrupted.
* Use __attribute__ consistently throughout.Alasdair Kergon2010-07-091-2/+2
|
* Add error checking for calls to sprintf - it can fail for moreJonathan Earl Brassow2010-06-211-15/+40
| | | | reasons than just 'out-of-space'.
* daemons/cmirrord/functions.c (part of cmirrord) was referencingJonathan Earl Brassow2010-06-181-1/+0
| | | | | | | | | | linux/kdev_t.h even though it wasn't needed. Strangely, it seems to be causing problems on various architectures (i686) in the function daemons/cmirrord/functions.c:disk_status_info()->sprintf. I'm not sure why this is a problem since none of the macros in kdev_t.h are used in that code, but it certainly doesn't hurt to pull an unnecessary header and it seems to fix the problem.
* missing headerAlasdair Kergon2010-01-221-0/+1
|
* Deal with a few more compiler warnings.Alasdair Kergon2010-01-201-1/+1
|
* Remove mknod() and add FIXMEs.Alasdair Kergon2010-01-191-6/+9
| | | | In the udev-world, this function should work differently.
* remove more compiler warningsAlasdair Kergon2010-01-191-16/+14
| | | | add FIXMEs for incomplete write()s
* Clean up include files.Alasdair Kergon2010-01-181-17/+6
|
* Fix some compiler warnings.Jonathan Earl Brassow2010-01-181-4/+6
|
* Misc compilation clean-ups.Alasdair Kergon2010-01-181-11/+11
|
* When moving the cluster log server into the LVM tree, the in memoryJonathan Earl Brassow2010-01-151-19/+36
| | | | | | | | | | | | | | bitmap tracking was switched from the e2fsprogs implementation to the device-mapper implementation (dm_bitset_t). The latter has a leading uin32_t field designed to hold the number of bits that are being tracked. The code was not properly handling this change in all places. Specifically, when getting the bitmap to/from disk. Endian adjustments will likely need to be made on the accounting field as well, since bitmaps are passed between machines on start-up. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* At some point "clustered_[core|disk]" was changed to "clustered-[core|disk]".Jonathan Earl Brassow2010-01-151-9/+9
| | | | | | This patch makes the log server recognise the new format. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* Add daemons/cmirrord files to git - somehow got messed up with cvs rename.Dave Wysochanski2009-09-041-0/+1863
When clogd was renamed to cmirrord, somehow git got the remove of the old files but not the add of the new files. This patch adds the new files. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>