[Devel] [PATCH rh7 v2] ve/vznetstat: Don't destroy statistics until explicitly asked

Vladimir Davydov vdavydov at parallels.com
Fri Jul 24 09:13:06 PDT 2015


On Fri, Jul 24, 2015 at 07:05:05PM +0300, Cyrill Gorcunov wrote:
> On Fri, Jul 24, 2015 at 06:50:49PM +0300, Vladimir Davydov wrote:
> > On Fri, Jul 24, 2015 at 06:48:52PM +0300, Cyrill Gorcunov wrote:
> > > On Fri, Jul 24, 2015 at 06:39:27PM +0300, Vladimir Davydov wrote:
> > > > > 
> > > > > Yes. There might be several nets.
> > > > 
> > > > Hmm, correct. Then you'd better check this explicitly:
> > > > 
> > > > 	if (ve->ve_netns == net)
> > > > 		...
> > > > 
> > > > Otherwise, you can omit clearing ve->stat if you race with e.g.
> > > > VZCTL_TC_CLEAR_STAT, which also increments/decrements ->users.
> > > 
> > > I would rather prefer take write lock @tc_lock here.
> > 
> > Why?
> 
> Because it's more reliable I think, I mean venetstat module does
> own counting for users and we can follow this rule -- use counter
> for anythig. Sure ve->ve_netns can be used here as well but I
> prefer counter. What's the profit of using @ve_netns instead?

Because this way it will always work, while your approach won't. In case
of VZCTL_TC_CLEAR_STAT you can get away by taking the req_mutex, but it
simply won't work with venet_acct_set_base.



More information about the Devel mailing list