Updated cluster log patch (take 3)
Subsystems (3)
Evgeniy, I've added the comments you requested and removed some of the pseudo-kernel-doc style comments that you mentioned.
Agk, I've also gone through dm-log-cluster.c to remove some of the kernel-doc style comments that didn't add any value.
brassow
This patch contains the cluster-aware device-mapper log module.
The log types contained herein ("clustered-disk" and "clustered-core") operate in the same way as their single machine counterparts (dm-log.c), but they are cluster coherent. This is done by forwarding most logging requests to userspace, where a daemon processes the request in an ordered fashion with the rest of the nodes in the cluster. This is necessary to prevent log state corruption. (Imagine if two machines are writing to the same region of a mirror. They would both mark the region dirty, but you need a cluster-aware entity that can handle properly marking the region clean when they are done. Otherwise, you might clear the region when the first machine is done, not the second.)
The structure used for communication between kernel and userspace are located in include/linux/dm-log-cluster.h. Due to the frequency, diversity, and 2-way communication nature of the exchanges between kernel and userspace, 'connector' is used as the interface for communication. One existing userspace implementation of the daemon uses openAIS/corosync in order to communicate with guaranteed ordering and delivery. This daemon, which is capable of coherently managing log state from multiple cluster machines, can be found in the LVM2 code repository. Other implementations of the daemon, with no association to LVM or openAIS/corosync, are certainly possible.
Providing a cluster-aware logging type gives device-mapper RAID1 (and potentially other RAIDs) the ability to operate in a cluster-coherent fashion.
drivers/md/Kconfig +10 -0
@@ -231,6 +231,16 @@ config DM_MIRROR Allow volume managers to mirror logical volumes, also needed for live data migration tools such as 'pvmove'. +config DM_LOG_CLUSTERED + tristate "Mirror cluster logging (EXPERIMENTAL)" + depends on DM_MIRROR && EXPERIMENTAL + select CONNECTOR + ---help--- + The cluster logging module provides a mechanism for + keeping log state coherent amoung a cluster of machines. + Device-mapper mirroring (RAID1) can leverage this log type + to make mirrors that are cluster-aware. + config DM_ZERO tristate "Zero target" depends on BLK_DEV_DM
drivers/md/Makefile +2 -0
@@ -8,6 +8,7 @@ dm-multipath-y += dm-path-selector.o dm- dm-snapshot-y += dm-snap.o dm-exception.o dm-exception-store.o \ dm-snap-transient.o dm-snap-persistent.o dm-mirror-y += dm-raid1.o +dm-log-clustered-y += dm-log-cluster.o dm-log-cluster-transfer.o md-mod-y += md.o bitmap.o raid456-y += raid5.o raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \
@@ -38,6 +39,7 @@ obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o dm-log.o dm-region-hash.o +obj-$(CONFIG_DM_LOG_CLUSTERED) += dm-log-clustered.o obj-$(CONFIG_DM_ZERO) += dm-zero.o quiet_cmd_unroll = UNROLL $@
include/linux/dm-log-cluster.h new file +56 -0
56 lines not on this page · raw message
drivers/md/dm-log-cluster-transfer.c new file +276 -0
276 lines not on this page · raw message
drivers/md/dm-log-cluster-transfer.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright (C) 2006-2009 Red Hat, Inc. +* +* This file is released under the LGPL. +*/ + +#ifndef __DM_LOG_CLUSTER_TRANSFER_H__ +#define __DM_LOG_CLUSTER_TRANSFER_H__ + +#define DM_MSG_PREFIX "dm-log-clustered" + +int dm_clog_tfr_init (void ); +void dm_clog_tfr_exit (void ); +int dm_clog_consult_server (const char *uuid,int request_type, +char *data,size_t data_size, +char *rdata,size_t *rdata_size); + +#endif /* __DM_LOG_CLUSTER_TRANSFER_H__ */
drivers/md/dm-log-cluster.c new file +745 -0
745 lines not on this page · raw message
Documentation/dm-log.txt new file +63 -0
63 lines not on this page · raw message
include/linux/connector.h +3 -1
@@ -41,8 +41,10 @@#define CN_IDX_BB 0x5/* BlackBoard, from the TSP GPL sampling framework */ #define CN_DST_IDX 0x6#define CN_DST_VAL 0x1 +#define CN_IDX_DM 0x7/* Device Mapper */ +#define CN_VAL_DM_CLUSTER_LOG 0x1 -#define CN_NETLINK_USERS 7 +#define CN_NETLINK_USERS 8/* * Maximum connector's message size.
include/linux/Kbuild +1 -0
@@ -57,6 +57,7 @@ header-y += dlmconstants.h header-y += dlm_device.h header-y += dlm_netlink.h header-y += dm-ioctl.h +header-y += dm-log-cluster.h header-y += dn.h header-y += dqblk_xfs.h header-y += efs_fs_sb.h
Alasdair G Kergon
maintainerdrivers/md/Kconfig config DM_MIRROR · line 237
Quoted 1 line · Jon Brassow
drivers/md/Kconfig +1
-0+ select CONNECTOR
Mention this below?
drivers/md/Kconfig config DM_MIRROR · line 240
Quoted 3 lines
drivers/md/Kconfig +3
-0+ ---help--- + The cluster logging module provides a mechanism for + keeping log state coherent amoung a cluster of machines.
Define cluster! i.e. shared storage
Review
Quoted 5 lines
(quoted diff) +3
-0+ Device-mapper mirroring (RAID1) can leverage this log type + to make mirrors that are cluster-aware. + * (DM_CLOG_REQUEST_MASK & request_type) to get the request type
Provide a macro and use it?
Quoted 3 lines
+ * We are reserving 8 bits of the 32-bit '
request_type' field for the
+ * various request types above. The remaining 24-bits can be
+ * reserved for future use and compatibility concerns.
Oughtn't we to require that the remaining bits are set to zero rather than leaving them undefined so they could be used as compatibility flags in future?
drivers/md/dm-log-cluster-transfer.c line 21
Quoted 2 lines
drivers/md/dm-log-cluster-transfer.c new file +2
-0+#define SHORT_UUID (x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x) +static uint32_t seq;
Please use DM_ or dm_ prefixes on most constants, statics, structs, macros etc. outside the body of functions.
And perhaps change seq to avoid confusion with its normal usage (seq_file - see raid5.c for example).
Quoted 1 line
+static
DEFINE_MUTEX(_lock);
Another name that is too generic - what sort of lock? What does the underscore signify?
Also, since this is processing data to/from userspace, can you provide a brief security overview? What limits are there on the data that userspace can supply? E.g. only root can send data because... its maximum length is N because, or its length is unbounded but this is OK because... it is validated in functions X and Y which guarantee addressability & values only within ranges that can be procesed... data sent to userspace is guaranteed not to leak uninitialised or unintended memory contents because... etc.
I'm also seeking documentation of the protocol used:
- Generic info about its format (requests/responses/error-handling etc.)
- Specific info in the .h file next to each of the request types. (Look at dm-ioctl.h for an example of the minimum level of detail I'm asking is documented.)
drivers/md/dm-log-cluster-transfer.c line 54
Quoted 1 line
drivers/md/dm-log-cluster-transfer.c new file +1
-0+ size = sizeof(struct cn_msg) +
size_t ?
Alasdair