diff mbox

sunrpc: fix waitqueue_active without memory barrier in sunrpc

Message ID 17EC94B0A072C34B8DCF0D30AD16044A028747A3@BPXM09GP.gisp.nec.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Kosuke Tatsukawa Oct. 9, 2015, 12:35 a.m. UTC
There are several places in net/sunrpc/svcsock.c which calls
waitqueue_active() without calling a memory barrier.  Change the code
to call wq_has_sleeper() instead, which other networking code uses in
similar places.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
---
 net/sunrpc/svcsock.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Comments

kernel test robot Oct. 9, 2015, 12:54 a.m. UTC | #1
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
>> net/sunrpc/svcsock.c:417:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq))
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq)) {
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_listen_data_ready':
   net/sunrpc/svcsock.c:790:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq))
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_state_change':
   net/sunrpc/svcsock.c:811:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq))
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_data_ready':
   net/sunrpc/svcsock.c:826:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq))
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_sock_detach':
   net/sunrpc/svcsock.c:1597:6: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type
     if (wq_has_sleeper(wq))
         ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'struct wait_queue_head_t *'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^

vim +/wq_has_sleeper +417 net/sunrpc/svcsock.c

   401	
   402	/*
   403	 * INET callback when data has been received on the socket.
   404	 */
   405	static void svc_udp_data_ready(struct sock *sk)
   406	{
   407		struct svc_sock	*svsk = (struct svc_sock *)sk->sk_user_data;
   408		wait_queue_head_t *wq = sk_sleep(sk);
   409	
   410		if (svsk) {
   411			dprintk("svc: socket %p(inet %p), busy=%d\n",
   412				svsk, sk,
   413				test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
   414			set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
   415			svc_xprt_enqueue(&svsk->sk_xprt);
   416		}
 > 417		if (wq_has_sleeper(wq))
   418			wake_up_interruptible(wq);
   419	}
   420	
   421	/*
   422	 * INET callback when space is newly available on the socket.
   423	 */
   424	static void svc_write_space(struct sock *sk)
   425	{

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Oct. 9, 2015, 1:08 a.m. UTC | #2
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: x86_64-randconfig-x002-201540 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq))
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   include/linux/compiler.h:147:40: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                                           ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq))
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   include/linux/compiler.h:158:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq))
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq)) {
                        ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
   net/sunrpc/svcsock.c:435:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq)) {
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq)) {
                        ^
   include/linux/compiler.h:147:40: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                                           ^
   net/sunrpc/svcsock.c:435:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq)) {
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq)) {
                        ^
   include/linux/compiler.h:158:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
   net/sunrpc/svcsock.c:435:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq)) {
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c: In function 'svc_tcp_listen_data_ready':
   net/sunrpc/svcsock.c:790:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
   net/sunrpc/svcsock.c:790:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq))
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:790:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   include/linux/compiler.h:147:40: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                                           ^
   net/sunrpc/svcsock.c:790:2: note: in expansion of macro 'if'
     if (wq_has_sleeper(wq))
     ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^

vim +/if +417 net/sunrpc/svcsock.c

   401	
   402	/*
   403	 * INET callback when data has been received on the socket.
   404	 */
   405	static void svc_udp_data_ready(struct sock *sk)
   406	{
   407		struct svc_sock	*svsk = (struct svc_sock *)sk->sk_user_data;
   408		wait_queue_head_t *wq = sk_sleep(sk);
   409	
   410		if (svsk) {
   411			dprintk("svc: socket %p(inet %p), busy=%d\n",
   412				svsk, sk,
   413				test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
   414			set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
   415			svc_xprt_enqueue(&svsk->sk_xprt);
   416		}
 > 417		if (wq_has_sleeper(wq))
   418			wake_up_interruptible(wq);
   419	}
   420	
   421	/*
   422	 * INET callback when space is newly available on the socket.
   423	 */
   424	static void svc_write_space(struct sock *sk)
   425	{

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Oct. 9, 2015, 1:11 a.m. UTC | #3
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> net/sunrpc/svcsock.c:417:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:417:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:417:28:    got struct __wait_queue_head [usertype] *wq
>> net/sunrpc/svcsock.c:1597:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:1597:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:1597:28:    got struct __wait_queue_head [usertype] *[assigned] wq
   net/sunrpc/svcsock.c:435:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:435:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:435:28:    got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c:790:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:790:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:790:28:    got struct __wait_queue_head [usertype] *[assigned] wq
   net/sunrpc/svcsock.c:811:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:811:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:811:28:    got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c:826:28: sparse: incorrect type in argument 1 (different base types)
   net/sunrpc/svcsock.c:826:28:    expected struct socket_wq *wq
   net/sunrpc/svcsock.c:826:28:    got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq)) {
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_listen_data_ready':
   net/sunrpc/svcsock.c:790:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_state_change':
   net/sunrpc/svcsock.c:811:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_data_ready':
   net/sunrpc/svcsock.c:826:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^
   net/sunrpc/svcsock.c: In function 'svc_sock_detach':
   net/sunrpc/svcsock.c:1597:21: warning: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Wincompatible-pointer-types]
     if (wq_has_sleeper(wq))
                        ^
   In file included from include/net/inet_sock.h:27:0,
                    from include/linux/udp.h:20,
                    from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
    static inline bool wq_has_sleeper(struct socket_wq *wq)
                       ^

vim +417 net/sunrpc/svcsock.c

   401	
   402	/*
   403	 * INET callback when data has been received on the socket.
   404	 */
   405	static void svc_udp_data_ready(struct sock *sk)
   406	{
   407		struct svc_sock	*svsk = (struct svc_sock *)sk->sk_user_data;
   408		wait_queue_head_t *wq = sk_sleep(sk);
   409	
   410		if (svsk) {
   411			dprintk("svc: socket %p(inet %p), busy=%d\n",
   412				svsk, sk,
   413				test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags));
   414			set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
   415			svc_xprt_enqueue(&svsk->sk_xprt);
   416		}
 > 417		if (wq_has_sleeper(wq))
   418			wake_up_interruptible(wq);
   419	}
   420	
   421	/*
   422	 * INET callback when space is newly available on the socket.
   423	 */
   424	static void svc_write_space(struct sock *sk)
   425	{

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 0c81202..cf081b8 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -414,7 +414,7 @@  static void svc_udp_data_ready(struct sock *sk)
 		set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
 		svc_xprt_enqueue(&svsk->sk_xprt);
 	}
-	if (wq && waitqueue_active(wq))
+	if (wq_has_sleeper(wq))
 		wake_up_interruptible(wq);
 }
 
@@ -432,7 +432,7 @@  static void svc_write_space(struct sock *sk)
 		svc_xprt_enqueue(&svsk->sk_xprt);
 	}
 
-	if (wq && waitqueue_active(wq)) {
+	if (wq_has_sleeper(wq)) {
 		dprintk("RPC svc_write_space: someone sleeping on %p\n",
 		       svsk);
 		wake_up_interruptible(wq);
@@ -787,7 +787,7 @@  static void svc_tcp_listen_data_ready(struct sock *sk)
 	}
 
 	wq = sk_sleep(sk);
-	if (wq && waitqueue_active(wq))
+	if (wq_has_sleeper(wq))
 		wake_up_interruptible_all(wq);
 }
 
@@ -808,7 +808,7 @@  static void svc_tcp_state_change(struct sock *sk)
 		set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
 		svc_xprt_enqueue(&svsk->sk_xprt);
 	}
-	if (wq && waitqueue_active(wq))
+	if (wq_has_sleeper(wq))
 		wake_up_interruptible_all(wq);
 }
 
@@ -823,7 +823,7 @@  static void svc_tcp_data_ready(struct sock *sk)
 		set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
 		svc_xprt_enqueue(&svsk->sk_xprt);
 	}
-	if (wq && waitqueue_active(wq))
+	if (wq_has_sleeper(wq))
 		wake_up_interruptible(wq);
 }
 
@@ -1594,7 +1594,7 @@  static void svc_sock_detach(struct svc_xprt *xprt)
 	sk->sk_write_space = svsk->sk_owspace;
 
 	wq = sk_sleep(sk);
-	if (wq && waitqueue_active(wq))
+	if (wq_has_sleeper(wq))
 		wake_up_interruptible(wq);
 }