Skip to content

Commit

Permalink
ZFS agent: check status without locks when possible
Browse files Browse the repository at this point in the history
Signed-off-by: George Melikov <mail@gmelikov.ru>
  • Loading branch information
gmelikov committed Oct 17, 2018
1 parent 5eb5d5b commit 07b19bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion heartbeat/ZFS
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ 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 07b19bb

Please sign in to comment.