From patchwork Thu Feb 27 21:12:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410165 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 1152A92A for ; Thu, 27 Feb 2020 21:31:49 +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 EDEDF24677 for ; Thu, 27 Feb 2020 21:31:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDEDF24677 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 38734349941; Thu, 27 Feb 2020 13:26:59 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 029CD21FDA3 for ; Thu, 27 Feb 2020 13:19:38 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 6CC7F2C7B; Thu, 27 Feb 2020 16:18:16 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 6AA8146D; Thu, 27 Feb 2020 16:18:16 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:12:12 -0500 Message-Id: <1582838290-17243-265-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 264/622] lustre: mdc: reset lmm->lmm_stripe_offset in mdc_save_lovea 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: Alexey Lyashkov , Vladimir Saveliev , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Alexey Lyashkov In order to prepare for replay lmm->lmm_stripe_offset (which contains layout generation) has to be set to -1 (LOV_OFFSET_DEFAULT) in order to not confuse lod_verify_v1v3 Fix patch for ("LU-169 lov: add generation number to LOV EA") which was apart of original Lustre merger to Linux kernel. WC-bug-id: https://jira.whamcloud.com/browse/LU-12040 Lustre-commit: c872afa36ff5 ("LU-12040 mdc: reset lmm->lmm_stripe_offset in mdc_save_lovea") Signed-off-by: Vladimir Saveliev Signed-off-by: Alexey Lyashkov Cray-bug-id: LUS-7008 Reviewed-on: https://review.whamcloud.com/34371 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/mdc/mdc_lib.c | 3 ++- fs/lustre/mdc/mdc_locks.c | 8 ++++++-- include/uapi/linux/lustre/lustre_user.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/lustre/mdc/mdc_lib.c b/fs/lustre/mdc/mdc_lib.c index 980676a..f0e5a84 100644 --- a/fs/lustre/mdc/mdc_lib.c +++ b/fs/lustre/mdc/mdc_lib.c @@ -406,7 +406,8 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, lum->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V1); lum->lmm_stripe_size = 0; lum->lmm_stripe_count = 0; - lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1); + lum->lmm_stripe_offset = + (typeof(lum->lmm_stripe_offset))LOV_OFFSET_DEFAULT; } else { memcpy(lum, ea, ealen); } diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c index 05447ea..019eb35 100644 --- a/fs/lustre/mdc/mdc_locks.c +++ b/fs/lustre/mdc/mdc_locks.c @@ -220,8 +220,8 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size) { struct req_capsule *pill = &req->rq_pill; + struct lov_user_md *lmm; int rc = 0; - void *lmm; if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) { rc = sptlrpc_cli_enlarge_reqbuf(req, field, size); @@ -237,8 +237,12 @@ static int mdc_save_lovea(struct ptlrpc_request *req, req_capsule_set_size(pill, field, RCL_CLIENT, size); lmm = req_capsule_client_get(pill, field); - if (lmm) + if (lmm) { memcpy(lmm, data, size); + /* overwrite layout generation returned from the MDS */ + lmm->lmm_stripe_offset = + (typeof(lmm->lmm_stripe_offset))LOV_OFFSET_DEFAULT; + } return rc; } diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index 1d402f1..3901eb2 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -404,6 +404,7 @@ struct ll_ioc_lease_id { #define LOV_MAXPOOLNAME 15 #define LOV_POOLNAMEF "%.15s" +#define LOV_OFFSET_DEFAULT ((__u16)-1) #define LOV_MIN_STRIPE_BITS 16 /* maximum PAGE_SIZE (ia64), power of 2 */ #define LOV_MIN_STRIPE_SIZE (1 << LOV_MIN_STRIPE_BITS)