mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Retire rwsem_is_locked() compat
Stock Linux 2.6.32 and earlier kernels contained a broken version of rwsem_is_locked() which could return an incorrect value. Because of this compatibility code was added to detect the broken implementation and replace it with our own if needed. The fix for this issue was merged in to the mainline Linux kernel as of 2.6.33 and the major enterprise distributions based on 2.6.32 have all backported the fix. Therefore there is no longer a need to carry this code and it can be removed. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #454
This commit is contained in:
@@ -37,30 +37,6 @@
|
||||
#define spl_rwsem_trylock_irqsave(lk, fl) spin_trylock_irqsave(lk, fl)
|
||||
#endif /* RWSEM_SPINLOCK_IS_RAW */
|
||||
|
||||
/*
|
||||
* Prior to Linux 2.6.33 there existed a race condition in rwsem_is_locked().
|
||||
* The semaphore's activity was checked outside of the wait_lock which
|
||||
* could result in some readers getting the incorrect activity value.
|
||||
*
|
||||
* When a kernel without this fix is detected the SPL takes responsibility
|
||||
* for acquiring the wait_lock to avoid this race.
|
||||
*/
|
||||
#if defined(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK)
|
||||
#define spl_rwsem_is_locked(rwsem) rwsem_is_locked(rwsem)
|
||||
#else
|
||||
static inline int
|
||||
spl_rwsem_is_locked(struct rw_semaphore *rwsem)
|
||||
{
|
||||
unsigned long flags;
|
||||
int rc = 1;
|
||||
|
||||
if (spl_rwsem_trylock_irqsave(&rwsem->wait_lock, flags)) {
|
||||
rc = rwsem_is_locked(rwsem);
|
||||
spl_rwsem_unlock_irqrestore(&rwsem->wait_lock, flags);
|
||||
}
|
||||
|
||||
return (rc);
|
||||
}
|
||||
#endif /* RWSEM_IS_LOCKED_TAKES_WAIT_LOCK */
|
||||
|
||||
#endif /* _SPL_RWSEM_COMPAT_H */
|
||||
|
||||
@@ -83,15 +83,13 @@ rw_owner(krwlock_t *rwp)
|
||||
static inline int
|
||||
RW_READ_HELD(krwlock_t *rwp)
|
||||
{
|
||||
return (spl_rwsem_is_locked(SEM(rwp)) &&
|
||||
rw_owner(rwp) == NULL);
|
||||
return (spl_rwsem_is_locked(SEM(rwp)) && rw_owner(rwp) == NULL);
|
||||
}
|
||||
|
||||
static inline int
|
||||
RW_WRITE_HELD(krwlock_t *rwp)
|
||||
{
|
||||
return (spl_rwsem_is_locked(SEM(rwp)) &&
|
||||
rw_owner(rwp) == current);
|
||||
return (spl_rwsem_is_locked(SEM(rwp)) && rw_owner(rwp) == current);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
||||
Reference in New Issue
Block a user