On Tue, Apr 26, 2016 at 11:03 PM, David Miller <[email protected]> wrote:
>
> Series applied.
>
> Be careful about what feature update semantics you implement. If you get a
> request
> to change multiple feature bits, and even one of them cannot be done, the
> entire
> update operation should fail and the bits should revert to what they were
> before
> the request.
It will be a nightmare to rollback in such case. What if the rollback failed ?
>
> Is that how the code behaves now?
>
Not exactly. If the set/clear of Bit(I) is performed successfully we
set/clear that feature in dev->features ourselves,
and if one fails we return a negative error code so
__netdev_update_features will notify on the failure, but we will be
left with the features that we did success to modify.
__netdev_update_features@net/core/dev.c
if (unlikely(err < 0)) {
netdev_err(dev,
"set_features() failed (%d); wanted %pNF, left %pNF\n",
err, &features, &dev->features);
/* return non-0 since some features might have changed and
* it's better to fire a spurious notification than miss it
*/
return -1;
}
>From this I understand it is ok to update the dev->features inside the
device's set_features NDO and return a negative value in case of
failure,
and a notification on changed features will be fired in anycase.
Is this a correct assumption ?
Anyhow if you think this behavior should be fixed, we will fix it.
Failures at set_features should be rare and should be debugged rather
than ignored.
Saeed.