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. _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel