Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/spl/sys/rwlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
}

/*
* The following functions must be a #define and not static inline.
* The following functions must be a #define and not static inline.
* This ensures that the native linux semaphore functions (down/up)
* will be correctly located in the users code which is important
* for the built in kernel lock analysis tools
Expand All @@ -188,10 +188,10 @@ RW_LOCK_HELD(krwlock_t *rwp)
spl_rw_set_type(rwp, type); \
})

#define rw_destroy(rwp) \
({ \
VERIFY(!RW_LOCK_HELD(rwp)); \
})
/*
* The Linux rwsem implementation does not require a matching destroy.
*/
#define rw_destroy(rwp) ((void) 0)

#define rw_tryenter(rwp, rw) \
({ \
Expand Down
19 changes: 14 additions & 5 deletions module/spl/spl-rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,24 @@
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
* a 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.
Expand All @@ -60,6 +68,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
return (1);
}
return (0);
#endif
}
#elif defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
static int
Expand Down
2 changes: 1 addition & 1 deletion module/spl/spl-vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
int
spl_vn_init(void)
{
vn_file_lock = __SPIN_LOCK_UNLOCKED(vn_file_lock);
spin_lock_init(&vn_file_lock);

vn_cache = kmem_cache_create("spl_vn_cache",
sizeof (struct vnode), 64, vn_cache_constructor,
Expand Down