rc = llog_lvfs_pad(ctxt, file, left, loghandle->lgh_last_idx);
if (rc)
RETURN(rc);
+ /* if it's the last idx in log file, then return -ENOSPC */
+ if (loghandle->lgh_last_idx == LLOG_BITMAP_SIZE(llh) - 1)
+ RETURN(-ENOSPC);
}
loghandle->lgh_last_idx++;
index = loghandle->lgh_last_idx;
+ LASSERT(index < LLOG_BITMAP_SIZE(llh));
rec->lrh_index = cpu_to_le32(index);
if (buf == NULL) {
lrt = (void *)rec + le32_to_cpu(rec->lrh_len) - sizeof(*lrt);
if (rc == 0 && reccookie) {
if (llog_cookie_get_flags(reccookie) & LLOG_COOKIE_REPLAY) {
- LASSERT(EQ_LOGID(reccookie->lgc_lgl, loghandle->lgh_id));
- LASSERT(reccookie->lgc_index == index);
+ LASSERTF(EQ_LOGID(reccookie->lgc_lgl,loghandle->lgh_id),
+ "lgc_lgl.oid/gr "LPU64"/"LPU64" lgh_id.oid/gr"
+ LPU64"/"LPU64"\n",
+ reccookie->lgc_lgl.lgl_oid,
+ reccookie->lgc_lgl.lgl_ogr,
+ loghandle->lgh_id.lgl_oid,
+ loghandle->lgh_id.lgl_oid);
+ LASSERTF(reccookie->lgc_index == index,
+ "lgc_index %u != index %u\n",
+ reccookie->lgc_index, index);
} else {
reccookie->lgc_lgl = loghandle->lgh_id;
reccookie->lgc_index = index;
static struct file *
llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
{
- struct file *filp;
+ struct file *filp = NULL;
struct dentry *dchild;
struct obd_device *obd;
struct obdo *oa = NULL;
OBD_ALLOC(oa, sizeof(*oa));
if (!oa)
RETURN(ERR_PTR(-ENOMEM));
-
+
oa->o_gr = FILTER_GROUP_LLOG;
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
rc = obd_create(ctxt->loc_exp, oa, NULL, NULL);
lock_kernel();
rc = vfs_link(dentry, ctxt->loc_objects_dir->d_inode, new_child);
unlock_kernel();
- if (rc)
- CERROR("error link new object "LPX64":%u: rc %d\n",
+ if (rc) {
+ CERROR("error link new object "LPX64":%08x: rc %d\n",
logid.lgl_oid, logid.lgl_ogen, rc);
+ /* it doesn't make much sense to get -EEXIST here */
+ LASSERTF(rc != -EEXIST, "bug 3490: dentry: %p "
+ "dir->d_ionode %p new_child: %p \n",
+ dentry, ctxt->loc_objects_dir->d_inode, new_child);
+ }
err = llog_fsfilt_commit(ctxt, ctxt->loc_objects_dir->d_inode, handle, 0);
out_dput:
l_dput(new_child);
/* reads the catalog list */
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, const char *name,
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
/* writes the cat list */
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, const char *name,
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
}
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, const char *name,
int count, struct llog_catid *idarray)
{
LBUG();
}
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, const char *name,
int count, struct llog_catid *idarray)
{
LBUG();