summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/dmthin8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/dmthin b/common/dmthin
index 3b1c7d45..91147e47 100644
--- a/common/dmthin
+++ b/common/dmthin
@@ -113,8 +113,12 @@ _dmthin_init()
_dmsetup_create $DMTHIN_DATA_NAME --table "$DMTHIN_DATA_TABLE" || \
_fatal "failed to create dm thin data device"
- # Zap the pool metadata dev
- dd if=/dev/zero of=$DMTHIN_META_DEV bs=4096 count=1 &>/dev/null
+ # Zap the pool metadata dev. Explicitly fsync the zeroes to disk
+ # because a slow-running udev running concurrently with dd can maintain
+ # an open file descriptor. The block layer only flushes the page cache
+ # on last close, which means that the thin pool creation below will
+ # see the (stale) ondisk contents and fail.
+ dd if=/dev/zero of=$DMTHIN_META_DEV bs=4096 count=1 conv=fsync &>/dev/null
# Thin pool
# "start length thin-pool metadata_dev data_dev data_block_size low_water_mark"