RE: [PATCH 0/2] NFSD: fix races in service per-net resources allocation

Peter Staubach
2013-02-12T21:27:43Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2476 bytes --]

The "+" thing seems a little odd. Why not use "||" instead? The sum of the two returns isn't really the important thing, is it? It is that either call to svc_close_list() returns non-zero.

Thanx...

ps

-----Original Message-----
From: linux-nfs-owner@vger.kernel.org [mailto:linux-nfs-owner@vger.kernel.org] On Behalf Of J. Bruce Fields
Sent: Tuesday, February 12, 2013 3:46 PM
To: Stanislav Kinsbursky
Cc: akpm@linux-foundation.org; linux-nfs@vger.kernel.org; Trond.Myklebust@netapp.com; linux-kernel@vger.kernel.org; devel@openvz.org
Subject: Re: [PATCH 0/2] NFSD: fix races in service per-net resources allocation

On Tue, Feb 12, 2013 at 01:52:32PM +0400, Stanislav Kinsbursky wrote:
> 12.02.2013 00:58, J. Bruce Fields Ð¿Ð¸ÑˆÐµÑ‚:
> <snip>
> > void svc_close_net(struct svc_serv *serv, struct net *net)
> > {
> >- svc_close_list(serv, &serv->sv_tempsocks, net);
> >- svc_close_list(serv, &serv->sv_permsocks, net);
> >-
> >- svc_clear_pools(serv, net);
> >- /*
> >- * At this point the sp_sockets lists will stay empty, since
> >- * svc_xprt_enqueue will not add new entries without taking the
> >- * sp_lock and checking XPT_BUSY.
> >- */
> >- svc_clear_list(serv, &serv->sv_tempsocks, net);
> >- svc_clear_list(serv, &serv->sv_permsocks, net);
> >+ int closed;
> >+ int delay = 0;
> >+
> >+again:
> >+ closed = svc_close_list(serv, &serv->sv_permsocks, net);
> >+ closed += svc_close_list(serv, &serv->sv_tempsocks, net);
> >+ if (closed) {
> >+ svc_clean_up_xprts(serv, net);
> >+ msleep(delay++);
> >+ goto again;
> >+ }
>
> Frankly, this hunk above makes me feel sick... :( But I have no better
> idea right now...
> Maybe make this hunk a bit less weird (this is from my POW only, of course), like this:
>
> > + while (svc_close_list(serv, &serv->sv_permsocks, net) +
> > + svc_close_list(serv, &serv->sv_tempsocks, net)) {
> > + svc_clean_up_xprts(serv, net);
> > + msleep(delay++);
> > + }
>
> ?

OK, that's a little more compact at least.

--b.

>
> Anyway, thanks!
>
> Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
>
> --
> Best regards,
> Stanislav Kinsbursky
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥