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

105 Commits

Author SHA1 Message Date
Milan Broz
5c93cdba2d Fix PV datalign when for values starting prior to MDA area.
The dataalign value must always be aligned according
to MDA area.
The currect code checks if calculated value collides with
MDA area but not if the value is so small that it is
located before MDA starts.

Unfortunatelly there can be also MDA in the end of the device.

The patch adds simple check to avoid this miscalculation.
Patch expects that first MDA always starts on <= pagesize boundary
(this is true for all allowed label sector parameters).
2009-05-07 12:11:50 +00:00
Takahiro Yasui
1d13e51826 Fix error message when adding metadata directory to internal list fails.
Author: Takahiro Yasui <tyasui@redhat.com>
2009-03-23 21:13:37 +00:00
Milan Broz
c3b50730b8 vgname_from_mda now tries to parse for vgname even
if rlocn not defined (there is no metadata area).

In most cases it fails in validate_name(),
unfortunately there are situatuions, when
validate_name is ok and later code fails with
checksum error.

Reproducer:

# dd if=/dev/zero of=/dev/loop0

# pvcreate --metadatasize 637k /dev/loop0
  Physical volume "/dev/loop0" successfully created

# pvs /dev/loop0
  /dev/loop0: Checksum error
      PV         VG   Fmt  Attr PSize PFree
        /dev/loop0      lvm2 --   1.00M 1.00M

Signed-off-by: Milan Broz <mbroz@redhat.com>

-
2009-03-03 16:35:32 +00:00
Milan Broz
7b1c853bd9 Try to avoid full rescan if label scan is enough. 2009-02-25 23:29:06 +00:00
Alasdair Kergon
8929ce6651 Add --dataalignment to pvcreate to specify alignment of data area. (mbroz)
This patch is not fully tested and leaves some related bugs unfixed.

Intended behaviour of the code now:

  pe_start in the lvm2 format PV label header is set only by pvcreate (or
vgconvert -M2) and then preserved in *all* operations thereafter.

  In some specialist cases, after the PV is added to a VG, the pe_start
field in the VG metadata may hold a different value and if so, it
overrides the other one for as long as the PV is in such a VG.

  Currently, the field storing the size of the data area in the PV label
header always holds 0.  As it only has meaning in the context of a
volume group, it is calculated whenever the PV is added to a VG (and can
be derived from extent_size and pe_count in the VG metadata).
2009-02-22 19:00:26 +00:00
Dave Wysochanski
e9f57f2beb Add pv_mda_size to 'pvs' and vg_mda_size to 'vgs'.
Reports the size of the smallest metadata area in a PV or a VG.
Useful to confirm pvcreate --metadatasize or pvmetadatasize setting in
/etc/lvm/lvm.conf file.

NOTE: Actual value in these fields will most always differ from that
given in pvcreate options due to rounding and alignment effects.
2009-01-09 22:44:33 +00:00
Dave Wysochanski
d17a8e365d Make _init_rand() thread safe - use rand_r() instead of rand().
Use good entropy for seed value if possible.
2008-12-07 04:27:56 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Alasdair Kergon
08b959a50b Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE. (Edward Allcutt) 2008-10-17 00:55:46 +00:00
Alasdair Kergon
7eb1c3ed92 Free text metadata buffer after a failure writing it. 2008-09-30 20:37:52 +00:00
Alasdair Kergon
a77f5bf258 Pass struct physical_volume to pe_align. 2008-09-19 04:28:58 +00:00
Milan Broz
a4a1cd76ba Fix allocation bug in text metadata format write error path.
Function _text_pv_write doesn't use memory pool but static buffer,
call dm_pool_free in error path in _raw_write_mda_header is wrong.

Move pool free only to path where is the memory pool used.
2008-08-16 09:46:55 +00:00
Alasdair Kergon
131bc6f091 Avoid looping forever in _pv_analyze_mda_raw used by pvck. 2008-07-31 13:07:01 +00:00
Alasdair Kergon
29f7cbdabf Refactor _text_pv_read and always return mda list if requested. 2008-07-31 10:50:18 +00:00
Dave Wysochanski
d2edd6ac07 Add pvcreate sanity tests, check for label_write() failure in _text_pv_write().
Failure to check for label_write() return code caused the following test
to indicate it passed when it really failed:
pvcreate rejects labelsector > 1000000000000
2008-07-16 21:32:38 +00:00
Alasdair Kergon
7284f3f966 preparation for vg cache 2008-03-17 16:51:31 +00:00
Alasdair Kergon
bb097a97ea split orphan VG by format type 2008-02-06 15:47:28 +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
00a7c302ea Add pv_mda_free and vg_mda_free fields to reports for raw text format. 2007-11-05 17:17:55 +00:00
Bryn M. Reeves
8b98c12815 Add is_orphan_vg() and change all hardcoded checks to use it. 2007-11-02 13:06:42 +00:00
Dave Wysochanski
1b8de4cb25 Add pv_dev_name() to access PV device name.
Patch by Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
2007-10-12 14:29:32 +00:00
Alasdair Kergon
21bc366486 Clean up numerous compiler warnings that crept in recently.
Remove several unused parameters from _allocate().
2007-08-22 14:38:18 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Jim Meyering
e5e120a502 For consistency, rename local variable: s/newname/new_name/g. 2007-08-06 14:57:48 +00:00
Jim Meyering
941e4f5567 Remove create_dir function; use now-equivalent dm_create_dir instead.
* lib/misc/lvm-file.c (_create_dir_recursive, create_dir): Remove functions.
* lib/misc/lvm-file.h (create_dir): Remove declaration.
* lib/commands/toolcontext.c (create_toolcontext): s/create_dir/dm_create_dir/
* lib/format_text/archiver.c (archive, backup): Likewise.
* lib/format_text/format-text.c (_add_dir): Likewise.
* lib/locking/file_locking.c (init_file_locking): Likewise.
Patch by Jun'ichi Nomura.
2007-07-28 12:26:21 +00:00
Jim Meyering
1a5d6bd23d Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose
* lib/misc/lvm-file.c (lvm_fclose): New function.
* lib/misc/lvm-file.h (lvm_fclose): Declare it.
* lib/config/config.c (write_config_file): Use the new function to detect
and diagnose unlikely write failure.
* lib/filters/filter-persistent.c (persistent_filter_dump): Likewise.
* lib/format_text/archive.c (archive_vg): Likewise.
* lib/format_text/format-text.c (_vg_write_file): Likewise.
* lib/log/log.c (fin_log): Similar, but use dm_fclose directly.
Include "\n" at end of each fprintf format string.
2007-07-24 17:48:08 +00:00
Dave Wysochanski
13835b5f6c Don't use index and rindex functions marked by SUSv3 as legacy - Jakub Bogusz <qboosh@pld-linux.org> 2007-07-02 11:17:21 +00:00
Petr Rockai
e7ddf4168d Make warnings go to stderr. Change log_warn to that effect, log_print
continues to send messages to stdout.
2007-06-28 17:33:44 +00:00
Dave Wysochanski
28d1c4d7e2 Update pvck to include text metadata area and record detection.
--
2007-04-25 21:10:55 +00:00
Dave Wysochanski
17a6fc0b45 Add 'scan_sector' parameter to label_read and _find_labeller to add
flexibility in searching for disk labels.
2007-04-23 18:21:01 +00:00
Milan Broz
851002b87d Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata).
Split metadata areas in vgsplit properly.
2007-03-23 12:43:17 +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
e62436fc70 Free memory in _raw_read_mda_header() error paths.
Fix ambiguous vgsplit error message for split LV.
Fix lvextend man page typo.
2007-01-09 21:12:41 +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
a89d601463 Add some missing bounds checks on 32 bit extent counters.
Add Petabyte and Exabyte support.
Fix lvcreate error message when 0 extents requested.
2006-11-10 18:24:11 +00:00
Alasdair Kergon
ab507e894c More work towards pv->size always holding the same value in internal metadata.
Store it in external text metadata as dev_size, and estimate it if not
present when metadata is read back in.
2006-10-07 23:17:17 +00:00
Alasdair Kergon
209f03f2b6 Fix format_text mda_setup pv->size and pv_setup pe_count calculations.
(This area of the code needs a lot more work.)
2006-10-05 22:02:52 +00:00
Alasdair Kergon
0550c1b618 Move lvm_snprintf into libdevmapper. 2006-08-21 12:54:53 +00:00
Alasdair Kergon
94d501edd9 Fix PE_ALIGN for pagesize over 32KB. 2006-08-17 19:53:36 +00:00
Alasdair Kergon
b5d761e1d2 wrap PE_ALIGN 2006-08-17 19:30:59 +00:00
Alasdair Kergon
916490f8bf Add lvm_getpagesize wrapper. 2006-08-17 18:23:44 +00:00
Alasdair Kergon
2293567c8c Fix lvcreate corelog validation.
Add --config for overriding most config file settings from cmdline.
  Quote arguments when printing command line.
  Remove linefeed from 'initialising logging' message.
  Add 'Completed' debug message.
  Don't attempt library exit after reloading config files.
  Always compile with libdevmapper, even if device-mapper is disabled.
2006-05-16 16:48:31 +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
72b2cb613a Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity.
Use C99 struct initialisers.
Move DEFS into configure.h.
Clean-ups to remove miscellaneous compiler warnings.
2006-05-09 21:23:51 +00:00
Alasdair Kergon
12de747d3a Improve stripe size validation.
Increase maximum stripe size limit to physical extent size for lvm2 metadata.
2006-04-29 22:08:43 +00:00
Alasdair Kergon
16959f2f01 terminate vgid in debug mesg 2006-04-21 15:37:08 +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