From patchwork Thu Nov 30 22:24:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 10085713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 216C86064E for ; Thu, 30 Nov 2017 22:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129222A3BB for ; Thu, 30 Nov 2017 22:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06BEA2A3CD; Thu, 30 Nov 2017 22:24:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F1952A3BB for ; Thu, 30 Nov 2017 22:24:47 +0000 (UTC) Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAUMOYl4004815 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Nov 2017 22:24:34 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vAUMOCrA023131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Nov 2017 22:24:14 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eKXFc-0008SV-TD; Thu, 30 Nov 2017 14:24:12 -0800 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eKXFb-0008SN-18 for ocfs2-devel@oss.oracle.com; Thu, 30 Nov 2017 14:24:11 -0800 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vAUMOACO024174 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 30 Nov 2017 22:24:10 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vAUMMx0J003573 for ; Thu, 30 Nov 2017 22:24:10 GMT Authentication-Results: oracle.com; spf=pass smtp.mailfrom=akpm@linux-foundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by userp2030.oracle.com with ESMTP id 2ejpppp5hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Nov 2017 22:24:10 +0000 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B5A8DC16; Thu, 30 Nov 2017 22:24:08 +0000 (UTC) Date: Thu, 30 Nov 2017 14:24:07 -0800 From: akpm@linux-foundation.org To: ocfs2-devel@oss.oracle.com, akpm@linux-foundation.org, ghe@suse.com, jiangqi903@gmail.com, jlbec@evilplan.org, junxiao.bi@oracle.com, mfasheh@versity.com, zren@suse.com Message-ID: <5a208507.xhi09A4mNEE9ngDf%akpm@linux-foundation.org> User-Agent: Heirloom mailx 12.5 6/20/10 X-CLX-Shades: MLX X-CLX-Response: 1TFkXGBIZEQpMehcaEQpZTRdnZnIRCllJFxpxGhAadwYYHBlxHhgbEBp3Bhg aBhoRClleF2hjeREKSUYXRVhLSUZPdVpYRU5fSV5DRUQZdU9LEQpDThdwB0NYTUhTTU5YZ2t9TB lLZFxMTF9MeXpeRkhiGlJfXBEKWFwXHwQaBBsbEwcbSBpOGE5LTwUbGgQbGhoEHhIEGxAbHhofG hEKXlkXeHxDR0YRCk1cFxkTHhEKTFoXaWhpTU1dEQpDWhcbHhoEGBsbBBscEwQbGBEKQl4XGxEK RF4XEhEKQkYXZkZJTW1Ab39dQWwRCkJcFxoRCkJFF2t8f2BFGGxzZRpkEQpCThdvb2ViHHIFZmZ eYREKQkwXa3x/YEUYbHNlGmQRCkJsF2t8f2BFGGxzZRpkEQpCQBdmYGgBWU1jaWgccBEKQlgXYn 1veQFPGBlwcHsRClpYFxsRCnBnF2xYXWgfG1J9fx5aEBoRCnBoF2Z/TX4TYF8dX05OEBoRCnBoF 3p5G05lUEJsf19gEBoRCnBoF2F/e3psWVNLWkNPEBoRCnBoF2wdT1pufVwbGnhDEBoRCnBoF2tb b1JFQnAdYxxaEBoRCnBnF2ccWHxLS35nentQEBoRCnBDF2xdYEJ9Q3NebmceEB4SEQptfhcaEQp YTRdLESA= MIME-Version: 1.0 X-PDR: PASS X-ServerName: mail.linuxfoundation.org X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:140.211.169.12/30 include:_spf.google.com ~all X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8731 signatures=668635 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=283 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711300287 Subject: [Ocfs2-devel] [patch 01/11] ocfs2: remove ocfs2_is_o2cb_active() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Virus-Scanned: ClamAV using ClamSMTP From: Gang He Subject: ocfs2: remove ocfs2_is_o2cb_active() 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: https://urldefense.proofpoint.com/v2/url?u=http-3A__lkml.kernel.org_r_1495441079-2D11708-2D1-2Dgit-2Dsend-2Demail-2Dghe-40suse.com&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=C7gAd4uDxlAvTdc0vmU6X8CMk6L2iDY8-HD0qT6Fo7Y&m=rnJPiY1_qJ7_Qs9xIYdLDclkzvGkELwC-r4P43wj1kE&s=4QPFsG8EG4HzXiHfjwTwa9v-sFT2lUoAhvTKPw0gR8Q&e= Signed-off-by: Gang He Reviewed-by: Joseph Qi Reviewed-by: Eric Ren Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Signed-off-by: Andrew Morton Acked-by: Changwei Ge Acked-by: Alex Chen --- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/stackglue.c | 6 ------ fs/ocfs2/stackglue.h | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-) diff -puN fs/ocfs2/dlmglue.c~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function fs/ocfs2/dlmglue.c --- a/fs/ocfs2/dlmglue.c~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function +++ a/fs/ocfs2/dlmglue.c @@ -3413,7 +3413,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; diff -puN fs/ocfs2/stackglue.c~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function fs/ocfs2/stackglue.c --- a/fs/ocfs2/stackglue.c~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function +++ a/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; diff -puN fs/ocfs2/stackglue.h~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function fs/ocfs2/stackglue.h --- a/fs/ocfs2/stackglue.h~ocfs2-get-rid-of-ocfs2_is_o2cb_active-function +++ a/fs/ocfs2/stackglue.h @@ -298,9 +298,6 @@ 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); - extern struct kset *ocfs2_kset; #endif /* STACKGLUE_H */