mirror of https://github.com/hak5/openwrt-owl.git
block-mount: Fixed mount deadlocks due to buggy use of locks in /lib/functions/block.sh
SVN-Revision: 21987owl
parent
67416b62d7
commit
e56dcdcffd
|
@ -118,15 +118,18 @@ config_create_swap_fstab_entry() {
|
||||||
|
|
||||||
[ -n "$device" ] || return 0
|
[ -n "$device" ] || return 0
|
||||||
|
|
||||||
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
local fstabnew
|
||||||
|
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
lock /var/lock/fstab.lck
|
lock -w /var/lock/fstab.lck && {
|
||||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
lock /var/lock/fstab.lck
|
||||||
[ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
|
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||||
cat "$fstabnew" >/tmp/fstab
|
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
||||||
lock -u /var/lock/fstab.lck
|
[ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
|
||||||
rm -f $fstabnew
|
cat "$fstabnew" >/tmp/fstab
|
||||||
|
rm -f $fstabnew
|
||||||
|
lock -u /var/lock/fstab.lck
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_create_mount_fstab_entry() {
|
config_create_mount_fstab_entry() {
|
||||||
|
@ -140,15 +143,18 @@ config_create_mount_fstab_entry() {
|
||||||
[ -n "$target" ] || return 0
|
[ -n "$target" ] || return 0
|
||||||
[ -n "$device" ] || return 0
|
[ -n "$device" ] || return 0
|
||||||
|
|
||||||
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
local fstabnew
|
||||||
|
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
lock /var/lock/fstab.lck
|
lock -w /var/lock/fstab.lck && {
|
||||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
lock /var/lock/fstab.lck
|
||||||
echo "$device $target $fstype $options 0 0" >>"$fstabnew"
|
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||||
cat "$fstabnew" >/tmp/fstab
|
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
||||||
lock -u /var/lock/fstab.lck
|
echo "$device $target $fstype $options 0 0" >>"$fstabnew"
|
||||||
rm -f $fstabnew
|
cat "$fstabnew" >/tmp/fstab
|
||||||
|
rm -f $fstabnew
|
||||||
|
lock -u /var/lock/fstab.lck
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libmount_find_token() {
|
libmount_find_token() {
|
||||||
|
|
Loading…
Reference in New Issue