OCFS2 LOCAL MOUNT SUPPORT
Sunil Mushran, Nov 22 2006
GOALS
To allow users to mount ocfs2 volume(s) locally without requiring any cluster configuration though should also work if the cluster is setup and is online.
USER INTERACTION
This feature introduces the concept of mount-type with cluster and local as the two options. Users use tunefs.ocfs2 to toggle between the two. mkfs.ocfs2 allows users to specify the mount-type during make with cluster being the default.
# tunefs.ocfs2
usage: tunefs.ocfs2 [-J journal-options] [-L volume-label]
[-M mount-type] [-N number-of-node-slots]
[-qSUvV] device [blocks-count]
# mkfs.ocfs2
usage: mkfs.ocfs2 [-b block-size] [-C cluster-size] [-J journal-options]
[-L volume-label] [-M mount-type] [-N number-of-node-slots]
[-T filesystem-type] [-HFqvV] device [blocks-count]
IMPLEMENTATION
We add a incompat flag OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT in the super block to denote local mounts. The incompat flag automatically prevents older modules/tools from accessing the volume. As the newer modules/tools are aware of this feature, they handle it appropriately.
- mkfs.ocfs2
- Disables cluster check if superblock has OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT set.
- Writes OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT in superblock if asked.
- tunefs.ocfs2
- Disables cluster check if superblock has OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT set.
- Sets/Resets mount type as asked.
- fsck.ocfs2
- Disables cluster check if superblock has OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT set.
- mount.ocfs2 - If superblock has OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT set:
- Does not initialize the cluster.
Does not start the heartbeat and appends heartbeat=none in the mount options.
- ocfs2.ko
Does not check for heartbeat if mounted with heartbeat=none option.
- Fails to mount locally if heartbeat is running.
- Does not launch [ocfs2cmt], [ocfs2vote], [dlm_thread], [dlm_reco_thread] and [dlm_wq] kernel threads / work queues.
- The check to disable cluster locking is not in ocfs2_cluster_lock() and ocfs2_cluster_unlock() but in their calling functions, ocfs2_super_lock, etc.
- The abstract layer where we choke off the cluster locking was chosen based upon the existing hard-read-only implementation. We may want to (re)visit this issue.
PATCHES - ORIGINAL
The patches are being made available for feedback on the implementation till now. These have not been tested fully.... survives kernel builds though.
PATCHES - CURRENT
TODO
- ocfs2_mount_volume() should explicitly handle slot allocation
- The code defaults to slot 0 and was tested to work even with a single dirty slot. Not required.
- ocfs2_stop_heartbeat() should handle local mount case
- Fixed
- Move MOUNT_LOCAL_STR etc to libocfs2 header
- As MOUNT_LOCAL_STR and MOUNT_CLUSTER_STR are tool (tunefs/mkfs) specific strings, I see no need for them to be moved to libocfs2.
- In mkfs, fix incompat != OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT
- Fixed
- In mkfs, fix initial_slots_for_volume to limit number of slots for local mounts
- Fixed
- Enable shared writeable mmap for local mounts
- Fixed
- Remove mount=local mount option.
- Fixed