From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5487C432C0 for ; Wed, 27 Nov 2019 21:44:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76B812154A for ; Wed, 27 Nov 2019 21:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574891042; bh=HK2xquq36bYBWwcTDwpjNXQgQBGzBWVirfylhRvR+ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iQTqMI4bwi0kHU76/CY7vui9YOvUFeEXc2UNodb2euDN7NdlaRN4gKhysn5NHOjTt dcw2Tt+uMtwvNpv5FR4aLj3FPSiwGmqw1mcELXt2JhfFhxC60aAmidxn+quxTh1uRh ctCahAh3z9zIGR7o2jdzGKwrRVaLc3syTvgODFsU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbfK0UiB (ORCPT ); Wed, 27 Nov 2019 15:38:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:41282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728665AbfK0UiB (ORCPT ); Wed, 27 Nov 2019 15:38:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE4DF215E5; Wed, 27 Nov 2019 20:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887080; bh=HK2xquq36bYBWwcTDwpjNXQgQBGzBWVirfylhRvR+ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jw7nvZ0v9DyM0GSbX2taR5dFDmJ45mupHpfmhczo2rmyaUQlT3LwcT9Zfxy6RHU2/ PkQfhnDbqbCU5aXx5In+7dsDts44d7h4R4hwfFdSB7A11+dcNxkTwDiyl1Bn+CS8OR qZzrEW3wcQp+I9q/BNLsI5OCBmwtqe2p+y6ERlhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gang He , Joseph Qi , Eric Ren , Changwei Ge , Mark Fasheh , Joel Becker , Junxiao Bi , Andrew Morton , Linus Torvalds , Lee Jones Subject: [PATCH 4.4 104/132] ocfs2: remove ocfs2_is_o2cb_active() Date: Wed, 27 Nov 2019 21:31:35 +0100 Message-Id: <20191127203025.567094543@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127202857.270233486@linuxfoundation.org> References: <20191127202857.270233486@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gang He commit a634644751c46238df58bbfe992e30c1668388db upstream. Remove ocfs2_is_o2cb_active(). We have similar functions to identify which cluster stack is being used via osb->osb_cluster_stack. Secondly, the current implementation of ocfs2_is_o2cb_active() is not totally safe. Based on the design of stackglue, we need to get ocfs2_stack_lock before using ocfs2_stack related data structures, and that active_stack pointer can be NULL in the case of mount failure. Link: http://lkml.kernel.org/r/1495441079-11708-1-git-send-email-ghe@suse.com Signed-off-by: Gang He Reviewed-by: Joseph Qi Reviewed-by: Eric Ren Acked-by: Changwei Ge Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/stackglue.c | 6 ------ fs/ocfs2/stackglue.h | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-) --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -3426,7 +3426,7 @@ static int ocfs2_downconvert_lock(struct * we can recover correctly from node failure. Otherwise, we may get * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. */ - if (!ocfs2_is_o2cb_active() && + if (ocfs2_userspace_stack(osb) && lockres->l_ops->flags & LOCK_TYPE_USES_LVB) lvb = 1; --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -48,12 +48,6 @@ static char ocfs2_hb_ctl_path[OCFS2_MAX_ */ static struct ocfs2_stack_plugin *active_stack; -inline int ocfs2_is_o2cb_active(void) -{ - return !strcmp(active_stack->sp_name, OCFS2_STACK_PLUGIN_O2CB); -} -EXPORT_SYMBOL_GPL(ocfs2_is_o2cb_active); - static struct ocfs2_stack_plugin *ocfs2_stack_lookup(const char *name) { struct ocfs2_stack_plugin *p; --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h @@ -298,7 +298,4 @@ void ocfs2_stack_glue_set_max_proto_vers int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin); void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin); -/* In ocfs2_downconvert_lock(), we need to know which stack we are using */ -int ocfs2_is_o2cb_active(void); - #endif /* STACKGLUE_H */