From 654a787074355ac8d7d4419511924c7d7bbc2722 Mon Sep 17 00:00:00 2001 From: illiliti Date: Mon, 10 May 2021 14:34:51 +0300 Subject: [PATCH] device-helper: update docs --- device-helper | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/device-helper b/device-helper index c506b30..993cdd2 100755 --- a/device-helper +++ b/device-helper @@ -14,6 +14,7 @@ create_symlink() ln -s "../../${dev_name}" "$sym" } +# DEVPATH is part of uevent which is exported to environment by device manager. [ -b "/dev/${dev_name=${DEVPATH##*/}}" ] || exit 1 exec > /dev/null 2>&1 @@ -25,7 +26,9 @@ read -r dm_name < "/sys/block/${dev_name}/dm/name" && { command -v blkid || exit 0 -# prevent race condition +# Race condition may occur if uevent arrives faster(isn't that a kernel bug!?) +# than the kernel initializes device. This prevents blkid to fetch data from +# device. To fix this, we simply waiting until blkid is succeeded. while ! blkid "/dev/${dev_name}"; do if [ "$((count += 1))" = 30 ]; then exit 1