From patchwork Fri Sep 27 17:07:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 2956331 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0468EBFF0B for ; Fri, 27 Sep 2013 17:08:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD15820274 for ; Fri, 27 Sep 2013 17:08:38 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EAD020272 for ; Fri, 27 Sep 2013 17:08:37 +0000 (UTC) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8RH86rY022608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Sep 2013 17:08:06 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8RH85Ih014161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Sep 2013 17:08:05 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VPbWP-0003nB-8T; Fri, 27 Sep 2013 10:08:05 -0700 Received: from ucsinet22.oracle.com ([156.151.31.94]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VPbWG-0003mu-F7 for ocfs2-devel@oss.oracle.com; Fri, 27 Sep 2013 10:07:56 -0700 Received: from userp1020.oracle.com (userp1020.oracle.com [156.151.31.79]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8RH7tOJ013355 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 27 Sep 2013 17:07:56 GMT Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by userp1020.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8RH7sCb021245 for ; Fri, 27 Sep 2013 17:07:55 GMT Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 49232A52BF for ; Fri, 27 Sep 2013 19:07:54 +0200 (CEST) Date: Fri, 27 Sep 2013 12:07:53 -0500 From: Goldwyn Rodrigues To: ocfs2-devel@oss.oracle.com Message-ID: <20130927170748.GA11716@shrek.lan> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=195.135.220.15 ct-class=R5 ct-vol1=-99 ct-vol2=8 ct-vol3=9 ct-risk=46 ct-spam1=75 ct-spam2=0 ct-bulk=99 rcpts=1 size=4291 X-SPF-Info: NONE::cantor2.suse.de X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=VosaXYGn c=1 sm=1 tr=0 a=uEuDQZVrWKuLCe7byFjfVg==:117 a=uEuDQZVrWKuLCe7byFjfVg==:17 a=LcaDllckn3IA:10 a=QFWGjuK-aZcA:10 a=7SFtLa4N3QQA:10 a=kj9zAlcOel0A:10 a=yPCof4ZbAAAA:8 a=EevuWe1HOG0A:10 a=V9366B6qyKXdwv9hL1QA:9 a=CjuIK1q_8u gA:10 X-Sendmail-CT-Classification: not spam X-Sendmail-CT-RefID: str=0001.0A090206.5245BB6B.0112:SCFSTAT13898897, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Cc: mfasheh@suse.com Subject: [Ocfs2-devel] [PATCH 3/7] Differentiate between no_controld and with_controld 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: acsinet21.oracle.com [141.146.126.237] X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is done primarily for backward compatibility. I hope we do away with this sooner than later ;) --- fs/ocfs2/stack_user.c | 70 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 2d4503b..38c69c8 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c @@ -103,6 +103,11 @@ #define OCFS2_CONTROL_MESSAGE_VERNUM_LEN 2 #define OCFS2_CONTROL_MESSAGE_NODENUM_LEN 8 +enum ocfs2_connection_type { + NO_CONTROLD, + WITH_CONTROLD +}; + /* * ocfs2_live_connection is refcounted because the filesystem and * miscdevice sides can detach in different order. Let's just be safe. @@ -110,6 +115,7 @@ struct ocfs2_live_connection { struct list_head oc_list; struct ocfs2_cluster_connection *oc_conn; + enum ocfs2_connection_type oc_type; }; struct ocfs2_control_private { @@ -199,7 +205,8 @@ static struct ocfs2_live_connection *ocfs2_connection_find(const char *name) * fill_super(), we can't get dupes here. */ static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn, - struct ocfs2_live_connection **c_ret) + struct ocfs2_live_connection **c_ret, + enum ocfs2_connection_type type) { int rc = 0; struct ocfs2_live_connection *c; @@ -210,8 +217,9 @@ static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn, mutex_lock(&ocfs2_control_lock); c->oc_conn = conn; + c->oc_type = type; - if (atomic_read(&ocfs2_control_opened)) + if ((type == NO_CONTROLD) || atomic_read(&ocfs2_control_opened)) list_add(&c->oc_list, &ocfs2_live_connection_list); else { printk(KERN_ERR @@ -833,6 +841,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn) dlm_lockspace_t *fsdlm; struct ocfs2_live_connection *uninitialized_var(control); int rc = 0, ops_rv; + enum ocfs2_connection_type type = NO_CONTROLD; BUG_ON(conn == NULL); @@ -843,38 +852,47 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn) if (rc) goto out; - if (!ops_rv) { - /* DLM lockspace creation with newer new_lockspace successful */ - goto out; - } else if (ops_rv != -EOPNOTSUPP) { + if (ops_rv == -EOPNOTSUPP) { + type = WITH_CONTROLD; + printk(KERN_NOTICE "ocfs2: You seem to be using an older " + "version of dlm_controld and/or ocfs2-tools." + " Please consider upgrading.\n"); + } else if (ops_rv) { rc = ops_rv; goto out; } - conn->cc_lockspace = fsdlm; - printk(KERN_NOTICE "ocfs2: You seem to be using an older version " - "of dlm_controld and/or ocfs2-tools. Please consider " - "upgrading.\n"); - - rc = ocfs2_live_connection_new(conn, &control); + rc = ocfs2_live_connection_new(conn, &control, type); if (rc) goto out; - /* - * running_proto must have been set before we allowed any mounts - * to proceed. - */ - if (fs_protocol_compare(&running_proto, &conn->cc_version)) { - printk(KERN_ERR - "Unable to mount with fs locking protocol version " - "%u.%u because the userspace control daemon has " - "negotiated %u.%u\n", - conn->cc_version.pv_major, conn->cc_version.pv_minor, - running_proto.pv_major, running_proto.pv_minor); - rc = -EPROTO; - user_cluster_disconnect(conn); - goto out; + if (type == WITH_CONTROLD) { + /* + * running_proto must have been set before we allowed any mounts + * to proceed. + */ + if (fs_protocol_compare(&running_proto, &conn->cc_version)) { + printk(KERN_ERR + "Unable to mount with fs locking protocol" + " version %u.%u because the userspace control " + "daemon has negotiated %u.%u\n", + conn->cc_version.pv_major, + conn->cc_version.pv_minor, + running_proto.pv_major, + running_proto.pv_minor); + rc = -EPROTO; + user_cluster_disconnect(conn); + goto out; + } + + rc = dlm_new_lockspace(conn->cc_name, NULL, + DLM_LSFL_FS, DLM_LVB_LEN, + NULL, NULL, NULL, &fsdlm); + if (rc) { + ocfs2_live_connection_drop(control); + goto out; + } } conn->cc_private = control;