From patchwork Mon Sep 30 18:56:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167217 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 B7FA215AB for ; Mon, 30 Sep 2019 19:03:55 +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 A0863224EF for ; Mon, 30 Sep 2019 19:03:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0863224EF 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 ADCAF5E45ED; Mon, 30 Sep 2019 11:59:50 -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 9B6B15C3B96 for ; Mon, 30 Sep 2019 11:57:36 -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 A15B41005F1B; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id A0345BB; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:56:17 -0400 Message-Id: <1569869810-23848-119-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 118/151] lustre: llite: deny 2.10 clients to open mirrored files 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: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Jinshan Xiong 2.10 clients would manipulate mirrored layout as PFL layout, which would damage mirrored files. This patch only allows mirrored files to be opened by clients who understand mirror layout. It also fixes the problem that it should check OBD_CONNECT_FLAGS2 first before checking OBD_CONNECT2_XXX flags. WC-bug-id: https://jira.whamcloud.com/browse/LU-10286 Lustre-commit: 21e39775a0f4 ("LU-10286 llite: deny 2.10 clients to open mirrored files") Signed-off-by: Jinshan Xiong Reviewed-on: https://review.whamcloud.com/30957 Tested-by: Jian Yu Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- fs/lustre/include/lustre_export.h | 9 ++++++++- fs/lustre/llite/llite_lib.c | 2 +- include/uapi/linux/lustre/lustre_idl.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/lustre/include/lustre_export.h b/fs/lustre/include/lustre_export.h index 544166f..de3b109 100644 --- a/fs/lustre/include/lustre_export.h +++ b/fs/lustre/include/lustre_export.h @@ -156,7 +156,9 @@ static inline u64 *exp_connect_flags2_ptr(struct obd_export *exp) static inline u64 exp_connect_flags2(struct obd_export *exp) { - return *exp_connect_flags2_ptr(exp); + if (exp_connect_flags(exp) & OBD_CONNECT_FLAGS2) + return *exp_connect_flags2_ptr(exp); + return 0; } static inline int exp_max_brw_size(struct obd_export *exp) @@ -262,6 +264,11 @@ static inline int exp_connect_lockahead(struct obd_export *exp) return !!(exp_connect_flags2(exp) & OBD_CONNECT2_LOCKAHEAD); } +static inline int exp_connect_flr(struct obd_export *exp) +{ + return !!(exp_connect_flags2(exp) & OBD_CONNECT2_FLR); +} + struct obd_export *class_conn2export(struct lustre_handle *conn); #define KKUC_CT_DATA_MAGIC 0x092013cea diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c index 2a7ef64..efd1093 100644 --- a/fs/lustre/llite/llite_lib.c +++ b/fs/lustre/llite/llite_lib.c @@ -208,7 +208,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_GRANT_PARAM | OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2; - data->ocd_connect_flags2 = 0; + data->ocd_connect_flags2 = OBD_CONNECT2_FLR; if (sbi->ll_flags & LL_SBI_LRU_RESIZE) data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE; diff --git a/include/uapi/linux/lustre/lustre_idl.h b/include/uapi/linux/lustre/lustre_idl.h index 6dce6f1..6294eaa 100644 --- a/include/uapi/linux/lustre/lustre_idl.h +++ b/include/uapi/linux/lustre/lustre_idl.h @@ -791,6 +791,7 @@ struct ptlrpc_body_v2 { #define OBD_CONNECT2_LOCKAHEAD 0x2ULL /* ladvise lockahead * v2 */ +#define OBD_CONNECT2_FLR 0x20ULL /* FLR support */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same