From: clefru Date: Thu, 19 Jan 2017 22:41:38 +0000 (+0100) Subject: Reimplement rt_mutex_owner to fix build with DEBUG & PREEMPT_RT_FULL X-Git-Tag: zfs-0.8.0-rc1~152^2~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d4d81c485bd5ed3ccaf1580c4efdc0ecdbc52ee;p=zfs Reimplement rt_mutex_owner to fix build with DEBUG & PREEMPT_RT_FULL rt_mutex_owner is internal to kernel/locking/rtmutex_common.h and inaccessible for SPL via the public kernel headers. The way of accessing the owner has been stable since at least 3.13 ([1], [2]), which is masking the lowest bit in the owner pointer in rt_mutex. We do the same. [1] http://lxr.free-electrons.com/source/kernel/locking/rtmutex_common.h?v=3.13#L99 [2] http://lxr.free-electrons.com/source/kernel/locking/rtmutex_common.h?v=4.9#L78 Reviewed-by: Brian Behlendorf Signed-off-by: Clemens Fruhwirth Closes #593 --- diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c index 9e96c4f27..d99ef4f92 100644 --- a/module/spl/spl-rwlock.c +++ b/module/spl/spl-rwlock.c @@ -35,11 +35,15 @@ #if defined(CONFIG_PREEMPT_RT_FULL) #include +#define RT_MUTEX_OWNER_MASKALL 1UL static int __rwsem_tryupgrade(struct rw_semaphore *rwsem) { - ASSERT(rt_mutex_owner(&rwsem->lock) == current); + + ASSERT((struct task_struct *) + ((unsigned long)rwsem->lock.owner & ~RT_MUTEX_OWNER_MASKALL) == + current); /* * Under the realtime patch series, rwsem is implemented as a