Whamcloud - gitweb
LU-6593 kernel: kernel update [RHEL7.1 3.10.0-229.4.2.el7]
[fs/lustre-release.git] / lustre / obdclass / llog_osd.c
index e74f552..5d3e246 100644 (file)
@@ -199,7 +199,7 @@ static int llog_osd_read_header(const struct lu_env *env,
 
        lgi = llog_info(env);
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                RETURN(rc);
 
@@ -365,7 +365,7 @@ static int llog_osd_write_rec(const struct lu_env *env,
        if (reclen > LLOG_CHUNK_SIZE)
                RETURN(-E2BIG);
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                RETURN(rc);
 
@@ -526,7 +526,7 @@ static int llog_osd_write_rec(const struct lu_env *env,
                GOTO(out, rc);
 
        header_is_updated = true;
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                GOTO(out, rc);
 
@@ -664,7 +664,7 @@ static int llog_osd_next_block(const struct lu_env *env,
        dt = lu2dt_dev(o->do_lu.lo_dev);
        LASSERT(dt);
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, BYPASS_CAPA);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                GOTO(out, rc);
 
@@ -715,7 +715,7 @@ static int llog_osd_next_block(const struct lu_env *env,
                                                sizeof(struct llog_rec_tail));
                /* get the last record in block */
                last_rec = (struct llog_rec_hdr *)((char *)buf + rc -
-                                                  le32_to_cpu(tail->lrt_len));
+                                                  tail->lrt_len);
 
                if (LLOG_REC_HDR_NEEDS_SWABBING(last_rec))
                        lustre_swab_llog_rec(last_rec);
@@ -802,7 +802,7 @@ static int llog_osd_prev_block(const struct lu_env *env,
        cur_offset = LLOG_CHUNK_SIZE;
        llog_skip_over(&cur_offset, 0, prev_idx);
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, BYPASS_CAPA);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                GOTO(out, rc);
 
@@ -890,8 +890,8 @@ out:
  * \retval             dt_object of llog directory
  * \retval             ERR_PTR of negative value on error
  */
-struct dt_object *llog_osd_dir_get(const struct lu_env *env,
-                                  struct llog_ctxt *ctxt)
+static struct dt_object *llog_osd_dir_get(const struct lu_env *env,
+                                         struct llog_ctxt *ctxt)
 {
        struct dt_device        *dt;
        struct dt_thread_info   *dti = dt_info(env);
@@ -1166,7 +1166,7 @@ static int llog_osd_create(const struct lu_env *env, struct llog_handle *res,
                dt_read_lock(env, llog_dir, 0);
                rc = dt_insert(env, llog_dir, (struct dt_rec *)rec,
                               (struct dt_key *)res->lgh_name,
-                              th, BYPASS_CAPA, 1);
+                              th, 1);
                dt_read_unlock(env, llog_dir);
                lu_object_put(env, &llog_dir->do_lu);
                if (rc)
@@ -1262,7 +1262,9 @@ static int llog_osd_destroy(const struct lu_env *env,
                        GOTO(out_trans, rc);
        }
 
-       dt_declare_ref_del(env, o, th);
+       rc = dt_declare_ref_del(env, o, th);
+       if (rc < 0)
+               GOTO(out_trans, rc);
 
        rc = dt_declare_destroy(env, o, th);
        if (rc)
@@ -1278,7 +1280,7 @@ static int llog_osd_destroy(const struct lu_env *env,
                        dt_read_lock(env, llog_dir, 0);
                        rc = dt_delete(env, llog_dir,
                                       (struct dt_key *) name,
-                                      th, BYPASS_CAPA);
+                                      th);
                        dt_read_unlock(env, llog_dir);
                        if (rc) {
                                CERROR("%s: can't remove llog %s: rc = %d\n",
@@ -1473,7 +1475,7 @@ out_trans:
                        GOTO(out, rc);
        }
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, BYPASS_CAPA);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                GOTO(out, rc);
 
@@ -1503,7 +1505,9 @@ out_trans:
        lgi->lgi_buf.lb_buf = idarray;
        lgi->lgi_buf.lb_len = size;
        rc = dt_record_read(env, o, &lgi->lgi_buf, &lgi->lgi_off);
-       if (rc) {
+       /* -EFAULT means the llog is a sparse file. This is not an error
+        * after arbitrary OST index is supported. */
+       if (rc < 0 && rc != -EFAULT) {
                CERROR("%s: error reading CATALOGS: rc = %d\n",
                       o->do_lu.lo_dev->ld_obd->obd_name,  rc);
                GOTO(out, rc);
@@ -1558,7 +1562,7 @@ int llog_osd_put_cat_list(const struct lu_env *env, struct dt_device *d,
        if (!dt_object_exists(o))
                GOTO(out, rc = -ENOENT);
 
-       rc = dt_attr_get(env, o, &lgi->lgi_attr, BYPASS_CAPA);
+       rc = dt_attr_get(env, o, &lgi->lgi_attr);
        if (rc)
                GOTO(out, rc);