On Sun, 6 Sep 2020 03:05:48 +0000 Dexuan Cui wrote: > > > @@ -2635,6 +2632,10 @@ static int netvsc_resume(struct hv_device *dev) > > > netvsc_devinfo_put(device_info); > > > net_device_ctx->saved_netvsc_dev_info = NULL; > > > > > > + vf_netdev = rtnl_dereference(net_device_ctx->vf_netdev); > > > + if (vf_netdev && netvsc_vf_changed(vf_netdev) != NOTIFY_OK) > > > + ret = -EINVAL; > > > > Should you perhaps remove the VF in case of the failure? > IMO this failure actually should not happen since we're resuming the netvsc > NIC, so we're sure we have a valid pointer to the netvsc net device, and > netvsc_vf_changed() should be able to find the netvsc pointer and return > NOTIFY_OK. In case of a failure, something really bad must be happening, > and I'm not sure if it's safe to simply remove the VF, so I just return > -EINVAL for simplicity, since I believe the failure should not happen in > practice.
Okay, I see that the errors propagated by netvsc_vf_changed() aren't actually coming from netvsc_switch_datapath(), so you're right. The failures here won't be meaningful. > I would rather keep the code as-is, but I'm OK to add a WARN_ON(1) if you > think that's necessary. No need, I think core will complain when resume callback fails. That should be sufficient.