lkml.org 
[lkml]   [2011]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH v2] x25: remove the BKL
    Date
    On Thursday 27 January 2011, Eric Dumazet wrote:
    > Le jeudi 27 janvier 2011 à 13:38 +0100, Arnd Bergmann a écrit :
    > > diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c
    > > index d00649f..f1a6ff1 100644
    > > --- a/net/x25/x25_out.c
    > > +++ b/net/x25/x25_out.c
    > > @@ -68,8 +68,11 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
    > > frontlen = skb_headroom(skb);
    > >
    > > while (skb->len > 0) {
    > > - if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len,
    > > - noblock, &err)) == NULL){
    > > + release_sock(sk);
    > > + skbn = sock_alloc_send_skb(sk, frontlen + max_len,
    > > + 1, &err);
    > > + lock_sock(sk);
    > > + if (!skbn) {
    > > if (err == -EWOULDBLOCK && noblock){
    > > kfree_skb(skb);
    > > return sent;
    >
    > This part looks strange :
    >
    > noblock variable became "const 1 : NOBLOCK"
    >
    > Why releasing socket if you dont block in sock_alloc_send_skb() ?

    Leftover from an earlier version of the patch, thanks for catching this!

    Originally, I wrote this as

    long timeo = sock_sndtimeo(sk, noblock)
    do {
    skbn = sock_alloc_send_skb(sk, frontlen + max_len, 1, &err);
    if (skbn)
    break;

    release_sock(sk);
    timeo = sock_wait_for_wmem(sk, timeo);
    lock_sock(sk);
    } while (timeo);

    Then I forgot to flip it back after I noticed that other protocols also just
    call release_sock/lock_sock around sock_alloc_send_skb.

    I think I'd better go over the whole series and see if there are more things
    that got slightly broken...

    Arnd
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-01-27 14:47    [W:0.022 / U:68.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site