{
struct file *filp;
__u32 i, j;
- int err, rc;
+ int err;
bool any_set = false;
- struct kkuc_ct_data kcd = { 0 };
+ struct kkuc_ct_data kcd = {
+ .kcd_magic = KKUC_CT_DATA_MAGIC,
+ .kcd_uuid = lmv->cluuid,
+ .kcd_archive = lk->lk_data
+ };
+ int rc = 0;
ENTRY;
+ filp = fget(lk->lk_wfd);
+ if (!filp)
+ RETURN(-EBADF);
+
+ rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group,
+ &kcd, sizeof(kcd));
+ if (rc)
+ GOTO(err_fput, rc);
+
/* All or nothing: try to register to all MDS.
* In case of failure, unregister from previous MDS,
* except if it because of inactive target. */
if (tgt == NULL || tgt->ltd_exp == NULL)
continue;
+
err = obd_iocontrol(cmd, tgt->ltd_exp, len, lk, uarg);
if (err) {
if (tgt->ltd_active) {
obd_iocontrol(cmd, tgt->ltd_exp, len,
lk, uarg);
}
- RETURN(rc);
+ GOTO(err_kkuc_rem, rc);
}
/* else: transient error.
* kuc will register to the missing MDT
if (!any_set)
/* no registration done: return error */
- RETURN(-ENOTCONN);
+ GOTO(err_kkuc_rem, rc = -ENOTCONN);
- /* at least one registration done, with no failure */
- filp = fget(lk->lk_wfd);
- if (filp == NULL)
- RETURN(-EBADF);
+ RETURN(0);
- kcd.kcd_magic = KKUC_CT_DATA_MAGIC;
- kcd.kcd_uuid = lmv->cluuid;
- kcd.kcd_archive = lk->lk_data;
+err_kkuc_rem:
+ libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
- rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group,
- &kcd, sizeof(kcd));
- if (rc != 0)
- fput(filp);
-
- RETURN(rc);
+err_fput:
+ fput(filp);
+ return rc;
}