Hey Leon, ... > > diff --git a/drivers/infiniband/core/uverbs_cmd.c > b/drivers/infiniband/core/uverbs_cmd.c > > index 256934d..3f026c4 100644 > > --- a/drivers/infiniband/core/uverbs_cmd.c > > +++ b/drivers/infiniband/core/uverbs_cmd.c > > @@ -694,6 +694,8 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file > *file, > > mr->pd = pd; > > mr->uobject = uobj; > > atomic_inc(&pd->usecnt); > > + mr->res.type = RDMA_RESTRACK_MR; > > + rdma_restrack_add(&mr->res); > > > > uobj->object = mr; > > > > @@ -819,6 +821,7 @@ ssize_t ib_uverbs_dereg_mr(struct ib_uverbs_file > *file, > > struct ib_uverbs_dereg_mr cmd; > > struct ib_uobject *uobj; > > int ret = -EINVAL; > > + struct ib_mr *mr; > > > > if (copy_from_user(&cmd, buf, sizeof cmd)) > > return -EFAULT; > > @@ -828,6 +831,9 @@ ssize_t ib_uverbs_dereg_mr(struct ib_uverbs_file > *file, > > if (IS_ERR(uobj)) > > return PTR_ERR(uobj); > > > > + mr = uobj->object; > > + rdma_restrack_del(&mr->res); > > + > > It is wrong function to rdma_restrack_del(). The best place to put > rdma_restrack_add() is right after device->xxx() call and > rdma_restrack_del() is right before device->yyy() call. > > Thanks You're right. In fact, the resource is already being deleted from the restrack db in ib_dereg_mr() called by uverbs_free_mr(). So the above chunk is not needed at all. Thanks, Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html