From patchwork Mon Sep 30 18:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167169 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 52DA6912 for ; Mon, 30 Sep 2019 19:01:21 +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 3B75F224EF for ; Mon, 30 Sep 2019 19:01:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B75F224EF 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 EEBFB5C4121; Mon, 30 Sep 2019 11:59:00 -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 057005C3B6E for ; Mon, 30 Sep 2019 11:57:16 -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 D6031100585E; Mon, 30 Sep 2019 14:56:56 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id D3D39A9; Mon, 30 Sep 2019 14:56:56 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:55:15 -0400 Message-Id: <1569869810-23848-57-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 056/151] lustre: llite: check layout size after cl_object_layout_get 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: Mikhal Pershin , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Mikhal Pershin Check that layout size is not zero before doing flush for DoM object. Also patch does that: - initializes all values in cl_layout explicitly in lov_object_layout_get(). - changes cl_dom_comp_size to u64 for future needs, e.g. importing an existing filesystem image directly. WC-bug-id: https://jira.whamcloud.com/browse/LU-3285 Lustre-commit: 877669a282ef ("LU-3285 llite: check layout size after cl_object_layout_get") Signed-off-by: Mikhal Pershin Reviewed-on: https://review.whamcloud.com/29810 Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- fs/lustre/include/cl_object.h | 2 +- fs/lustre/llite/namei.c | 3 +-- fs/lustre/lov/lov_object.c | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h index 0894b2e..c0d6452 100644 --- a/fs/lustre/include/cl_object.h +++ b/fs/lustre/include/cl_object.h @@ -287,7 +287,7 @@ struct cl_layout { /** size of layout in lov_mds_md format. */ size_t cl_size; /** size of DoM component if exists or zero otherwise */ - u32 cl_dom_comp_size; + u64 cl_dom_comp_size; /** Layout generation. */ u32 cl_layout_gen; /** whether layout is a composite one */ diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c index fb75441..355a500 100644 --- a/fs/lustre/llite/namei.c +++ b/fs/lustre/llite/namei.c @@ -197,10 +197,9 @@ int ll_dom_lock_cancel(struct inode *inode, struct ldlm_lock *lock) CDEBUG(D_INODE, "Cannot get layout for "DFID"\n", PFID(ll_inode2fid(inode))); rc = -ENODATA; - } else if (clt.cl_dom_comp_size == 0) { + } else if (clt.cl_size == 0 || clt.cl_dom_comp_size == 0) { CDEBUG(D_INODE, "DOM lock without DOM layout for "DFID"\n", PFID(ll_inode2fid(inode))); - rc = -EINVAL; } else { enum cl_fsync_mode mode; loff_t end = clt.cl_dom_comp_size - 1; diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c index 9fcf51b..3a7b38d 100644 --- a/fs/lustre/lov/lov_object.c +++ b/fs/lustre/lov/lov_object.c @@ -1869,6 +1869,7 @@ static int lov_object_layout_get(const struct lu_env *env, cl->cl_size = lov_comp_md_size(lsm); cl->cl_layout_gen = lsm->lsm_layout_gen; + cl->cl_dom_comp_size = 0; if (lsm_is_composite(lsm->lsm_magic)) { struct lov_stripe_md_entry *lsme = lsm->lsm_entries[0]; @@ -1876,7 +1877,10 @@ static int lov_object_layout_get(const struct lu_env *env, if (lsme_is_dom(lsme)) cl->cl_dom_comp_size = lsme->lsme_extent.e_end; + } else { + cl->cl_is_composite = false; } + rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len); lov_lsm_put(lsm);