diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 36 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 84 |
2 files changed, 113 insertions, 7 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 6605e756bcd..22d6cc1a320 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -130,6 +130,12 @@ #include <net/tcp.h> #endif +//#define DEBUG_CHECK_SIGNAL_PENDING + +#ifdef DEBUG_CHECK_SIGNAL_PENDING + #include <linux/signal.h> +#endif + /* * Each address family might have different locking rules, so we have * one slock key per address family: @@ -1537,6 +1543,36 @@ int sk_wait_data(struct sock *sk, long *timeo) prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); rc = sk_wait_event(sk, timeo, !skb_queue_empty(&sk->sk_receive_queue)); + +#ifdef DEBUG_CHECK_SIGNAL_PENDING + if ( signal_pending ( current ) ) + { + printk( "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__ ); + + if ( _NSIG_WORDS == 1 ) + { + printk( "Signal set0 is 0x%08lx\n", + current->signal->shared_pending.signal.sig[0] ); + } + else + { + printk( "Signal set0 is 0x%08lx\n", + current->signal->shared_pending.signal.sig[0] ); + printk( "Signal set1 is 0x%08lx\n", + current->signal->shared_pending.signal.sig[1] ); + +// printk("Signal set0 is 0x%08lx, flags 0x%08lx\n", +// current->signal->shared_pending.signal.sig[0], +// ((struct thread_info *)current->stack)->flags ); +// +// printk("Signal %d is %s\n", SIGRTMIN+3, +// sigismember(¤t->signal->shared_pending.signal, +// SIGRTMIN+3) ? "present" : "not present" ); + + } + } +#endif // DEBUG_CHECK_SIGNAL_PENDING + clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); finish_wait(sk->sk_sleep, &wait); return rc; diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8b8b2766253..72fa141d17d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -610,8 +610,12 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, /* * We can't seek on a socket input */ - if (unlikely(ppos)) + if (unlikely(ppos)) { + printk(KERN_ERR "%s:%s:%d\n" + "returning ESPIPE\n", + __FUNCTION__, __FILE__, __LINE__); return -ESPIPE; + } ret = spliced = 0; @@ -620,39 +624,81 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK); while (tss.len) { ret = __tcp_splice_read(sk, &tss); - if (ret < 0) + if (ret < 0) { + printk(KERN_ERR "%s:%s:%d\n" + "breaking err %d\n", + __FUNCTION__, __FILE__, __LINE__, ret); break; + } else if (!ret) { if (spliced >= len) break; if (flags & SPLICE_F_NONBLOCK) { ret = -EAGAIN; + printk(KERN_ERR "%s:%s:%d\n" + "breaking -EAGAIN\n", + __FUNCTION__, __FILE__, __LINE__); break; } if (sock_flag(sk, SOCK_DONE)) + { + printk(KERN_ERR "%s:%s:%d\n" + "breaking %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); break; + } if (sk->sk_err) { ret = sock_error(sk); + printk(KERN_ERR "%s:%s:%d\n" + "breaking err %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); break; } if (sk->sk_shutdown & RCV_SHUTDOWN) + { + printk(KERN_ERR "%s:%s:%d\n" + "breaking %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); break; + } if (sk->sk_state == TCP_CLOSE) { + printk(KERN_ERR "%s:%s:%d\n" + "breaking %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); /* * This occurs when user tries to read * from never connected socket. */ - if (!sock_flag(sk, SOCK_DONE)) + if (!sock_flag(sk, SOCK_DONE)) { + printk(KERN_ERR "%s:%s:%d\n" + "breaking ENOTCONN\n", + __FUNCTION__, __FILE__, __LINE__); ret = -ENOTCONN; + } break; } if (!timeo) { ret = -EAGAIN; + printk(KERN_ERR "%s:%s:%d\n" + "breaking EAGAIN\n", + __FUNCTION__, __FILE__, __LINE__); break; } sk_wait_data(sk, &timeo); - if (signal_pending(current)) { + if (signal_pending(current)) { // exists in distro-kernel ret = sock_intr_errno(timeo); + if ( spliced == 0 ) + { + printk( KERN_ERR "%s:%s:%d\n" + "signal pending recd during " + "tcp splice read .. returning %d.\n", + __FILE__, __FUNCTION__, __LINE__, + ret ); + } break; } continue; @@ -661,14 +707,38 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, spliced += ret; if (!timeo) + { + printk(KERN_ERR "%s:%s:%d\n" + "breaking %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); break; + } release_sock(sk); lock_sock(sk); if (sk->sk_err || sk->sk_state == TCP_CLOSE || - (sk->sk_shutdown & RCV_SHUTDOWN) || - signal_pending(current)) + (sk->sk_shutdown & RCV_SHUTDOWN)) + { + printk(KERN_ERR "%s:%s:%d\n" + "breaking %d\n", + __FUNCTION__, __FILE__, __LINE__, + ret); + break; + } + + if (signal_pending(current)) + { + if ( spliced == 0 ) + { + printk( KERN_ERR "%s:%s:%d\n" + "signal pending recd at end of while during " + "tcp splice read .. returning %d.\n", + __FILE__, __FUNCTION__, __LINE__, + ret ); + } break; + } } release_sock(sk); @@ -1338,7 +1408,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, sk_eat_skb(sk, skb, 0); if (!desc->count) break; - tp->copied_seq = seq; + tp->copied_seq = seq; } tp->copied_seq = seq; |