rc = mdd_la_get(env, mdd_tobj, la_tmp, BYPASS_CAPA);
if (!rc) {
+ void *data = NULL;
+ mdd_data_get(env, mdd_tobj, &data);
quota_opc = FSFILT_OP_LINK;
mdd_quota_wrapper(la_tmp, qids);
/* get block quota for parent */
lquota_chkquota(mds_quota_interface_ref, obd,
qids[USRQUOTA], qids[GRPQUOTA], 1,
- &rec_pending, NULL, LQUOTA_FLAGS_BLK);
+ &rec_pending, NULL, LQUOTA_FLAGS_BLK,
+ data, 1);
}
}
#endif
if (rec_pending)
lquota_pending_commit(mds_quota_interface_ref, obd,
qids[USRQUOTA], qids[GRPQUOTA],
- 1, 1);
+ rec_pending, 1);
/* Trigger dqacq for the parent owner. If failed,
* the next call for lquota_chkquota will process it. */
lquota_adjust(mds_quota_interface_ref, obd, 0, qids, rc,
rc = mdd_la_get(env, mdd_obj, la_tmp, BYPASS_CAPA);
if (!rc) {
+ void *data = NULL;
+ mdd_data_get(env, mdd_obj, &data);
quota_opc = FSFILT_OP_LINK;
mdd_quota_wrapper(la_tmp, qids);
/* get block quota for parent */
lquota_chkquota(mds_quota_interface_ref, obd,
qids[USRQUOTA], qids[GRPQUOTA],
1, &rec_pending, NULL,
- LQUOTA_FLAGS_BLK);
+ LQUOTA_FLAGS_BLK, data, 1);
}
} else {
uc->mu_cap |= CFS_CAP_SYS_RESOURCE_MASK;
if (rec_pending)
lquota_pending_commit(mds_quota_interface_ref,
obd, qids[USRQUOTA],
- qids[GRPQUOTA], 1, 1);
+ qids[GRPQUOTA],
+ rec_pending, 1);
/* Trigger dqacq for the parent owner. If failed,
* the next call for lquota_chkquota will process it*/
lquota_adjust(mds_quota_interface_ref, obd, 0, qids,
rc = mdd_la_get(env, mdd_tpobj, la_tmp, BYPASS_CAPA);
if (!rc) {
+ void *data = NULL;
+ mdd_data_get(env, mdd_tpobj, &data);
quota_opc = FSFILT_OP_LINK;
mdd_quota_wrapper(la_tmp, qpids);
/* get block quota for target parent */
lquota_chkquota(mds_quota_interface_ref, obd,
qpids[USRQUOTA], qpids[GRPQUOTA], 1,
- &rec_pending, NULL, LQUOTA_FLAGS_BLK);
+ &rec_pending, NULL, LQUOTA_FLAGS_BLK,
+ data, 1);
}
}
#endif
lquota_pending_commit(mds_quota_interface_ref, obd,
qpids[USRQUOTA],
qpids[GRPQUOTA],
- 1, 1);
+ rec_pending, 1);
if (quota_opc)
/* Trigger dqrel/dqacq on the target owner of child and
* parent. If failed, the next call for lquota_chkquota
/* get file quota for child */
lquota_chkquota(mds_quota_interface_ref, obd,
qcids[USRQUOTA], qcids[GRPQUOTA], 1,
- &inode_pending, NULL, 0);
+ &inode_pending, NULL, 0, NULL, 0);
switch (ma->ma_attr.la_mode & S_IFMT) {
case S_IFLNK:
case S_IFDIR:
qcids[USRQUOTA], qcids[GRPQUOTA],
block_count,
&block_pending, NULL,
- LQUOTA_FLAGS_BLK);
+ LQUOTA_FLAGS_BLK, NULL, 0);
if (!same)
lquota_chkquota(mds_quota_interface_ref, obd,
qpids[USRQUOTA], qpids[GRPQUOTA], 1,
&parent_pending, NULL,
- LQUOTA_FLAGS_BLK);
+ LQUOTA_FLAGS_BLK, NULL, 0);
}
}
#endif
if (inode_pending)
lquota_pending_commit(mds_quota_interface_ref, obd,
qcids[USRQUOTA], qcids[GRPQUOTA],
- 1, 0);
+ inode_pending, 0);
if (block_pending)
lquota_pending_commit(mds_quota_interface_ref, obd,
qcids[USRQUOTA], qcids[GRPQUOTA],
- block_count, 1);
+ block_pending, 1);
if (parent_pending)
lquota_pending_commit(mds_quota_interface_ref, obd,
qpids[USRQUOTA], qpids[GRPQUOTA],
- 1, 1);
+ parent_pending, 1);
/* Trigger dqacq on the owner of child and parent. If failed,
* the next call for lquota_chkquota will process it. */
lquota_adjust(mds_quota_interface_ref, obd, qcids, qpids, rc,
rc = mdd_la_get(env, mdd_tpobj, la_tmp,
BYPASS_CAPA);
if (!rc) {
+ void *data = NULL;
+ mdd_data_get(env, mdd_tpobj, &data);
quota_opc = FSFILT_OP_LINK;
mdd_quota_wrapper(la_tmp, qtpids);
/* get block quota for target parent */
obd, qtpids[USRQUOTA],
qtpids[GRPQUOTA], 1,
&rec_pending, NULL,
- LQUOTA_FLAGS_BLK);
+ LQUOTA_FLAGS_BLK,
+ data, 1);
}
}
}
lquota_pending_commit(mds_quota_interface_ref, obd,
qtpids[USRQUOTA],
qtpids[GRPQUOTA],
- 1, 1);
+ rec_pending, 1);
/* Trigger dqrel on the source owner of parent.
* If failed, the next call for lquota_chkquota will
* process it. */
}
if (leh->leh_magic != LINK_EA_MAGIC)
return ERR_PTR(-EINVAL);
+ if (leh->leh_reccount == 0)
+ return ERR_PTR(-ENODATA);
return buf;
}
leh = buf->lb_buf;
reclen = lname->ln_namelen + sizeof(struct link_ea_entry);
if (leh->leh_len + reclen > buf->lb_len) {
- mdd_buf_grow(env, leh->leh_len + reclen);
- if (buf->lb_buf == NULL)
+ if (mdd_buf_grow(env, leh->leh_len + reclen) < 0)
return -ENOMEM;
}
struct lu_name *tmpname = &mdd_env_info(env)->mti_name;
struct lu_fid *tmpfid = &mdd_env_info(env)->mti_fid;
int reclen = 0;
- int rc, count;
+ int count;
+ int rc, rc2 = 0;
ENTRY;
if (!mdd_linkea_enable)
/* If renaming, add the new record */
if (newpfid != NULL) {
- rc = __mdd_links_add(env, buf, newpfid, newlname);
- if (rc)
- GOTO(out, rc);
+ /* if the add fails, we still delete the out-of-date old link */
+ rc2 = __mdd_links_add(env, buf, newpfid, newlname);
leh = buf->lb_buf;
}
XATTR_NAME_LINK, 0, handle);
out:
+ if (rc == 0)
+ rc = rc2;
if (rc)
CDEBUG(D_INODE, "link_ea mv/unlink '%.*s' failed %d "DFID"\n",
oldlname->ln_namelen, oldlname->ln_name, rc,