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

Re: [Xen-devel] [PATCH net-next v1] xen-netback: implement dynamic multicast control



> -----Original Message-----
> From: Wei Liu [mailto:wei.liu2@xxxxxxxxxx]
> Sent: 02 February 2016 11:09
> To: Paul Durrant
> Cc: netdev@xxxxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxxx; Ian Campbell;
> Wei Liu
> Subject: Re: [PATCH net-next v1] xen-netback: implement dynamic multicast
> control
> 
> On Mon, Feb 01, 2016 at 02:40:53PM +0000, Paul Durrant wrote:
> [...]
> > +static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
> > +                                    struct xenvif *vif)
> > +{
> > +   int err = 0;
> > +   char *node;
> > +   unsigned maxlen = strlen(dev->otherend) +
> > +           sizeof("/request-multicast-control");
> > +
> > +   if (vif->mcast_ctrl_watch.node)
> > +           return -EADDRINUSE;
> > +
> > +   node = kmalloc(maxlen, GFP_KERNEL);
> > +   if (!node)
> > +           return -ENOMEM;
> 
> This is one error path that has no logging, so please either add logging
> in each error patch ...
> 

Sure.

> > +   snprintf(node, maxlen, "%s/request-multicast-control",
> > +            dev->otherend);
> > +   vif->mcast_ctrl_watch.node = node;
> > +   vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed;
> > +   err = register_xenbus_watch(&vif->mcast_ctrl_watch);
> > +   if (err) {
> > +           pr_err("Failed to set watcher %s\n",
> > +                  vif->mcast_ctrl_watch.node);
> > +           kfree(node);
> > +           vif->mcast_ctrl_watch.node = NULL;
> > +           vif->mcast_ctrl_watch.callback = NULL;
> > +   }
> > +   return err;
> > +}
> > +
> > +static void xen_unregister_mcast_ctrl_watch(struct xenvif *vif)
> > +{
> > +   if (vif->mcast_ctrl_watch.node) {
> > +           unregister_xenbus_watch(&vif->mcast_ctrl_watch);
> > +           kfree(vif->mcast_ctrl_watch.node);
> > +           vif->mcast_ctrl_watch.node = NULL;
> > +   }
> > +}
> > +
> > +static void xen_register_watchers(struct xenbus_device *dev,
> > +                             struct xenvif *vif)
> > +{
> > +   xen_register_credit_watch(dev, vif);
> > +   xen_register_mcast_ctrl_watch(dev, vif);
> > +}
> > +
> > +static void xen_unregister_watchers(struct xenvif *vif)
> > +{
> > +   xen_unregister_mcast_ctrl_watch(vif);
> > +   xen_unregister_credit_watch(vif);
> > +}
> 
> ... or check if these register/unregister function calls' return value
> and log if something fails.
> 

Given that the similar failure path in credit watch registration never logged 
adding a check here may create noise where there was none before.

  Paul

> Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.