Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 689292 - sys-fs/lvm2: lvm runscript: change "need lvmetad lvmlockd" to "use lvmetad lvmlockd"
Summary: sys-fs/lvm2: lvm runscript: change "need lvmetad lvmlockd" to "use lvmetad lv...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-04 23:48 UTC by Thomas Deutschmann
Modified: 2019-07-04 23:48 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann gentoo-dev Security 2019-07-04 23:48:46 UTC
Dear maintainer,

can we please use "use" instead of "need" in lvm runscript for lvmetad and lvmlockd? I am proposing the following change:

> --- lvm.rc-2.02.184-r3	2019-05-09 21:40:59.624155893 +0200
> +++ lvm.rc-2.02.184-r4	2019-07-05 01:41:45.154816338 +0200
> @@ -10,14 +10,14 @@
>  	echo "${lvm_path}"
>  }
>  
> -_need_lvmetad()
> +_use_lvmetad()
>  {
>  	local lvm_path="$(_get_lvm_path)"
>  	[ ! -x "${lvm_path}" ] && return 1
>  	${lvm_path} dumpconfig global 2>/dev/null | grep -q 'use_lvmetad=1'
>  }
>  
> -_need_lvmlockd()
> +_use_lvmlockd()
>  {
>  	local lvm_path="$(_get_lvm_path)"
>  	[ ! -x "${lvm_path}" ] && return 1
> @@ -32,20 +32,23 @@
>  	# more common case, if its disabled in the config we aren't dependent
>  	# on it.
>  	config /etc/lvm/lvm.conf
> -	local _need=
> +	local _use=
>  	if service_started; then
> -		_need=$(service_get_value need)
> +		_use=$(service_get_value use)
>  	else
> -		if _need_lvmetad; then
> -			_need="${_need} lvmetad"
> +		if _use_lvmetad; then
> +			_use="${_use} lvmetad"
>  		fi
> -		if _need_lvmlockd; then
> -			_need="${_need} lvmlockd"
> +		if _use_lvmlockd; then
> +			_use="${_use} lvmlockd"
>  		fi
>  	fi
>  	# Make sure you review /etc/conf.d/lvm as well!
>  	# Depending on your system, it might also introduce udev & mdraid
> -	need sysfs ${_need}
> +	need sysfs
> +	if [ -n "${_use}" ]; then
> +		use ${_use}
> +	fi
>  }
>  
>  config='global { locking_dir = "/run/lock/lvm" }'
> @@ -88,7 +91,7 @@
>  			lvm_commands="${lvm_commands}vgscan --config '${config}' --mknodes\n"
>  			# And turn them on!
>  			lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ly\n"
> -			if _need_lvmlockd; then
> +			if _use_lvmlockd; then
>  				# Start lockd VGs as required
>  				lvm_commands="${lvm_commands}vgchange --config '${config}' --lock-start --lock-opt auto\n"
>  			fi
> @@ -101,9 +104,9 @@
>  
>  start_post()
>  {
> -	# Save if we needed lvmetad
> -	if _need_lvmetad; then
> -		service_set_value need lvmetad
> +	# Save if we used lvmetad
> +	if _use_lvmetad; then
> +		service_set_value use lvmetad
>  	fi
>  }
>  

Reason:

- "use" will do the same like "need", i.e. it will make sure that lvmetad/lvmlockd will get started before lvm.

- However, when restarting lvmetad/lvmlockd, i.e. after upgrading lvm2 package, we won't longer try to stop lvm service (keep in mind that lvm service is not a real daemon...) which will always fail if LVM volumes are still in use.