epoll_mutex_lock() has three callers, all in do_epoll_ctl(), and every one passes depth == 0. The argument has been dead since the helper was introduced. Drop it. Because a zero subclass makes mutex_lock_nested() equivalent to mutex_lock(), switch the blocking path to the simpler primitive as well. No functional change. Signed-off-by: Christian Brauner (Amutable) --- fs/eventpoll.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index da31a3ac6057..ba1017c72167 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -2432,16 +2432,13 @@ static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) } #endif -static inline int epoll_mutex_lock(struct mutex *mutex, int depth, - bool nonblock) +static inline int epoll_mutex_lock(struct mutex *mutex, bool nonblock) { if (!nonblock) { - mutex_lock_nested(mutex, depth); + mutex_lock(mutex); return 0; } - if (mutex_trylock(mutex)) - return 0; - return -EAGAIN; + return mutex_trylock(mutex) ? 0 : -EAGAIN; } int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, @@ -2513,14 +2510,14 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, * deep wakeup paths from forming in parallel through multiple * EPOLL_CTL_ADD operations. */ - error = epoll_mutex_lock(&ep->mtx, 0, nonblock); + error = epoll_mutex_lock(&ep->mtx, nonblock); if (error) goto error_tgt_fput; if (op == EPOLL_CTL_ADD) { if (READ_ONCE(fd_file(f)->f_ep) || ep->gen == loop_check_gen || is_file_epoll(fd_file(tf))) { mutex_unlock(&ep->mtx); - error = epoll_mutex_lock(&epnested_mutex, 0, nonblock); + error = epoll_mutex_lock(&epnested_mutex, nonblock); if (error) goto error_tgt_fput; loop_check_gen++; @@ -2531,7 +2528,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, if (ep_loop_check(ep, tep) != 0) goto error_tgt_fput; } - error = epoll_mutex_lock(&ep->mtx, 0, nonblock); + error = epoll_mutex_lock(&ep->mtx, nonblock); if (error) goto error_tgt_fput; } -- 2.47.3