diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-26 00:04:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-26 00:04:58 -0400 |
commit | 887bddfa90c79957d61067cd54a10087be0c8b23 (patch) | |
tree | e4e4c24ee40d721196113df16d5d250bd1e8beac /kernel | |
parent | d42b386834ee1c22f6fac2f856bba8a6e4de38bb (diff) | |
download | linux-887bddfa90c79957d61067cd54a10087be0c8b23.tar.bz2 |
add down_write_killable_nested()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/locking/rwsem.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index c817216c1615..2e853ad93a3a 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -173,6 +173,22 @@ void down_write_nested(struct rw_semaphore *sem, int subclass) EXPORT_SYMBOL(down_write_nested); +int __sched down_write_killable_nested(struct rw_semaphore *sem, int subclass) +{ + might_sleep(); + rwsem_acquire(&sem->dep_map, subclass, 0, _RET_IP_); + + if (LOCK_CONTENDED_RETURN(sem, __down_write_trylock, __down_write_killable)) { + rwsem_release(&sem->dep_map, 1, _RET_IP_); + return -EINTR; + } + + rwsem_set_owner(sem); + return 0; +} + +EXPORT_SYMBOL(down_write_killable_nested); + void up_read_non_owner(struct rw_semaphore *sem) { __up_read(sem); |