1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
Commit Graph

234 Commits

Author SHA1 Message Date
Mike Snitzer
6111e048a3 Cast MAJOR() and MINOR() to int when used with "%d" in dm_snprintf() call.
Fixes SEGV in _md_sysfs_attribute_snprintf() on 32-bit systems.
2009-07-20 18:33:16 +00:00
Alasdair Kergon
b8f47d5f69 Use log_error macro consistently throughout in place of log_err. 2009-07-15 20:02:46 +00:00
Mike Snitzer
f1c90ec108 Check MD devices for a partition table during device scan. 2009-07-09 22:50:45 +00:00
Mike Snitzer
bb6a3a9608 Use the MD device's stripe-width, instead of chunk_size, to align the
data blocks of a Physical Volume that is placed directly upon an MD
device.
2009-07-06 19:04:24 +00:00
Milan Broz
d396100278 Use readahead of underlying device and not default (smaller) one.
When we are stacking LV over device, which has for some reason
increased read_ahead (e.g. MD RAID), the read_ahead hint
for libdevmapper is wrong (it is zero).

If the calculated read_ahead hint is zero, patch uses read_ahead of underlying device
(if first segment is PV) when setting DM_READ_AHEAD_MINIMUM_FLAG.

Because we are using dev-cache, it also store this value to cache for future use
(if several LVs are over one PV, BLKRAGET is called only once for underlying device.)

This should fix all the reamining problems with readahead mismatch reported
for DM over MD configurations (and similar cases).
2009-05-20 11:09:49 +00:00
Petr Rockai
1b2e147cc8 Missed file from previous checkin. 2009-03-17 14:40:00 +00:00
Petr Rockai
3402ccd488 Detect and wipe swap signatures in pvcreate. 2009-03-17 13:59:56 +00:00
Alasdair Kergon
219b480da1 Display a 'dev_size' of zero for missing devices in reports. 2009-01-10 02:43:51 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Alasdair Kergon
9c4bf5db4a Fix conversion of md chunk size into sectors. 2008-10-03 14:22:18 +00:00
Alasdair Kergon
87ec948433 . 2008-09-19 07:18:03 +00:00
Alasdair Kergon
3c2086efdd adjust pe_align for md chunk size 2008-09-19 05:19:09 +00:00
Dave Wysochanski
f2d0cc63fd Remove dead code, is_lvm_partition() - no functional change.
This code does nothing.  The function is #defined to 1 which ensures the only
two if statements referencing it will never be true.
2008-07-23 19:46:33 +00:00
Dave Wysochanski
274788b4a5 Suppress invalid 'sb_offset' compiler warning (FC8) with uninitialized_var().
device/dev-md.c:61: warning: ‘sb_offset’ may be used uninitialized in this function
2008-06-23 19:26:21 +00:00
Dave Wysochanski
626dd7a5fe Suppress 'sb_offset' compiler warning by using enum for md superblock versions.
The warning is bogus and is only seen on certain versions of gcc.
However using the enum does seem to clarify the intent of the code - only
3 possible md minor superblock versions.

Related compiler warning:
device/dev-md.c:53: warning: 'sb_offset' may be used uninitialized in this function
2008-06-23 14:54:50 +00:00
Alasdair Kergon
bdce11cb30 Avoid spurious duplicate VG messages referring to VGs that are gone.
(untested)
2008-05-28 22:27:47 +00:00
Alasdair Kergon
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
Alasdair Kergon
c51b9fff19 Use stack return macros throughout. 2008-01-30 13:19:47 +00:00
Alasdair Kergon
962b2a559d Rely upon internally-cached PV labels while corresponding VG lock is held. 2008-01-29 23:45:48 +00:00
Alasdair Kergon
e1d586d70e explanation of md superblock location & avoid compilation warnings 2007-10-24 11:24:24 +00:00
Alasdair Kergon
47c06763b7 Detect md superblocks version 1.0, 1.1 and 1.2. 2007-10-24 00:51:05 +00:00
Alasdair Kergon
951e1064c9 refactor dev-md.c, separating out the magic number detection 2007-10-24 00:30:30 +00:00
Jim Meyering
b45b846449 Include strerror string in dev_open_flags' stat failure message.
* lib/device/dev-io.c (dev_open_flags):
Use log_sys_error after failed stat to report strerror(errno).
Use a slightly different diagnostic to report mismatched device number.
2007-09-07 11:24:19 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Milan Broz
8a0de6c333 Fix loading of persistent cache if cache_dir is used. (2.02.23)
Move lstat warning in _compare_paths to verbose output only.
2007-07-23 10:45:49 +00:00
Alasdair Kergon
e6edd1d7af Move regex functions into libdevmapper. 2007-04-27 18:52:05 +00:00
Alasdair Kergon
30b95041de add preferred_names to man page. 2007-04-26 17:14:57 +00:00
Alasdair Kergon
4f2f566b06 Add devices/preferred_names config regex list for displayed device names.
Free a temporary dir string in fcntl_lock_file() after use.
Fix a dm_pool_destroy() in matcher_create().
Introduce goto_bad macro.
2007-04-26 16:44:59 +00:00
Dave Wysochanski
662e0238f0 Add dev_read_circular, read 2 regions on same device. 2007-04-19 02:10:42 +00:00
Alasdair Kergon
fce67134f3 Fix md signature check to handle both endiannesses. 2007-01-26 17:15:16 +00:00
Alasdair Kergon
2e1b92e3ea Add some missing close() and fclose() return code checks.
Fix exit statuses of reporting tools (2.02.19).
2007-01-25 14:37:48 +00:00
Alasdair Kergon
b1ab8b00b8 Fix partition table processing after sparc changes (introduced in 2.02.16).
Fix cmdline PE range processing segfault (introduced in 2.02.13).
2007-01-15 21:55:11 +00:00
Alasdair Kergon
4dc0ec2253 Adjust some alignments for ia64 and sparc.
(Some of the changes are probably unnecessary.)
2006-11-30 23:11:42 +00:00
Alasdair Kergon
916490f8bf Add lvm_getpagesize wrapper. 2006-08-17 18:23:44 +00:00
Alasdair Kergon
e3ad1d19d5 Add --trustcache option to reporting commands in preparation for supporting
event-driven model.  Without changes to the way the cache gets updated, the
option is currently unreliable without a global lock to prevent any lvm2
commands from running concurrently.
2006-08-01 14:56:33 +00:00
Alasdair Kergon
5c9d70c955 Create a log header for replacement in-sync mirror log.
Use set_lv() and dev_set() to wipe sections of devices.
Add mirror_in_sync() flag to avoid unnecessary resync on activation.
2006-05-11 18:39:24 +00:00
Alasdair Kergon
898e6f8e41 Add mirror_library description to example.conf.
More compile-time cleanup.
2006-05-11 17:58:58 +00:00
Alasdair Kergon
8a2fc58645 Check for libsepol.
Add some cflow & scope support.
Separate out DEFS from CFLAGS.
Remove inlines and use unique function names.
2006-04-19 15:33:07 +00:00
Alasdair Kergon
349216a6b5 Fix open RO->RW promotions. 2005-11-23 16:07:40 +00:00
Alasdair Kergon
b7c18fecfd Only keep devices open if known to belong to a locked VG now. 2005-10-27 17:44:55 +00:00
Alasdair Kergon
2262b32057 Use hash, bitset, malloc, pool from libdevmapper. 2005-10-16 23:03:59 +00:00
Alasdair Kergon
9b02bdbce0 Refuse to run pvcreate/pvremove on devices we can't open exclusively. 2005-10-03 21:10:41 +00:00
Alasdair Kergon
5e947dac48 Various allocation-related pvmove fixes. 2005-06-14 17:54:48 +00:00
Alasdair Kergon
60f13f01d2 Basic support for mirrors. 2005-06-01 16:51:55 +00:00
Alasdair Kergon
c708ec79b1 Fix loopfiles mem alloc. 2005-05-09 17:02:52 +00:00
Alasdair Kergon
abe198c0e8 Don't create backup and archive dirs till needed. 2005-05-03 17:31:56 +00:00
Alasdair Kergon
15db9fcfbf Reinstate full PV size when removing from VG.
Support loopfiles for testing.
Complete the pv_segment support.
2005-05-03 17:28:23 +00:00
Alasdair Kergon
0c86ac44a9 fix unused o_direct label 2005-04-07 12:25:33 +00:00
Alasdair Kergon
864de9cee1 Allow offline extension of snapshot volumes.
NB Requires kernel patch that is not upstream.
2005-04-07 12:17:46 +00:00
Alasdair Kergon
1165258cda Alignment tidying. 2005-04-06 13:47:41 +00:00
Alasdair Kergon
e5b836d2d6 Improve detection of external changes affecting internal cache. 2005-03-21 22:40:35 +00:00
Alasdair Kergon
162d85b97b Add 'already in device cache' debug message. 2005-03-21 14:51:49 +00:00
Alasdair Kergon
b9565b406a Cope with new devices appearing by rescanning /dev if a uuid can't be found. 2005-03-08 13:46:17 +00:00
Alasdair Kergon
aa70fe8b71 Suppress 'open failed' error messages during scanning. 2005-03-03 21:54:35 +00:00
Alasdair Kergon
165f49ba1d Fix device reference counting on re-opens. 2004-12-21 20:23:16 +00:00
Alasdair Kergon
d46fd67fb6 Skip devices that are too small to be PVs. 2004-12-21 17:54:52 +00:00
Alasdair Kergon
9ec484617a Cope with empty msdos partition tables. 2004-12-21 16:10:25 +00:00
Alasdair Kergon
5e94864311 Reopen RO file descriptor RW if necessary. 2004-12-12 21:47:14 +00:00
Alasdair Kergon
09a7dce6be Additional device-handling debug messages.
Additional verbosity level -vvvv includes line numbers and backtraces.
Verbose messages now go to stderr not stdout.
Close any stray file descriptors before starting.
Refine partitionable checks for certain device types.
Allow devices/types to override built-ins.
2004-12-10 16:01:35 +00:00
Alasdair Kergon
39de4a2a56 Extend dev_open logging. 2004-12-09 16:56:51 +00:00
Alasdair Kergon
66f0408473 xlate compilation fix 2004-11-27 22:07:41 +00:00
Alasdair Kergon
bbdab3fc9e Endian fix to signature detection. 2004-11-27 21:37:54 +00:00
Alasdair Kergon
57b8df3e45 fix partition table signature size 2004-11-26 14:40:34 +00:00
Alasdair Kergon
2e6051674b Fix to partition table detection code. 2004-11-24 20:38:05 +00:00
Alasdair Kergon
bd46a496c7 pool debugging 2004-11-23 18:23:23 +00:00
Alasdair Kergon
985ef4617f Detect partition table signature. 2004-11-23 11:44:04 +00:00
Alasdair Kergon
b2dd0bb1d0 Separate out md superblock detection code. 2004-11-18 20:02:21 +00:00
Alasdair Kergon
60bd717971 Use O_NOATIME on devices if available. 2004-09-14 22:23:23 +00:00
Alasdair Kergon
1c31f23f56 Add a const. 2004-08-11 13:15:35 +00:00
Alasdair Kergon
96185e9ca1 Use 64-bit file functions. 2004-04-16 18:43:29 +00:00
Alasdair Kergon
6606c3ae81 Update copyright notices. 2004-03-30 19:35:44 +00:00
Alasdair Kergon
08c419da66 Don't recurse symlinked dirs such as /dev/fd on 2.6. 2004-02-13 18:55:43 +00:00
Alasdair Kergon
82c86650e1 Define BLKGETSIZE64 on systems with out-of-date header files. 2004-01-27 20:53:57 +00:00
Alasdair Kergon
e19f549a11 Fix support for PVs on read only devices. [Still must set LVs read only] 2003-11-21 19:54:40 +00:00
Alasdair Kergon
ee8518bd9c lvcreate should close the initialised snapshot device immediately. 2003-11-14 17:55:39 +00:00
Alasdair Kergon
27642fade0 Fix dev_zero() offset. 2003-11-13 23:55:03 +00:00
Alasdair Kergon
2dc95e1c41 Configuration-time O_DIRECT setting. 2003-11-06 17:14:06 +00:00
Alasdair Kergon
914c97239f Another sync point - numerous fixes & clean ups. 2003-07-04 22:34:56 +00:00
Alasdair Kergon
4b7af6da11 Add comment 2003-04-30 15:21:10 +00:00
Alasdair Kergon
fe451a01e8 Try alternative syncs if BLKFLSBUF fails. 2003-04-28 16:20:39 +00:00
Alasdair Kergon
b896caa19b Improve build robustness. 2003-04-15 13:24:42 +00:00
Alasdair Kergon
26e7f2e0c4 Tidy various pre-processing incl. making libdl optional. 2003-03-24 18:08:53 +00:00
Alasdair Kergon
4970ebfb92 o Additional device/filter-level debugging messages + duplicate alias fix
o 32/64-bit size_t fix (pjc)
2003-01-08 16:41:22 +00:00
Alasdair Kergon
4aae68792c When there are device name aliases, choose the "nicest" to display. 2003-01-03 21:11:23 +00:00
Alasdair Kergon
8ef2b021ed Default stripesize 64k & config file setting for it;
Clear many compiler warnings (i386) & associated bugs - hopefully without
introducing too many new bugs:-)  (Same exercise required for other archs.)
Default compilation has optimisation - or else use ./configure --enable-debug
2002-12-19 23:25:55 +00:00
Alasdair Kergon
d1d9800ef1 Refactoring. 2002-11-18 14:01:16 +00:00
Patrick Caulfield
da253e3aac Remove O_DIRECT as it causes problems with some systems.
Harumph.
2002-08-14 14:58:00 +00:00
Patrick Caulfield
6b3b4a250b Use O_DIRECT for writing to devices.
Doesn't work on HPPA due to a kernel bug but other archs shuld be OK.
2002-07-22 08:10:54 +00:00
Patrick Caulfield
b40b90f035 Flush on open as well as close. 2002-06-25 14:02:28 +00:00
Alasdair Kergon
6b4c9ff740 Some partial VG support with format_text. 2002-04-30 17:12:37 +00:00
Alasdair Kergon
25b733809a Merge with text format branch.
Lots of changes/very little testing so far => there'll be bugs!

Use 'vgcreate -M text' to create a volume group with its metadata stored
in text files.  Text format metadata changes should be reasonably atomic,
with a (basic) automatic recovery mechanism if the system crashes while a
change is in progress.

Add a metadata section to lvm.conf to specify multiple directories if
you want (recommended) to keep multiple copies of the metadata (eg on
different filesystems).

e.g. metadata {
        dirs = ["/etc/lvm/metadata1","/usr/local/lvm/metadata2"]
}

Plenty of refinements still in the pipeline.
2002-04-24 18:20:51 +00:00
Joe Thornber
e3528bcda7 o Stop printing errors if flushing fails (could be an unconfigured device). 2002-04-24 08:37:34 +00:00
Joe Thornber
f31c47ade8 o Perform a BLKFLSBUF ioctl whenever a block device is closed.
Patrick, can you see if this fixes your cluster syncing problem please ?
If so I'll make it so it only syncs if you have actually written to the
device.
2002-04-08 18:59:50 +00:00
Joe Thornber
b00094bdeb o hash_iterate -> hash_iter 2002-02-25 11:54:15 +00:00
Alasdair Kergon
b849de1d18 Fix the device cache to cope reasonably safely with device name changes.
This should be a rare occurrence so the aim is to recover if it's
straightforward to do so, otherwise just to abort the operation.
If people *knowingly* change device names, they should always run vgscan
afterwards.

A few bytes of memory gets leaked inside a pool each time an alias
has to be discarded - it's not worth restructuring the code to reuse it.

More of LVM2 needs updating to pass device objects (or uuids) about
instead of pathnames so that resolution of pathname->object only happens
once per operation.

dev_cache_get() should now always return the *current* device at the path given

dev_name_confirmed() replaces dev_name() whenever it's important to
know that name for the device is still current (ie when opening it).
If the cache doesn't know a current name, the function fails.

dev_open() guarantees that the file descriptor returned is for the dev_t
of the device structure it was passed.
2002-01-24 23:16:19 +00:00
Alasdair Kergon
333658d5f8 Fix dev_close arg. 2002-01-24 13:31:18 +00:00
Alasdair Kergon
610c25e8b1 o Remove redundant symlink-handling code.
o When opening device, return error if its cached name is incorrect (eg if
  it's changed since the cache was generated).  This prevents use until
  the cache is rebuilt (eg with vgscan).  Doesn't catch every case.
2002-01-23 18:55:01 +00:00
Alasdair Kergon
fae0c5764f Support --version argument and 'version' shell command. 2002-01-17 16:39:24 +00:00
Joe Thornber
5c83f05e81 o Knock out the "'%s' is not a block device" debug message. 2002-01-16 09:23:28 +00:00
Alasdair Kergon
deb8a3b7c9 Fix function typecasts. 2002-01-15 23:47:56 +00:00
Alasdair Kergon
288adea256 o missing labeller free
o updated vgcfgrestore args
o change _check_for_open_devices only to check devices present in the hash
  table instead of using dev_iter which triggers a full scan even when only
  displaying command line help
2002-01-15 21:28:04 +00:00
Joe Thornber
6036e5e0f7 o split the uuid -> device map out from vgcache
o  roll vgcache back to agk's implementation, we'll revisit this as part
   of the cluster integration.

o  change the extra_info field in a label to be a void *
2002-01-15 10:24:48 +00:00
Heinz Mauelshagen
3813dd120e Typos in error messages 2001-12-17 11:07:33 +00:00
Patrick Caulfield
52864eda2e Add a dev_get_sectsize call. 2001-12-11 10:18:49 +00:00
Alasdair Kergon
c2d72fd402 Add -t or --test arg to all tools that update metadata to avoid
committing metadata changes or (de)activating.
2001-11-28 18:03:11 +00:00
Alasdair Kergon
7f3859bb5c vgdisplay 2001-11-19 15:20:50 +00:00
Alasdair Kergon
d9bc7ffe61 lvrename (without reactivation) 2001-11-15 17:27:45 +00:00
Alasdair Kergon
5238b63f1a Miscellaneous tidying 2001-11-14 13:52:38 +00:00
Joe Thornber
29aa6d5850 o Added dev_open and dev_close functions
o  Changed disk-rep to use these

o  if NDEBUG is not defined the dev_cache will check for open devices on
   teardown.

I was hoping this would speed things up.  But I'm still getting:

reti:/home/joe/sistina/LVM2/tools# time ./lvm vgchange -a n
  Volume group vg0 successfully changed

real    0m5.751s
user    0m0.060s
sys     0m0.070s

even though I have only 1 device with the vg on it passing the filters.
2001-11-14 10:01:52 +00:00
Joe Thornber
78fc479a69 o Deal with sparse lv arrays (on disk)
o  new fn. dev_zero which zero's an area of a device
2001-11-13 18:52:52 +00:00
Alasdair Kergon
03a8a07d67 Merge lvreduce & lvextend into lvresize. 2001-11-13 14:17:50 +00:00
Joe Thornber
ac61645c2d o if any pattern rejects a device, and there were no accepts then reject ! 2001-11-12 17:06:33 +00:00
Joe Thornber
1b9fcf48b1 o LGPL list implementation 2001-10-31 12:47:01 +00:00
Joe Thornber
5e610278ad o rfilter now checks all aliases for a match 2001-10-25 14:19:39 +00:00
Joe Thornber
c7f0b573ac o use dev_name(dev) to get the name of a device, this operation is cheap
since it just get's the first alias.
2001-10-25 14:04:18 +00:00
Joe Thornber
890b537974 o added aliases list to struct device. 2001-10-25 11:34:55 +00:00
Alasdair Kergon
4790fce2ad persistent filter & some log message changes 2001-10-23 18:20:27 +00:00
Alasdair Kergon
20a2b71c9c filter integration into tools 2001-10-23 11:50:49 +00:00
Joe Thornber
7e38924de5 o forgot to retry on EINTR or EAGAIN, doh ! 2001-10-23 11:16:30 +00:00
Joe Thornber
291ec3b6c0 o Filter for the dev cache that takes values from config file:
devices {

        # first match is final, eg.  /dev/ide/cdrom
		        # get's rejected due to the first pattern

					filter=["r/cdrom/",         # don't touch the music !
							"a/hd[a-d][0-9]+/",
							"a/ide/",
							"a/sd/",
							"a/md/",
							"a|loop/[0-9]+|", # accept devfs style loop back
							"r/loop/",        # and reject old style
							"a/dasd/",
							"a/dac960/",
							"a/nbd/",
							"a/ida/",
							"a/cciss/",
							"a/ubd/",
							"r/.*/"] # reject all others
}


Alasdair this is ready to roll into the tools now.
2001-10-19 18:20:37 +00:00
Joe Thornber
72a5e12b5c o pvcreate
o added uuid unit

o stubbed partition stuff
2001-10-12 10:32:06 +00:00
Alasdair Kergon
2d9133bbbd standardise some log messages 2001-10-10 16:36:32 +00:00
Joe Thornber
0db56c6b55 o dev_write 2001-10-10 13:03:10 +00:00
Joe Thornber
f5f8443131 o read_vg works (or so it claims) 2001-10-08 16:08:16 +00:00
Joe Thornber
43b7b8cf69 o dev_cache_t program works 2001-10-08 13:58:52 +00:00
Joe Thornber
721128e86d o sync 2001-10-08 12:11:33 +00:00
Joe Thornber
e6efb2b0bd o got dbg_malloc_t working, Alasdair could you look at the Makefile.in it
seems to be having trouble with the dependencies.

o removed some files from the lib makefile that don't compile yet.
2001-10-04 10:13:07 +00:00
Alasdair Kergon
317919c7c6 vgrename & pvchange outlines 2001-10-03 17:03:25 +00:00
Joe Thornber
8696e06602 o I've moved the dev-cache and dev-io into here since this directory has a
better name.  dev-mgr will be removed at some point.
2001-10-03 12:41:29 +00:00
Alasdair Kergon
1f6db21f32 Another step towards consistency & compilation. 2001-10-01 22:12:10 +00:00
Joe Thornber
2f15b18f93 o get block size moved to dev-io.c 2001-10-01 16:07:29 +00:00
Alasdair Kergon
58f5fa84f3 merge partition code 2001-10-01 15:59:40 +00:00
Alasdair Kergon
b8ef655fb7 Tidy include files 2001-10-01 15:14:39 +00:00
Alasdair Kergon
269930c0da lvactivate checkpoint commit 2001-09-25 12:49:28 +00:00