Skip to content

Commit

Permalink
Merge pull request #1247 from gmelikov/zfs
Browse files Browse the repository at this point in the history
ZFS agent: check status without locks when possible
  • Loading branch information
krig authored Oct 17, 2018
2 parents fb91908 + 2bdeee4 commit 90d193c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion heartbeat/ZFS
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ zpool_monitor () {
fi

# Check the pool status
HEALTH=$(zpool list -H -o health "$OCF_RESKEY_pool")
# Since version 0.7.10 status can be obtained without locks
# https://github.com/zfsonlinux/zfs/pull/7563
if [ -f /proc/spl/kstat/zfs/$OCF_RESKEY_pool/state ] ; then
HEALTH=$(</proc/spl/kstat/zfs/$OCF_RESKEY_pool/state)
else
HEALTH=$(zpool list -H -o health "$OCF_RESKEY_pool")
fi

case "$HEALTH" in
ONLINE|DEGRADED) return $OCF_SUCCESS;;
FAULTED) return $OCF_NOT_RUNNING;;
Expand Down

0 comments on commit 90d193c

Please sign in to comment.