block-mount: remove explicit lock waits, solves some potential race conditions
SVN-Revision: 27226
This commit is contained in:
parent
e6af77a1c8
commit
a434ed2fc6
3 changed files with 21 additions and 27 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=block-mount
|
PKG_NAME:=block-mount
|
||||||
PKG_VERSION:=0.2.0
|
PKG_VERSION:=0.2.0
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,6 @@ config_create_swap_fstab_entry() {
|
||||||
local fstabnew
|
local fstabnew
|
||||||
|
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
lock -w /var/lock/fstab.lck && {
|
|
||||||
lock /var/lock/fstab.lck
|
lock /var/lock/fstab.lck
|
||||||
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
||||||
|
@ -129,7 +128,6 @@ config_create_swap_fstab_entry() {
|
||||||
cat "$fstabnew" >/tmp/fstab
|
cat "$fstabnew" >/tmp/fstab
|
||||||
rm -f $fstabnew
|
rm -f $fstabnew
|
||||||
lock -u /var/lock/fstab.lck
|
lock -u /var/lock/fstab.lck
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config_create_mount_fstab_entry() {
|
config_create_mount_fstab_entry() {
|
||||||
|
@ -146,7 +144,6 @@ config_create_mount_fstab_entry() {
|
||||||
local fstabnew
|
local fstabnew
|
||||||
|
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
lock -w /var/lock/fstab.lck && {
|
|
||||||
lock /var/lock/fstab.lck
|
lock /var/lock/fstab.lck
|
||||||
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
||||||
|
@ -154,7 +151,6 @@ config_create_mount_fstab_entry() {
|
||||||
cat "$fstabnew" >/tmp/fstab
|
cat "$fstabnew" >/tmp/fstab
|
||||||
rm -f $fstabnew
|
rm -f $fstabnew
|
||||||
lock -u /var/lock/fstab.lck
|
lock -u /var/lock/fstab.lck
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
libmount_find_token() {
|
libmount_find_token() {
|
||||||
|
|
|
@ -66,13 +66,11 @@ start() {
|
||||||
|
|
||||||
config_load fstab
|
config_load fstab
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
lock -w /var/lock/fstab.lck && {
|
|
||||||
lock /var/lock/fstab.lck
|
lock /var/lock/fstab.lck
|
||||||
[ -e /tmp/fstab ] || {
|
[ -e /tmp/fstab ] || {
|
||||||
echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
|
echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
|
||||||
}
|
}
|
||||||
lock -u /var/lock/fstab.lck
|
lock -u /var/lock/fstab.lck
|
||||||
}
|
|
||||||
config_foreach do_swapon swap
|
config_foreach do_swapon swap
|
||||||
config_foreach do_mount mount
|
config_foreach do_mount mount
|
||||||
config_foreach do_swapon swap # do swap a second time so that swap on filesystems is enabled
|
config_foreach do_swapon swap # do swap a second time so that swap on filesystems is enabled
|
||||||
|
|
Loading…
Reference in a new issue