Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 268999 - sys-fs/lvm2: LVM locking_dir created on root filesystem instead of designated loocation
Summary: sys-fs/lvm2: LVM locking_dir created on root filesystem instead of designated...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
: 278825 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-08 06:02 UTC by Juan Francisco Giordana
Modified: 2009-07-31 04:55 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
lvm2-2.02.49-lockdir-override.patch (lvm2-2.02.49-lockdir-override.patch,15.37 KB, patch)
2009-07-24 03:34 UTC, Robin Johnson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Juan Francisco Giordana 2009-05-08 06:02:22 UTC
According to /etc/lvm/lvm.conf

locking_dir = "/var/lock/lvm"

but if /var is on a separate partition, then the lock directory is created on the root filesystem before /var being mounted.

Reproducible: Always

Steps to Reproduce:
1. Set 'locking_dir = "/dedicated/disk/partition/lock/lvm"' in /etc/lvm/lvm.conf
2. `reboot`
3. `init 1`
4. `mount /dedicated/disk/partition/`
5. `ls -l /dedicated/disk/partition/lock/lvm`
6. `umount /dedicated/disk/partition/`
5. `ls -l /dedicated/disk/partition/lock/lvm`

Actual Results:  
/dedicated/disk/partition/lock/lvm is created in the partition where the root filesystem resides

Expected Results:  
/dedicated/disk/partition/lock/lvm should be created in the specified partition.

sys-fs/lvm2-2.02.45  USE="readline static (-clvm) (-cman) -lvm1 (-selinux)" 723 kB

Tested on x86 and x86_64
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-05-08 20:59:46 UTC
agk: Can we maybe exclude an explicit locking dir commandline option for use during early boot when /var is not yet available?
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-07-22 01:12:15 UTC
agk: re-ping

Can we maybe exclude an explicit locking dir commandline option for use
during early boot when /var is not yet available?
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-07-24 03:31:24 UTC
*** Bug 278825 has been marked as a duplicate of this bug. ***
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-07-24 03:33:43 UTC
As of the .49 version, the locking directory issue causes some boot failures.
I'm attaching a potential prototype patch that implements the command-line option "--lock-dir DIR" that can be used to override what directory the lock is actually created in.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-07-24 03:34:15 UTC
Created attachment 198956 [details, diff]
lvm2-2.02.49-lockdir-override.patch

Prototype patch, implements --lock-dir option. Does NOT update the documentation for the new option.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-07-24 23:38:11 UTC
2.02.49-r1 now includes the lock-dir patch, and also updates the lvm2-{stop,start}.sh scripts to use it. It boots my machine fine, and i've got one other report of success. Testing wanted.
Comment 7 Marc Schiffbauer gentoo-dev 2009-07-25 06:15:58 UTC
works for me now, thanks!
Comment 8 Xake 2009-07-31 04:45:52 UTC
This patch makes lv* segfault if you compile it with -fstack-protector-all (not -fstack-protector) using gcc-4.

#0  strncpy (s1=0x7f32af05d1df "", s2=0xa4e <Address 0xa4e out of bounds>, n=128) at strncpy.c:41
	n4 = 32
	c = 19 '\023'
#1  0x00007f32aee2712b in init_file_locking (locking=<value optimized out>, cmd=0x7f32af05d1e0, lock_dir=0xa4e <Address 0xa4e out of bounds>) at /usr/include/bits/string3.h:122
No locals.
#2  0x00007f32aedfe721 in init_locking (type=<value optimized out>, cmd=0x7f32afa23fe0, lock_dir=0xa4e <Address 0xa4e out of bounds>) at locking/locking.c:271
No locals.
#3  0x00007f32aedc6888 in lvm_run_command (cmd=0x7f32afa23fe0, argc=0, argv=0x7ffffda18fe0) at lvmcmdline.c:1024
	ret = <value optimized out>
	locking_type = -1
	lock_dir = 0xa4e <Address 0xa4e out of bounds>
#4  0x00007f32aedc8f66 in lvm2_main (argc=<value optimized out>, argv=<value optimized out>) at lvmcmdline.c:1367
	base = <value optimized out>
	ret = -1
	alias = 1
	cmd = (struct cmd_context *) 0x7f32afa23fe0
#5  0x00007f32addc9a0d in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, 
    stack_end=0x7ffffda18fc8) at libc-start.c:228
	result = <value optimized out>
	unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 9159246245105922012, 139855658735024, 140737448611792, 0, 0, -9159241175404744740, -9117125852146012196}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7f32aeb9b6fe, 0x0}, 
    data = {prev = 0x0, cleanup = 0x0, canceltype = -1363560706}}}
	not_first_call = <value optimized out>
#6  0x00007f32aedbd5d9 in _start () from /sbin/lvs
No symbol table info available.
Comment 9 Xake 2009-07-31 04:55:49 UTC
Forgot to mention this only occurs if I do not set --lock-dir.

$ sudo /sbin/lvs
Segmenteringsfel
$ sudo /sbin/lvs --lock-dir /tmp
  LV        VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  distfiles System -wi-ao   5,00G                                      
  home      System -wi-ao 600,00G                                      
  opt       System -wi-ao   3,00G                                      
  portage   System -wi-ao   1,00G                                      
  root      System -wi-ao   4,00G                                      
  swap      System -wi-ao   2,00G                                      
  usr       System -wi-ao  15,00G                                      
  var       System -wi-ao   5,00G                                      
  var-tmp   System -wi-ao  20,00G