Linux 4.8, starting from torvalds/linux@
19c5d690e, will set owner to 1 when
read held instead of leave it NULL. So we change the condition to
`rw_owner(rwp) <= 1` in RW_READ_HELD.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes zfsonlinux/zfs#5233
Closes #577
static inline int
RW_READ_HELD(krwlock_t *rwp)
{
- return (spl_rwsem_is_locked(SEM(rwp)) && rw_owner(rwp) == NULL);
+ /*
+ * Linux 4.8 will set owner to 1 when read held instead of leave it
+ * NULL. So we check whether owner <= 1.
+ */
+ return (spl_rwsem_is_locked(SEM(rwp)) &&
+ (unsigned long)rw_owner(rwp) <= 1);
}
static inline int