diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c80c107139f..f246812680d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -161,8 +161,9 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) static inline unsigned int unix_hash_fold(__wsum n) { - unsigned int hash = (__force unsigned int)csum_fold(n); + unsigned int hash = (__force unsigned int)n; + hash ^= hash>>16; hash ^= hash>>8; return hash&(UNIX_HASH_SIZE-1); } @@ -1793,11 +1794,8 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, goto out; err = mutex_lock_interruptible(&u->readlock); - if (unlikely(err)) { - /* recvmsg() in non blocking mode is supposed to return -EAGAIN - * sk_rcvtimeo is not honored by mutex_lock_interruptible() - */ - err = noblock ? -EAGAIN : -ERESTARTSYS; + if (err) { + err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); goto out; } @@ -1917,7 +1915,6 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, struct unix_sock *u = unix_sk(sk); struct sockaddr_un *sunaddr = msg->msg_name; int copied = 0; - int noblock = flags & MSG_DONTWAIT; int check_creds = 0; int target; int err = 0; @@ -1933,7 +1930,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, goto out; target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); - timeo = sock_rcvtimeo(sk, noblock); + timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); /* Lock the socket to prevent queue disordering * while sleeps in memcpy_tomsg @@ -1945,11 +1942,8 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, } err = mutex_lock_interruptible(&u->readlock); - if (unlikely(err)) { - /* recvmsg() in non blocking mode is supposed to return -EAGAIN - * sk_rcvtimeo is not honored by mutex_lock_interruptible() - */ - err = noblock ? -EAGAIN : -ERESTARTSYS; + if (err) { + err = sock_intr_errno(timeo); goto out; } |
