From: Nish Aravamudan <nish.aravamudan@gmail.com>
To: Ram Gupta <ram.gupta5@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: negative timeout can be set up by setsockopt system call
Date: Mon, 7 Nov 2005 11:44:17 -0800 [thread overview]
Message-ID: <29495f1d0511071144t1c917ae1v93cf72da11ad45c7@mail.gmail.com> (raw)
In-Reply-To: <436FAB32.20807@gmail.com>
On 11/7/05, Ram Gupta <ram.gupta5@gmail.com> wrote:
>
> On 11/7/05, Ram Gupta <ram.gupta5@gmail.com> wrote:
> > On 11/4/05, Nish Aravamudan <nish.aravamudan@gmail.com>
> > >
> > > In Ram's specific case, I think, the call path is sys_setsockopt() ->
> > > sock_setsockopt() -> sock_set_timeout, which has a definition of:
> > >
> > > static int sock_set_timeout(long *timeo_p, char __user *optval, int
> > optlen)
> >
> > >> Exactly right.
>
> Ok.
>
> > > Ram, what is the expected behavior of negative values in the timeval?
> > > And what are you seeing happen right now?
> > >
> > > As of 2.6.14, looks like we convert any non-zero values into jiffies
> > > and store them in sk->sk_{rcv,snd}timeo...
> > >
> > I don't see any problem from the kernel side but the application
> > times out immediately causing certain failures as the schedule_timeout
> > returns immediately in case of negative values. Shouldn't there be a
> > check for negative values and return error to the application so that
> > it can handle it.
>
> I mean more along the lines of what does a man-page say the kernel
> should be doing if you request a negative timeout? More explicitly,
> what made you think negative timeouts should have a specific effect?
>
> > The man page is silent about the timeout behaviour in case of its
> > being negative. I believe that negative timeout is a mistake on behalf
> > of an application and hence should be treated as such (i.e should be
> > notified accordingly)
Well, the problem is that there is no defined behavior for specifying
a negative timeout (unlike poll(), for instance). So I'm not sure what
the best approach is (beyond complaining to the application developers
that their app is busted).
> When you say schedule_timeout() returns immediately, I assume your
> logs are filling up with "schedule_timeout: wrong timeout ..." ? (You
> may need to bump your loglevel). If not, then schedule_timeout() isn't
> getting a negative value.
>
> >> Yes I am getting the "schedule_timeout: wrong timeout ..."
> messages so I am sure the timeout has negative value.
Ok, maybe bring this up with the networking folks, as they may have a
better idea of what to do.
Thanks,
Nish
next prev parent reply other threads:[~2005-11-07 19:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-07 19:29 Ram Gupta
2005-11-07 19:44 ` Nish Aravamudan [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-11-07 14:42 Ram Gupta
2005-11-07 15:04 ` Nish Aravamudan
2005-11-04 20:27 Ram Gupta
2005-11-04 22:07 ` linux-os (Dick Johnson)
2005-11-04 23:18 ` Nish Aravamudan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29495f1d0511071144t1c917ae1v93cf72da11ad45c7@mail.gmail.com \
--to=nish.aravamudan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ram.gupta5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®