Whamcloud - gitweb
- unland b_fid to HEAD
[fs/lustre-release.git] / lustre / lvfs / llog_lvfs.c
index 5f57b64..1aa8be9 100644 (file)
@@ -246,10 +246,14 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle,
                 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);
@@ -278,8 +282,16 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle,
 
         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;
@@ -633,7 +645,7 @@ llog_object_create_alone(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
 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;
@@ -688,7 +700,7 @@ llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
                 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);
@@ -762,9 +774,14 @@ static int llog_add_link_object(struct llog_ctxt *ctxt, struct llog_logid logid,
         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);
@@ -952,7 +969,7 @@ out:
 
 /* 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;
@@ -997,7 +1014,7 @@ EXPORT_SYMBOL(llog_get_cat_list);
 
 /* 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;
@@ -1088,7 +1105,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle)
 }
 
 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();
@@ -1096,7 +1113,7 @@ int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
 }
 
 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();