]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - module/spl/spl-rwlock.c
New upstream version 0.7.11
[mirror_spl-debian.git] / module / spl / spl-rwlock.c
index bf7ee2f837f12d935ff9a6f913d2a025569aea68..ac28c91899b89975d9d56bfb17517761f2937b96 100644 (file)
 static int
 __rwsem_tryupgrade(struct rw_semaphore *rwsem)
 {
-
+#if defined(READER_BIAS) && defined(WRITER_BIAS)
+       /*
+        * After the 4.9.20-rt16 kernel the realtime patch series lifted the
+        * single reader restriction.  While this could be accommodated by
+        * adding additional compatibility code assume the rwsem can never
+        * be upgraded.  All caller must already cleanly handle this case.
+        */
+       return (0);
+#else
        ASSERT((struct task_struct *)
            ((unsigned long)rwsem->lock.owner & ~RT_MUTEX_OWNER_MASKALL) ==
            current);
 
        /*
-        * Under the realtime patch series, rwsem is implemented as a
-        * single mutex held by readers and writers alike. However,
-        * this implementation would prevent a thread from taking a
-        * read lock twice, as the mutex would already be locked on
+        * Prior to 4.9.20-rt16 kernel the realtime patch series, rwsem is
+        * implemented as a single mutex held by readers and writers alike.
+        * However, this implementation would prevent a thread from taking
+        * read lock twice, as the mutex would already be locked on
         * the second attempt. Therefore the implementation allows a
         * single thread to take a rwsem as read lock multiple times
         * tracking that nesting as read_depth counter.
@@ -59,6 +67,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
                return (1);
        }
        return (0);
+#endif
 }
 #elif defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
 static int