Goldwyn Rodrigues
2013-Sep-27 17:07 UTC
[Ocfs2-devel] [PATCH 3/7] Differentiate between no_controld and with_controld
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; -- 1.8.1.4 -- Goldwyn
Joel Becker
2013-Sep-27 19:02 UTC
[Ocfs2-devel] [PATCH 3/7] Differentiate between no_controld and with_controld
On Fri, Sep 27, 2013 at 12:07:53PM -0500, Goldwyn Rodrigues wrote:> 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)) {You need to find a way to compare the fs locking protocol in the new style. Otherwise the two ocfs2 versions can't be sure they are using the same locks in the same way. Joel> + 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; > -- > 1.8.1.4 > > > -- > Goldwyn > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel-- "Only a life lived for others is a life worth while." -Albert Einstein http://www.jlbec.org/ jlbec at evilplan.org
Lars Marowsky-Bree
2013-Oct-02 09:49 UTC
[Ocfs2-devel] [PATCH 3/7] Differentiate between no_controld and with_controld
On 2013-09-27T12:07:53, Goldwyn Rodrigues <rgoldwyn at suse.de> wrote:> This is done primarily for backward compatibility. I hope we do > away with this sooner than later ;)I'd actually be quite happy if we could do away with this directly. Users that want to remain on an older user-space code base can always revert this or stick to a stable long-term kernel. That may be an unpopular opinion ;-) The relevant GFS2 commit seems to be http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/gfs2?id=e0c2a9aa1e68455dc3439e95d85cabcaff073666 Regards, Lars -- Architect Storage/HA SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer, HRB 21284 (AG N?rnberg) "Experience is the name everyone gives to their mistakes." -- Oscar Wilde
Goldwyn Rodrigues
2013-Oct-03 01:58 UTC
[Ocfs2-devel] [PATCH 3/7] Differentiate between no_controld and with_controld
On 10/02/2013 04:49 AM, Lars Marowsky-Bree wrote:> On 2013-09-27T12:07:53, Goldwyn Rodrigues <rgoldwyn at suse.de> wrote: > >> This is done primarily for backward compatibility. I hope we do >> away with this sooner than later ;) > > I'd actually be quite happy if we could do away with this directly. > > Users that want to remain on an older user-space code base can always > revert this or stick to a stable long-term kernel. That may be an > unpopular opinion ;-) > > The relevant GFS2 commit seems to be > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/gfs2?id=e0c2a9aa1e68455dc3439e95d85cabcaff073666 > >Just to be complete, the DLM recovery callbacks were introduced in this commit http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/gfs2?id=60f98d1839376d30e13f3e452dce2433fad3060e GFS2 also supports the older controld using DFL_NO_DLM_OPS flag set in the lockspace structure. While I would also like the controld to be done away with: from a maintenance perspective. -- Goldwyn