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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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++);
> +	}

?

Anyway, thanks!

Acked-by: Stanislav Kinsbursky <skinsbursky@xxxxxxxxxxxxx>

--
Best regards,
Stanislav Kinsbursky
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux