Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759410AbcLCA6M (ORCPT ); Fri, 2 Dec 2016 19:58:12 -0500 Received: from [160.91.203.10] ([160.91.203.10]:35256 "EHLO smtp1.ccs.ornl.gov" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754189AbcLCA6L (ORCPT ); Fri, 2 Dec 2016 19:58:11 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , wang di , James Simmons Subject: [PATCH 06/22] staging: lustre: llog: reset llog bitmap Date: Fri, 2 Dec 2016 19:53:13 -0500 Message-Id: <1480726409-20350-7-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1480726409-20350-1-git-send-email-jsimmons@infradead.org> References: <1480726409-20350-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1958 Lines: 46 From: wang di 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 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7039 Reviewed-on: http://review.whamcloud.com/16969 Reviewed-by: Alex Zhuravlev Reviewed-by: James Simmons Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/llog.c | 7 +++++++ 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 ae63047..65e6ce6 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -114,6 +114,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 */ @@ -127,6 +128,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; -- 1.7.1