summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorwang di <di.wang@intel.com>2016-12-03 03:53:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-12-06 12:47:55 +0300
commit2ba88d4e100d5b1441dfa9a5e03f665b8bc676bc (patch)
tree8ae1f5de66ab705b3b30375ed480a71d38978710 /drivers/staging
parentf8e9463889ebfda1f3ff45586e5e08a096f3b97e (diff)
downloadlinux-2ba88d4e100d5b1441dfa9a5e03f665b8bc676bc.tar.xz
staging: lustre: llog: reset llog bitmap
Once update request fails due to eviction or other failures, all of update request in the sending list should return fail, because after the failure, the update log in the following request will have wrong llog bitmap. Signed-off-by: wang di <di.wang@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7039 Reviewed-on: http://review.whamcloud.com/16969 Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/lustre/lustre/obdclass/llog.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c
index 1f6609ec7dec..736ea1067c93 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog.c
@@ -115,6 +115,7 @@ static int llog_read_header(const struct lu_env *env,
rc = lop->lop_read_header(env, handle);
if (rc == LLOG_EEMPTY) {
struct llog_log_hdr *llh = handle->lgh_hdr;
+ size_t len;
/* lrh_len should be initialized in llog_init_handle */
handle->lgh_last_idx = 0; /* header is record with index 0 */
@@ -128,6 +129,12 @@ static int llog_read_header(const struct lu_env *env,
memcpy(&llh->llh_tgtuuid, uuid,
sizeof(llh->llh_tgtuuid));
llh->llh_bitmap_offset = offsetof(typeof(*llh), llh_bitmap);
+ /*
+ * Since update llog header might also call this function,
+ * let's reset the bitmap to 0 here
+ */
+ len = llh->llh_hdr.lrh_len - llh->llh_bitmap_offset;
+ memset(LLOG_HDR_BITMAP(llh), 0, len - sizeof(llh->llh_tail));
ext2_set_bit(0, LLOG_HDR_BITMAP(llh));
LLOG_HDR_TAIL(llh)->lrt_len = llh->llh_hdr.lrh_len;
LLOG_HDR_TAIL(llh)->lrt_index = llh->llh_hdr.lrh_index;