From patchwork Mon May 25 22:08:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11569555 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E78815E4 for ; Mon, 25 May 2020 22:09:38 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 871B82071A for ; Mon, 25 May 2020 22:09:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 871B82071A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id CF4FE2473B0; Mon, 25 May 2020 15:09:09 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 418932471F8 for ; Mon, 25 May 2020 15:08:40 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id 56A8F1005EEB; Mon, 25 May 2020 18:08:27 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 5569A495; Mon, 25 May 2020 18:08:27 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 25 May 2020 18:08:09 -0400 Message-Id: <1590444502-20533-33-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> References: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 32/45] lustre: llog: allow delete of zero size llog X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Boyko , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Alexander Boyko 1) all plain logs belonging to catalog should have flag LLOG_F_ZAP_WHEN_EMPTY base on llog_cat_new_log(). When llog_cat_process_common processing plain log with zero file size, this flag is not set during llog_cat_id2handle LLOG_EMPTY, so these plain llogs are not canceled/destroyed. They appeared during cross MDT updates. Fix adds flag LLOG_F_ZAP_WHEN_EMPTY for any plain llog at catalog. Cray-bug-id: LUS-8634 WC-bug-id: https://jira.whamcloud.com/browse/LU-13411 Lustre-commit: bc7f8cfe0fc6a ("LU-13411 llog: allow delete of zero size llog") Signed-off-by: Alexander Boyko Reviewed-on: https://review.whamcloud.com/38131 Reviewed-by: Mike Pershin Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/obdclass/llog.c | 9 +++++---- fs/lustre/obdclass/llog_cat.c | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/lustre/obdclass/llog.c b/fs/lustre/obdclass/llog.c index 28a79bb..b2667d9 100644 --- a/fs/lustre/obdclass/llog.c +++ b/fs/lustre/obdclass/llog.c @@ -472,6 +472,7 @@ int llog_process_or_fork(const struct lu_env *env, struct llog_process_info *lpi; struct llog_process_data *d = data; struct llog_process_cat_data *cd = catdata; + u32 flags = loghandle->lgh_hdr->llh_flags; int rc; lpi = kzalloc(sizeof(*lpi), GFP_KERNEL); @@ -484,10 +485,10 @@ int llog_process_or_fork(const struct lu_env *env, CDEBUG(D_OTHER, "Processing " DFID " flags 0x%03x startcat %d startidx %d first_idx %d last_idx %d\n", - PFID(&loghandle->lgh_id.lgl_oi.oi_fid), - loghandle->lgh_hdr->llh_flags, d ? d->lpd_startcat : -1, - d ? d->lpd_startidx : -1, cd ? cd->lpcd_first_idx : -1, - cd ? cd->lpcd_last_idx : -1); + PFID(&loghandle->lgh_id.lgl_oi.oi_fid), flags, + (flags & LLOG_F_IS_CAT) && d ? d->lpd_startcat : -1, + (flags & LLOG_F_IS_CAT) && d ? d->lpd_startidx : -1, + cd ? cd->lpcd_first_idx : -1, cd ? cd->lpcd_last_idx : -1); if (fork) { struct task_struct *task; diff --git a/fs/lustre/obdclass/llog_cat.c b/fs/lustre/obdclass/llog_cat.c index 46636f8..9298808 100644 --- a/fs/lustre/obdclass/llog_cat.c +++ b/fs/lustre/obdclass/llog_cat.c @@ -108,7 +108,8 @@ static int llog_cat_id2handle(const struct lu_env *env, return rc; } - rc = llog_init_handle(env, loghandle, fmt | LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(env, loghandle, LLOG_F_IS_PLAIN | + LLOG_F_ZAP_WHEN_EMPTY | fmt, NULL); if (rc < 0) { llog_close(env, loghandle); *res = NULL;