diff options
author | Daniel Dickinson <crazycshore@gmail.com> | 2010-06-29 10:07:45 +0000 |
---|---|---|
committer | Daniel Dickinson <crazycshore@gmail.com> | 2010-06-29 10:07:45 +0000 |
commit | e56dcdcffd8636ea59512fde8fc5e62863af9d49 (patch) | |
tree | 79d6fa2e35a01881f511a482a2fc2d40b38ccfc1 /package/block-mount/files | |
parent | 67416b62d76feab3ffef4b09bd152c45a54072cc (diff) | |
download | upstream-e56dcdcffd8636ea59512fde8fc5e62863af9d49.tar.gz upstream-e56dcdcffd8636ea59512fde8fc5e62863af9d49.tar.bz2 upstream-e56dcdcffd8636ea59512fde8fc5e62863af9d49.zip |
block-mount: Fixed mount deadlocks due to buggy use of locks in /lib/functions/block.sh
SVN-Revision: 21987
Diffstat (limited to 'package/block-mount/files')
-rw-r--r-- | package/block-mount/files/block.sh | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/package/block-mount/files/block.sh b/package/block-mount/files/block.sh index b8a473a00f..72d6c3ab3c 100644 --- a/package/block-mount/files/block.sh +++ b/package/block-mount/files/block.sh @@ -118,15 +118,18 @@ config_create_swap_fstab_entry() { [ -n "$device" ] || return 0 - local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" + local fstabnew mkdir -p /var/lock - lock /var/lock/fstab.lck - cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew" - [ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew" - cat "$fstabnew" >/tmp/fstab - lock -u /var/lock/fstab.lck - rm -f $fstabnew + lock -w /var/lock/fstab.lck && { + lock /var/lock/fstab.lck + fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" + cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew" + [ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew" + cat "$fstabnew" >/tmp/fstab + rm -f $fstabnew + lock -u /var/lock/fstab.lck + } } config_create_mount_fstab_entry() { @@ -140,15 +143,18 @@ config_create_mount_fstab_entry() { [ -n "$target" ] || return 0 [ -n "$device" ] || return 0 - local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" + local fstabnew mkdir -p /var/lock - lock /var/lock/fstab.lck - cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew" - echo "$device $target $fstype $options 0 0" >>"$fstabnew" - cat "$fstabnew" >/tmp/fstab - lock -u /var/lock/fstab.lck - rm -f $fstabnew + lock -w /var/lock/fstab.lck && { + lock /var/lock/fstab.lck + fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" + cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew" + echo "$device $target $fstype $options 0 0" >>"$fstabnew" + cat "$fstabnew" >/tmp/fstab + rm -f $fstabnew + lock -u /var/lock/fstab.lck + } } libmount_find_token() { |