diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-12-20 19:49:04 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2008-01-25 18:05:43 -0500 |
commit | 53fc622b9e829c8e632e45ef8c14f054388759c1 (patch) | |
tree | 6b8585ab00312dd798d8087c452393bf6cc0d344 /fs/ocfs2/super.c | |
parent | cf8e06f1a860d8680d6bb4ac8ec7d7724988e46f (diff) |
[PATCH 2/2] ocfs2: cluster aware flock()
Hook up ocfs2_flock(), using the new flock lock type in dlmglue.c. A new
mount option, "localflocks" is added so that users can revert to old
functionality as need be.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 1104f14c3183..4a091f586646 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -153,6 +153,7 @@ enum { | |||
153 | Opt_slot, | 153 | Opt_slot, |
154 | Opt_commit, | 154 | Opt_commit, |
155 | Opt_localalloc, | 155 | Opt_localalloc, |
156 | Opt_localflocks, | ||
156 | Opt_err, | 157 | Opt_err, |
157 | }; | 158 | }; |
158 | 159 | ||
@@ -170,6 +171,7 @@ static match_table_t tokens = { | |||
170 | {Opt_slot, "preferred_slot=%u"}, | 171 | {Opt_slot, "preferred_slot=%u"}, |
171 | {Opt_commit, "commit=%u"}, | 172 | {Opt_commit, "commit=%u"}, |
172 | {Opt_localalloc, "localalloc=%d"}, | 173 | {Opt_localalloc, "localalloc=%d"}, |
174 | {Opt_localflocks, "localflocks"}, | ||
173 | {Opt_err, NULL} | 175 | {Opt_err, NULL} |
174 | }; | 176 | }; |
175 | 177 | ||
@@ -848,6 +850,20 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
848 | if (option >= 0 && (option <= ocfs2_local_alloc_size(sb) * 8)) | 850 | if (option >= 0 && (option <= ocfs2_local_alloc_size(sb) * 8)) |
849 | mopt->localalloc_opt = option; | 851 | mopt->localalloc_opt = option; |
850 | break; | 852 | break; |
853 | case Opt_localflocks: | ||
854 | /* | ||
855 | * Changing this during remount could race | ||
856 | * flock() requests, or "unbalance" existing | ||
857 | * ones (e.g., a lock is taken in one mode but | ||
858 | * dropped in the other). If users care enough | ||
859 | * to flip locking modes during remount, we | ||
860 | * could add a "local" flag to individual | ||
861 | * flock structures for proper tracking of | ||
862 | * state. | ||
863 | */ | ||
864 | if (!is_remount) | ||
865 | mopt->mount_opt |= OCFS2_MOUNT_LOCALFLOCKS; | ||
866 | break; | ||
851 | default: | 867 | default: |
852 | mlog(ML_ERROR, | 868 | mlog(ML_ERROR, |
853 | "Unrecognized mount option \"%s\" " | 869 | "Unrecognized mount option \"%s\" " |
@@ -903,6 +919,9 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
903 | if (osb->local_alloc_size != OCFS2_DEFAULT_LOCAL_ALLOC_SIZE) | 919 | if (osb->local_alloc_size != OCFS2_DEFAULT_LOCAL_ALLOC_SIZE) |
904 | seq_printf(s, ",localalloc=%d", osb->local_alloc_size); | 920 | seq_printf(s, ",localalloc=%d", osb->local_alloc_size); |
905 | 921 | ||
922 | if (opts & OCFS2_MOUNT_LOCALFLOCKS) | ||
923 | seq_printf(s, ",localflocks,"); | ||
924 | |||
906 | return 0; | 925 | return 0; |
907 | } | 926 | } |
908 | 927 | ||