diff options
author | Joel Becker <Joel.Becker@oracle.com> | 2008-01-25 20:02:21 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2008-02-06 19:11:29 -0500 |
commit | d24fbcda0c4988322949df3d759f1cfb32b32953 (patch) | |
tree | d8454796d58649126005001472e9dcee8bd557ca /fs/ocfs2/dlm/dlmfs.c | |
parent | 3e6bdf473f489664dac4d7511d26c7ac3dfdc748 (diff) |
ocfs2: Negotiate locking protocol versions.
Currently, when ocfs2 nodes connect via TCP, they advertise their
compatibility level. If the versions do not match, two nodes cannot speak
to each other and they disconnect. As a result, this provides no forward or
backwards compatibility.
This patch implements a simple protocol negotiation at the dlm level by
introducing a major/minor version number scheme for entities that
communicate. Specifically, o2dlm has a major/minor version for interaction
with o2dlm on other nodes, and ocfs2 itself has a major/minor version for
interacting with the filesystem on other nodes.
This will allow rolling upgrades of ocfs2 clusters when changes to the
locking or network protocols can be done in a backwards compatible manner.
In those cases, only the minor number is changed and the negotatied protocol
minor is returned from dlm join. In the far less likely event that a
required protocol change makes backwards compatibility impossible, we simply
bump the major number.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmfs.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmfs.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 6639baab0798..61a000f8524c 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #define MLOG_MASK_PREFIX ML_DLMFS | 60 | #define MLOG_MASK_PREFIX ML_DLMFS |
61 | #include "cluster/masklog.h" | 61 | #include "cluster/masklog.h" |
62 | 62 | ||
63 | #include "ocfs2_lockingver.h" | ||
64 | |||
63 | static const struct super_operations dlmfs_ops; | 65 | static const struct super_operations dlmfs_ops; |
64 | static const struct file_operations dlmfs_file_operations; | 66 | static const struct file_operations dlmfs_file_operations; |
65 | static const struct inode_operations dlmfs_dir_inode_operations; | 67 | static const struct inode_operations dlmfs_dir_inode_operations; |
@@ -70,6 +72,16 @@ static struct kmem_cache *dlmfs_inode_cache; | |||
70 | struct workqueue_struct *user_dlm_worker; | 72 | struct workqueue_struct *user_dlm_worker; |
71 | 73 | ||
72 | /* | 74 | /* |
75 | * This is the userdlmfs locking protocol version. | ||
76 | * | ||
77 | * See fs/ocfs2/dlmglue.c for more details on locking versions. | ||
78 | */ | ||
79 | static const struct dlm_protocol_version user_locking_protocol = { | ||
80 | .pv_major = OCFS2_LOCKING_PROTOCOL_MAJOR, | ||
81 | .pv_minor = OCFS2_LOCKING_PROTOCOL_MINOR, | ||
82 | }; | ||
83 | |||
84 | /* | ||
73 | * decodes a set of open flags into a valid lock level and a set of flags. | 85 | * decodes a set of open flags into a valid lock level and a set of flags. |
74 | * returns < 0 if we have invalid flags | 86 | * returns < 0 if we have invalid flags |
75 | * flags which mean something to us: | 87 | * flags which mean something to us: |
@@ -416,6 +428,7 @@ static int dlmfs_mkdir(struct inode * dir, | |||
416 | struct qstr *domain = &dentry->d_name; | 428 | struct qstr *domain = &dentry->d_name; |
417 | struct dlmfs_inode_private *ip; | 429 | struct dlmfs_inode_private *ip; |
418 | struct dlm_ctxt *dlm; | 430 | struct dlm_ctxt *dlm; |
431 | struct dlm_protocol_version proto = user_locking_protocol; | ||
419 | 432 | ||
420 | mlog(0, "mkdir %.*s\n", domain->len, domain->name); | 433 | mlog(0, "mkdir %.*s\n", domain->len, domain->name); |
421 | 434 | ||
@@ -435,7 +448,7 @@ static int dlmfs_mkdir(struct inode * dir, | |||
435 | 448 | ||
436 | ip = DLMFS_I(inode); | 449 | ip = DLMFS_I(inode); |
437 | 450 | ||
438 | dlm = user_dlm_register_context(domain); | 451 | dlm = user_dlm_register_context(domain, &proto); |
439 | if (IS_ERR(dlm)) { | 452 | if (IS_ERR(dlm)) { |
440 | status = PTR_ERR(dlm); | 453 | status = PTR_ERR(dlm); |
441 | mlog(ML_ERROR, "Error %d could not register domain \"%.*s\"\n", | 454 | mlog(ML_ERROR, "Error %d could not register domain \"%.*s\"\n", |