Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
/ 2004-07-17 12:17:12 +0200 \ Lars Ellenberg: > anyways. snip > KERNEL_SRC=/some/where/linux-2.4.22-1.2135.nptl snap > It is really not THAT difficult, is it. > > :) And there I was wrong... :( / 2004-07-18 01:57:00 +0200 \ Lars Ellenberg: > / 2004-07-16 18:48:05 +0300 > \ drbd-user at kenyaweb.com: > > > > I have kernel-2.4.18-14 ... > > which, btw, probably contains some known security flaws, > since it is dated from somwhen last year ... > redhat update ftp site offers 2.4.20-something for RH-8.0. > since that dates from 2003, still, and there have been kernel > security issues since, I think it should offer even newer. > but I am no RH policy expert, so they may offer their most recent > patches only for 9 and enterprise ? > > anyways, the most recent RH kernel source package > for standard RH seems to be > ftp://ftp.redhat.com/pub/redhat/linux/updates/9/en/os/i386/kernel-source-2.4.20-31.9.i386.rpm > or mirror sites. nearby should be the binary ix86.rpms. > I did no test compile of DRBD against that yet, > but I can do so somewhen in the next days, and resolve compatibility > issues, if there happen to some, still... which I doubt :) well, and I did a test compile against RH 2.4.18-14 right now, ^^^^ and doh. it breaks. now, why is RH always so "special"... one way: update to some RH 2.4.20 or newer. (recommended). other way: apply attached patch (should be in svn soonish). KERNEL_SRC=..../linux-2.4.18-14 DRBD_SRC=..../drbd-0.7.0/drbd cd $KERNEL_SRC make mrproper cp configs/kernel-2.4.18-i386.config .config (or one of the others...) yes "" | make oldconfig ; yes "" | make oldconfig (maybe rather adjust with make menuconfig) make dep (btw, gcc 2.95 and 3.2 seem to both work fine. just use the one which was used to build your kernel. to be sure, recompile and install a new kernel, then you _know_ which compiler was used.) cd $DRBD_SRC patch -p0 < attached-patch make KDIR=$KERNEL_SRC this should now compile without errors. hope that helps. Lars Ellenberg attachments: 8586 patch-drbd-0.7.0-r1439-RH-8.0 (against the tagged drbd-0.7.0 release and .tgz) 2522 patch-drbd-0.7.0-r1441-RH-8.0 (against current subversion trunk) -------------- next part -------------- Index: drbd_receiver.c =================================================================== --- drbd_receiver.c (revision 1438) +++ drbd_receiver.c (working copy) @@ -2013,7 +2013,7 @@ drbd_end_req(req, RQ_DRBD_SENT, 1, sector); - if (mdev->rs_total && + if (mdev->rs_total && mdev->conf.wire_protocol == DRBD_PROT_C) drbd_set_in_sync(mdev,sector,blksize); } Index: Kconfig =================================================================== --- Kconfig (revision 1438) +++ Kconfig (working copy) @@ -2,7 +2,7 @@ # DRBD device driver configuration # config BLK_DEV_DRBD - tristate "Distributed redundant block device support" + tristate "DRBD Distributed replicated block device support" select INET select PROC_FS ---help--- @@ -16,7 +16,8 @@ state, which can be 'primary' or 'secondary'. On the node with the primary device the application is supposed to run and to access the device (/dev/nbX). Every write is sent to the local 'lower level - block device' and to the node with the device in 'secondary' state. + block device' and via network to the node with the device in + 'secondary' state. The secondary device simply writes the data to its lower level block device. Reads are always carried out locally. @@ -26,6 +27,21 @@ If unsure, say N. +config DRBD_MAJOR + int "DRBD device major number" + depends on BLK_DEV_DRBD + range 1 255 + default 43 + ---help--- + Historically DRBD hijacked the NBD major number. + Until we get some number officially assigned to DRBD, + you can choose one here. + Typical values may be 100 or 219. + + See also Documentation/devices.txt + + If unsure, keep the default (43). + comment "DRBD in kernel, no NBD possible" depends on BLK_DEV_DRBD=y Index: drbd_compat_wrappers.h =================================================================== --- drbd_compat_wrappers.h (revision 1438) +++ drbd_compat_wrappers.h (working copy) @@ -6,6 +6,18 @@ #define __module_get __MOD_INC_USE_COUNT #define module_put __MOD_DEC_USE_COUNT +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) +/* + * dump_stack() showed up in 2.4.20. + * show_stack is arch-specific + * The architecture-independent backtrace generator + */ +static inline void dump_stack(void) +{ + show_stack(0); +} +#endif + // b_end_io handlers extern void drbd_md_io_complete (struct buffer_head *bh, int uptodate); extern void enslaved_read_bi_end_io (struct buffer_head *bh, int uptodate); Index: drbd_main.c =================================================================== --- drbd_main.c (revision 1438) +++ drbd_main.c (working copy) @@ -54,6 +54,10 @@ #include <linux/drbd.h> #include "drbd_int.h" +#ifndef CONFIG_DRBD_MAJOR +#define CONFIG_DRBD_MAJOR NBD_MAJOR +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) # if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64) extern int register_ioctl32_conversion(unsigned int cmd, @@ -90,7 +94,7 @@ MODULE_AUTHOR("Philipp Reisner <phil at linbit.com>, Lars Ellenberg <lars at linbit.com>"); MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION); MODULE_LICENSE("GPL"); -MODULE_PARM_DESC(major_nr, "Major nr to use -- default 43 (NBD_MAJOR)"); +MODULE_PARM_DESC(major_nr, "Major nr to use -- default " __stringify(CONFIG_DRBD_MAJOR) ); MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)"); MODULE_PARM_DESC(disable_io_hints, "Necessary if the loopback network device is used for DRBD" ); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) @@ -119,7 +123,7 @@ #endif // module parameter, defined -int major_nr = NBD_MAJOR; +int major_nr = CONFIG_DRBD_MAJOR; #ifdef MODULE int minor_count = 2; #else @@ -128,6 +132,10 @@ // FIXME disable_io_hints shall die int disable_io_hints = 0; +// devfs name +char* drbd_devfs_name = "nbd"; + + // global panic flag volatile int drbd_did_panic = 0; @@ -1578,7 +1586,7 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) devfs_unregister(devfs_handle); #else - devfs_remove(DEVFS_NAME); + devfs_remove(drbd_devfs_name); #endif if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0) @@ -1641,7 +1649,7 @@ #ifdef MODULE return -EINVAL; #else - major_nr = NBD_MAJOR; + major_nr = CONFIG_DRBD_MAJOR; #endif } @@ -1663,6 +1671,8 @@ return err; } + drbd_devfs_name = (major_nr == NBD_MAJOR) ? "nbd" : "drbd"; + /* * allocate all necessary structs */ @@ -1680,7 +1690,7 @@ goto Enomem; #else - devfs_mk_dir(DEVFS_NAME); + devfs_mk_dir(drbd_devfs_name); for (i = 0; i < minor_count; i++) { drbd_dev *mdev = drbd_conf + i; @@ -1703,12 +1713,13 @@ disk->first_minor = i; disk->fops = &drbd_ops; sprintf(disk->disk_name, DEVICE_NAME "%d", i); - sprintf(disk->devfs_name, DEVFS_NAME "/%d", i); + sprintf(disk->devfs_name, "%s/%d", drbd_devfs_name, i); disk->private_data = mdev; add_disk(disk); mdev->this_bdev = bdget(MKDEV(MAJOR_NR,i)); - mdev->this_bdev->bd_contains = mdev->this_bdev; // Hmmm ? + // we have no partitions. we contain only ourselves. + mdev->this_bdev->bd_contains = mdev->this_bdev; if (bd_claim(mdev->this_bdev,drbd_sec_holder)) { // Initial we are Secondary -> should claim myself. WARN("Could not bd_claim() myself."); Index: drbd_int.h =================================================================== --- drbd_int.h (revision 1438) +++ drbd_int.h (working copy) @@ -39,14 +39,41 @@ #include "mempool.h" #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} +#endif + // module parameter, defined in drbd_main.c extern int minor_count; extern int disable_io_hints; extern int major_nr; +// major == nbd_major ? "nbd" : "drbd"; +extern char* drbd_devfs_name; + /* Using the major_nr of the network block device - prevents us from deadlocking with no request entries - left on all_requests... + used to prevent us from deadlocking with no request entries + left on all_requests... those where the days... look out for NBD_MAJOR in ll_rw_blk.c */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) @@ -71,11 +98,6 @@ #undef DEVICE_NAME #define DEVICE_NAME "drbd" -#define DEVFS_NAME "nbd" // This make sense as long as we are MAJOR 43 -/* FIXME we are no longer strictly MAJOR 43. - * so, should this too become "configurable" ? - * or shall we fix it to "drbd" ? - */ // XXX do we need this? #ifndef TRUE Index: drbd_compat_types.h =================================================================== --- drbd_compat_types.h (revision 1441) +++ drbd_compat_types.h (working copy) @@ -21,7 +21,7 @@ for(pos = (head)->next; pos != (head); pos = pos->next) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) && !defined(REDHAT_2_4_18) #define BH_Launder BH_launder #endif Index: linux/drbd_config.h =================================================================== --- linux/drbd_config.h (revision 1441) +++ linux/drbd_config.h (working copy) @@ -35,9 +35,12 @@ //#define SIGHAND_HACK // Needed for RH 2.4.20 and later kernels. //#define REDHAT_HLIST_BACKPORT // Makes DRBD work on RH9 kernels +// Redhat 2.4.18 already includes BH_Launder, +// other 2.4.18 still have BH_launder ... +#define REDHAT_2_4_18 //Your 2.4 verndor kernel already defines find_next_bit() -//#define HAVE_FIND_NEXT_BIT +#define HAVE_FIND_NEXT_BIT //Your 2.4 kernel does not define find_next_bit(), //and you are too lazy to "backport" it from 2.6 for your arch: Index: lru_cache.h =================================================================== --- lru_cache.h (revision 1441) +++ lru_cache.h (working copy) @@ -51,6 +51,15 @@ # include "hlist.h" #endif +#include <linux/version.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION (2,4,20) +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} +#endif + struct lc_element { struct hlist_node colision; struct list_head list; // LRU list or free list -------------- next part -------------- Index: drbd_compat_types.h =================================================================== --- drbd_compat_types.h (revision 1441) +++ drbd_compat_types.h (working copy) @@ -21,7 +21,7 @@ for(pos = (head)->next; pos != (head); pos = pos->next) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) && !defined(REDHAT_2_4_18) #define BH_Launder BH_launder #endif Index: linux/drbd_config.h =================================================================== --- linux/drbd_config.h (revision 1441) +++ linux/drbd_config.h (working copy) @@ -35,9 +35,12 @@ //#define SIGHAND_HACK // Needed for RH 2.4.20 and later kernels. //#define REDHAT_HLIST_BACKPORT // Makes DRBD work on RH9 kernels +// Redhat 2.4.18 already includes BH_Launder, +// other 2.4.18 still have BH_launder ... +#define REDHAT_2_4_18 //Your 2.4 verndor kernel already defines find_next_bit() -//#define HAVE_FIND_NEXT_BIT +#define HAVE_FIND_NEXT_BIT //Your 2.4 kernel does not define find_next_bit(), //and you are too lazy to "backport" it from 2.6 for your arch: Index: drbd_int.h =================================================================== --- drbd_int.h (revision 1441) +++ drbd_int.h (working copy) @@ -39,6 +39,30 @@ #include "mempool.h" #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} +#endif + // module parameter, defined in drbd_main.c extern int minor_count; extern int disable_io_hints; Index: lru_cache.h =================================================================== --- lru_cache.h (revision 1441) +++ lru_cache.h (working copy) @@ -51,6 +51,15 @@ # include "hlist.h" #endif +#include <linux/version.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION (2,4,20) +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} +#endif + struct lc_element { struct hlist_node colision; struct list_head list; // LRU list or free list