aboutsummaryrefslogtreecommitdiffstats
path: root/module/spl/spl-rwlock.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2019-05-23 13:46:33 -0700
committerGitHub <[email protected]>2019-05-23 13:46:33 -0700
commitbff2361aeb32a83c26e2992733864ca99cced257 (patch)
treeae45cdae978446595bbb160f20dae43ba9e79edb /module/spl/spl-rwlock.c
parente34c3ee2fcbb320525a110c1811c557bc60479ff (diff)
Linux 5.2 compat: rw_tryupgrade()
Commit torvalds/linux@46ad0840b has removed the architecture specific rwsem source and headers leaving only the generic version. As part of this change the RWSEM_ACTIVE_READ_BIAS and RWSEM_ACTIVE_WRITE_BIAS macros were moved to the private kernel/locking/rwsem.h header. This results in a build failure because these macros were required to implement the rw_tryupgrade() compatibility function. In practice, this isn't a major problem because there are only a few consumers of rw_tryupgrade() and because consumers of rw_tryupgrade should be written to retry using rw_enter(RW_WRITER). After auditing all of the callers only dmu_zfetch() was determined not to perform a retry. It has been updated in this commit to resolve this issue. That said, the rw_tryupgrade() functionality should be considered for possible removal in a future release due to the difficultly in supporting the interface. Reviewed-by: Tomohiro Kusumi <[email protected]> Reviewed-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #8730
Diffstat (limited to 'module/spl/spl-rwlock.c')
-rw-r--r--module/spl/spl-rwlock.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c
index 4ffebc8ea..86727ed19 100644
--- a/module/spl/spl-rwlock.c
+++ b/module/spl/spl-rwlock.c
@@ -85,7 +85,8 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
spl_rwsem_unlock_irqrestore(&rwsem->wait_lock, flags);
return (ret);
}
-#elif defined(HAVE_RWSEM_ATOMIC_LONG_COUNT)
+#elif defined(RWSEM_ACTIVE_MASK)
+#if defined(HAVE_RWSEM_ATOMIC_LONG_COUNT)
static int
__rwsem_tryupgrade(struct rw_semaphore *rwsem)
{
@@ -104,6 +105,13 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
return (val == SPL_RWSEM_SINGLE_READER_VALUE);
}
#endif
+#else
+static int
+__rwsem_tryupgrade(struct rw_semaphore *rwsem)
+{
+ return (0);
+}
+#endif
int
rwsem_tryupgrade(struct rw_semaphore *rwsem)