Message ID | 5cbecaf0-dbb6-4140-43ed-ae94fc161941@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, 2017-11-05 at 13:00 +0300, Vasily Averin wrote: > Be sure that nfs_client_list and nfs_volume_list lists initialized > in net_init hook were return to initial state in net_exit hook. > > Signed-off-by: Vasily Averin <vvs@virtuozzo.com> > --- > fs/nfs/client.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/nfs/client.c b/fs/nfs/client.c > index 22880ef..7c0691c 100644 > --- a/fs/nfs/client.c > +++ b/fs/nfs/client.c > @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) > struct nfs_net *nn = net_generic(net, nfs_net_id); > > idr_destroy(&nn->cb_ident_idr); > + WARN(!list_empty(&nn->nfs_client_list), > + "net %p exit: nfs_client_list is not empty\n", net); > + WARN(!list_empty(&nn->nfs_volume_list), > + "net %p exit: nfs_volume_list is not empty\n", net); > } > Why do we need these? Is there a specific bug that you are trying to track down? -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.myklebust@primarydata.com
On 2017-11-05 19:02, Trond Myklebust wrote: > On Sun, 2017-11-05 at 13:00 +0300, Vasily Averin wrote: >> Be sure that nfs_client_list and nfs_volume_list lists initialized >> in net_init hook were return to initial state in net_exit hook. >> >> Signed-off-by: Vasily Averin <vvs@virtuozzo.com> >> --- >> fs/nfs/client.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/fs/nfs/client.c b/fs/nfs/client.c >> index 22880ef..7c0691c 100644 >> --- a/fs/nfs/client.c >> +++ b/fs/nfs/client.c >> @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) >> struct nfs_net *nn = net_generic(net, nfs_net_id); >> >> idr_destroy(&nn->cb_ident_idr); >> + WARN(!list_empty(&nn->nfs_client_list), >> + "net %p exit: nfs_client_list is not empty\n", net); >> + WARN(!list_empty(&nn->nfs_volume_list), >> + "net %p exit: nfs_volume_list is not empty\n", net); >> } >> > > Why do we need these? Is there a specific bug that you are trying to > track down? I hope such checks allows to detect leaked per-netns objects. Also I hope that all new pernet_operations will inherit such checks too. I assume that elements added into per-net lists should not live longer than net namespace, and should be deleted from the list. I think exit_net hook is good place for such check. Recently I've found lost list_entry and enabled timer on stop of net namespace. Then I've reviewed all existing pernet_operations and found that many drivers have such checks already. So I decided to complete this task and add such checks into all affected subsystems. -- 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
T24gU3VuLCAyMDE3LTExLTA1IGF0IDE5OjQ4ICswMzAwLCBWYXNpbHkgQXZlcmluIHdyb3RlOg0K PiBPbiAyMDE3LTExLTA1IDE5OjAyLCBUcm9uZCBNeWtsZWJ1c3Qgd3JvdGU6DQo+ID4gT24gU3Vu LCAyMDE3LTExLTA1IGF0IDEzOjAwICswMzAwLCBWYXNpbHkgQXZlcmluIHdyb3RlOg0KPiA+ID4g QmUgc3VyZSB0aGF0IG5mc19jbGllbnRfbGlzdCBhbmQgbmZzX3ZvbHVtZV9saXN0IGxpc3RzDQo+ ID4gPiBpbml0aWFsaXplZA0KPiA+ID4gaW4gbmV0X2luaXQgaG9vayB3ZXJlIHJldHVybiB0byBp bml0aWFsIHN0YXRlIGluIG5ldF9leGl0IGhvb2suDQo+ID4gPiANCj4gPiA+IFNpZ25lZC1vZmYt Ynk6IFZhc2lseSBBdmVyaW4gPHZ2c0B2aXJ0dW96em8uY29tPg0KPiA+ID4gLS0tDQo+ID4gPiAg ZnMvbmZzL2NsaWVudC5jIHwgNCArKysrDQo+ID4gPiAgMSBmaWxlIGNoYW5nZWQsIDQgaW5zZXJ0 aW9ucygrKQ0KPiA+ID4gDQo+ID4gPiBkaWZmIC0tZ2l0IGEvZnMvbmZzL2NsaWVudC5jIGIvZnMv bmZzL2NsaWVudC5jDQo+ID4gPiBpbmRleCAyMjg4MGVmLi43YzA2OTFjIDEwMDY0NA0KPiA+ID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of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 22880ef..7c0691c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) struct nfs_net *nn = net_generic(net, nfs_net_id); idr_destroy(&nn->cb_ident_idr); + WARN(!list_empty(&nn->nfs_client_list), + "net %p exit: nfs_client_list is not empty\n", net); + WARN(!list_empty(&nn->nfs_volume_list), + "net %p exit: nfs_volume_list is not empty\n", net); } /* nfs_client_lock held */
Be sure that nfs_client_list and nfs_volume_list lists initialized in net_init hook were return to initial state in net_exit hook. Signed-off-by: Vasily Averin <vvs@virtuozzo.com> --- fs/nfs/client.c | 4 ++++ 1 file changed, 4 insertions(+)