Message ID | 1406155995.3363.19.camel@edumazet-glaptop2.roam.corp.google.com |
---|---|
State | Superseded |
Delegated to: | Pablo Neira |
Headers | show |
On 23. Juli 2014 23:53:15 GMT+01:00, Eric Dumazet <eric.dumazet@gmail.com> wrote: >From: Eric Dumazet <edumazet@google.com> > >getsockopt() or setsockopt() sometimes returns -EINTR instead of >-ENOPROTOOPT, causing headaches to application developers. > >This is because unsupported commands might go through nf_sockopt_find() >and this function returns -EINTR instead of -ERESTARTSYS if >a signal is pending. > I'd propose to simply use the non interruptable mutex functions. We have many instances where this is really completely unnecessary. I can take care of this (once my notebook has been repaired). >Signed-off-by: Eric Dumazet <edumazet@google.com> >--- > net/netfilter/nf_sockopt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c >index f042ae521557..37181447715b 100644 >--- a/net/netfilter/nf_sockopt.c >+++ b/net/netfilter/nf_sockopt.c >@@ -66,7 +66,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct >sock *sk, u_int8_t pf, > struct nf_sockopt_ops *ops; > > if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) >- return ERR_PTR(-EINTR); >+ return ERR_PTR(-ERESTARTSYS); > > list_for_each_entry(ops, &nf_sockopts, list) { > if (ops->pf == pf) { > > -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2014-07-24 at 18:19 +0100, Patrick McHardy wrote: > On 23. Juli 2014 23:53:15 GMT+01:00, Eric Dumazet <eric.dumazet@gmail.com> wrote: > >From: Eric Dumazet <edumazet@google.com> > > > >getsockopt() or setsockopt() sometimes returns -EINTR instead of > >-ENOPROTOOPT, causing headaches to application developers. > > > >This is because unsupported commands might go through nf_sockopt_find() > >and this function returns -EINTR instead of -ERESTARTSYS if > >a signal is pending. > > > > I'd propose to simply use the non interruptable mutex functions. We > have many instances where this is really completely unnecessary. > > I can take care of this (once my notebook has been repaired). No problem I'll send a v2, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index f042ae521557..37181447715b 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c @@ -66,7 +66,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, u_int8_t pf, struct nf_sockopt_ops *ops; if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) - return ERR_PTR(-EINTR); + return ERR_PTR(-ERESTARTSYS); list_for_each_entry(ops, &nf_sockopts, list) { if (ops->pf == pf) {