Commit 887bddfa authored by Al Viro's avatar Al Viro

add down_write_killable_nested()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d42b3868
...@@ -156,6 +156,7 @@ extern void downgrade_write(struct rw_semaphore *sem); ...@@ -156,6 +156,7 @@ extern void downgrade_write(struct rw_semaphore *sem);
*/ */
extern void down_read_nested(struct rw_semaphore *sem, int subclass); extern void down_read_nested(struct rw_semaphore *sem, int subclass);
extern void down_write_nested(struct rw_semaphore *sem, int subclass); extern void down_write_nested(struct rw_semaphore *sem, int subclass);
extern int down_write_killable_nested(struct rw_semaphore *sem, int subclass);
extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock); extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock);
# define down_write_nest_lock(sem, nest_lock) \ # define down_write_nest_lock(sem, nest_lock) \
...@@ -176,6 +177,7 @@ extern void up_read_non_owner(struct rw_semaphore *sem); ...@@ -176,6 +177,7 @@ extern void up_read_non_owner(struct rw_semaphore *sem);
# define down_read_nested(sem, subclass) down_read(sem) # define down_read_nested(sem, subclass) down_read(sem)
# define down_write_nest_lock(sem, nest_lock) down_write(sem) # define down_write_nest_lock(sem, nest_lock) down_write(sem)
# define down_write_nested(sem, subclass) down_write(sem) # define down_write_nested(sem, subclass) down_write(sem)
# define down_write_killable_nested(sem, subclass) down_write_killable(sem)
# define down_read_non_owner(sem) down_read(sem) # define down_read_non_owner(sem) down_read(sem)
# define up_read_non_owner(sem) up_read(sem) # define up_read_non_owner(sem) up_read(sem)
#endif #endif
......
...@@ -173,6 +173,22 @@ void down_write_nested(struct rw_semaphore *sem, int subclass) ...@@ -173,6 +173,22 @@ void down_write_nested(struct rw_semaphore *sem, int subclass)
EXPORT_SYMBOL(down_write_nested); 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) void up_read_non_owner(struct rw_semaphore *sem)
{ {
__up_read(sem); __up_read(sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment