From 1dfcf0d9f94bcd6c1cb57453112ba56a542560ad Mon Sep 17 00:00:00 2001 From: rread Date: Fri, 24 Oct 2003 18:13:07 +0000 Subject: [PATCH] merge1.sh devel zcfg Resolved conflicts with Tian Ying's recent checkins. Also forced to fix local export cleanup problem by adding an obd_init_export() method. This is called from class_new_export(), and is for devices to initialize their export data. Allos local (as opposed to network) connections to be used and cleaned up correctly. Only mds_init_export() implemented. --- .../patches/dev_read_only_2.6.0.patch | 81 ++++++++++ .../patches/ext3-trusted_ea-2.4.18.patch | 180 +++++++++++++++++++++ .../patches/ext3-trusted_ea-2.4.20.patch | 180 +++++++++++++++++++++ lustre/kernel_patches/patches/listman-2.4.18.patch | 21 +++ lustre/kernel_patches/patches/listman-2.4.20.patch | 22 +++ 5 files changed, 484 insertions(+) create mode 100644 lustre/kernel_patches/patches/dev_read_only_2.6.0.patch create mode 100644 lustre/kernel_patches/patches/ext3-trusted_ea-2.4.18.patch create mode 100644 lustre/kernel_patches/patches/ext3-trusted_ea-2.4.20.patch create mode 100644 lustre/kernel_patches/patches/listman-2.4.18.patch create mode 100644 lustre/kernel_patches/patches/listman-2.4.20.patch diff --git a/lustre/kernel_patches/patches/dev_read_only_2.6.0.patch b/lustre/kernel_patches/patches/dev_read_only_2.6.0.patch new file mode 100644 index 0000000..f0f79df --- /dev/null +++ b/lustre/kernel_patches/patches/dev_read_only_2.6.0.patch @@ -0,0 +1,81 @@ + drivers/block/ll_rw_blk.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ + include/linux/blkdev.h | 1 + 2 files changed, 50 insertions(+) + +--- linux-2.6.0-test6/drivers/block/ll_rw_blk.c~dev_read_only_2.6.0 2003-10-14 19:56:55.000000000 +0400 ++++ linux-2.6.0-test6-alexey/drivers/block/ll_rw_blk.c 2003-10-22 01:35:56.000000000 +0400 +@@ -2213,6 +2213,9 @@ end_io: + + if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) + goto end_io; ++ if (test_bit(QUEUE_FLAG_RDONLY, &q->queue_flags) ++ && bio->bi_rw == WRITE) ++ goto end_io; + + /* + * If this device has partitions, remap block n +@@ -2867,6 +2870,52 @@ void blk_unregister_queue(struct gendisk + } + } + ++#define MAX_RDONLY_DEVS 16 ++ ++static struct block_device *rdonly_devs[MAX_RDONLY_DEVS] = {0, }; ++ ++/* ++ * Debug code for turning block devices "read-only" (will discard writes ++ * silently). This is for filesystem crash/recovery testing. ++ */ ++void dev_set_rdonly(struct block_device *bdev, int no_write) ++{ ++ if (bdev) { ++ request_queue_t *q; ++ ++ q = bdev_get_queue(bdev); ++ if (!q) { ++ printk(KERN_ERR ++ "dev_set_rdonly() for non-existing device\n"); ++ return; ++ } ++ printk(KERN_WARNING "Turning device %s read-only\n", ++ bdev->bd_disk ? bdev->bd_disk->disk_name : "?"); ++ set_bit(QUEUE_FLAG_RDONLY, &q->queue_flags); ++ rdonly_devs[no_write] = bdev; ++ } ++} ++ ++void dev_clear_rdonly(int no_write) ++{ ++ request_queue_t *q; ++ ++ if (rdonly_devs[no_write] == NULL) ++ return; ++ ++ q = bdev_get_queue(rdonly_devs[no_write]); ++ if (!q) { ++ printk(KERN_ERR ++ "dev_clear_rdonly: no queue for device at slot %d\n", ++ no_write); ++ return; ++ } ++ clear_bit(QUEUE_FLAG_RDONLY, &q->queue_flags); ++ rdonly_devs[no_write] = NULL; ++} ++ ++EXPORT_SYMBOL(dev_set_rdonly); ++EXPORT_SYMBOL(dev_clear_rdonly); + + EXPORT_SYMBOL(process_that_request_first); + EXPORT_SYMBOL(end_that_request_first); +--- linux-2.6.0-test6/include/linux/blkdev.h~dev_read_only_2.6.0 2003-10-14 19:57:05.000000000 +0400 ++++ linux-2.6.0-test6-alexey/include/linux/blkdev.h 2003-10-21 23:31:18.000000000 +0400 +@@ -367,6 +367,7 @@ struct request_queue + #define QUEUE_FLAG_READFULL 3 /* write queue has been filled */ + #define QUEUE_FLAG_WRITEFULL 4 /* read queue has been filled */ + #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ ++#define QUEUE_FLAG_RDONLY 6 /* queue accepts reads only */ + + #define blk_queue_plugged(q) !list_empty(&(q)->plug_list) + #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) + +_ diff --git a/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.18.patch b/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.18.patch new file mode 100644 index 0000000..4ee1e2c --- /dev/null +++ b/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.18.patch @@ -0,0 +1,180 @@ + fs/ext3/xattr.c | 12 +++++- + fs/ext3/xattr_trusted.c | 86 +++++++++++++++++++++++++++++++++++++++++++++ + include/linux/ext3_xattr.h | 6 +++ + 3 files changed, 102 insertions(+), 2 deletions(-) + +Index: linux-2.4.18-chaos/fs/ext3/xattr.c +=================================================================== +--- linux-2.4.18-chaos.orig/fs/ext3/xattr.c 2003-10-22 14:23:53.000000000 +0400 ++++ linux-2.4.18-chaos/fs/ext3/xattr.c 2003-10-24 01:01:03.000000000 +0400 +@@ -1789,18 +1789,25 @@ + int __init + init_ext3_xattr(void) + { ++ int error; ++ + ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL, + sizeof(struct mb_cache_entry) + + sizeof(struct mb_cache_entry_index), 1, 61); + if (!ext3_xattr_cache) + return -ENOMEM; + +- return 0; ++ error = init_ext3_xattr_trusted(); ++ if (error) ++ mb_cache_destroy(ext3_xattr_cache); ++ ++ return error; + } + + void + exit_ext3_xattr(void) + { ++ exit_ext3_xattr_trusted(); + if (ext3_xattr_cache) + mb_cache_destroy(ext3_xattr_cache); + ext3_xattr_cache = NULL; +@@ -1811,12 +1818,13 @@ + int __init + init_ext3_xattr(void) + { +- return 0; ++ return init_ext3_xattr_trusted(); + } + + void + exit_ext3_xattr(void) + { ++ exit_ext3_xattr_trusted(); + } + + #endif /* CONFIG_EXT3_FS_XATTR_SHARING */ +Index: linux-2.4.18-chaos/fs/ext3/xattr_trusted.c +=================================================================== +--- linux-2.4.18-chaos.orig/fs/ext3/xattr_trusted.c 2003-10-24 01:01:03.000000000 +0400 ++++ linux-2.4.18-chaos/fs/ext3/xattr_trusted.c 2003-10-24 01:01:03.000000000 +0400 +@@ -0,0 +1,86 @@ ++/* ++ * linux/fs/ext3/xattr_trusted.c ++ * Handler for trusted extended attributes. ++ * ++ * Copyright (C) 2003 by Andreas Gruenbacher, ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define XATTR_TRUSTED_PREFIX "trusted." ++ ++static size_t ++ext3_xattr_trusted_list(char *list, struct inode *inode, ++ const char *name, int name_len) ++{ ++ const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1; ++ ++ if (!capable(CAP_SYS_ADMIN)) ++ return 0; ++ ++ if (list) { ++ memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len); ++ memcpy(list+prefix_len, name, name_len); ++ list[prefix_len + name_len] = '\0'; ++ } ++ return prefix_len + name_len + 1; ++} ++ ++static int ++ext3_xattr_trusted_get(struct inode *inode, const char *name, ++ void *buffer, size_t size) ++{ ++ if (strcmp(name, "") == 0) ++ return -EINVAL; ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, ++ buffer, size); ++} ++ ++static int ++ext3_xattr_trusted_set(struct inode *inode, const char *name, ++ const void *value, size_t size, int flags) ++{ ++ handle_t *handle; ++ int error; ++ ++ if (strcmp(name, "") == 0) ++ return -EINVAL; ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS); ++ if (IS_ERR(handle)) ++ return PTR_ERR(handle); ++ error = ext3_xattr_set(handle, inode, EXT3_XATTR_INDEX_TRUSTED, name, ++ value, size, flags); ++ ext3_journal_stop(handle, inode); ++ ++ return error; ++} ++ ++struct ext3_xattr_handler ext3_xattr_trusted_handler = { ++ .prefix = XATTR_TRUSTED_PREFIX, ++ .list = ext3_xattr_trusted_list, ++ .get = ext3_xattr_trusted_get, ++ .set = ext3_xattr_trusted_set, ++}; ++ ++int __init ++init_ext3_xattr_trusted(void) ++{ ++ return ext3_xattr_register(EXT3_XATTR_INDEX_TRUSTED, ++ &ext3_xattr_trusted_handler); ++} ++ ++void ++exit_ext3_xattr_trusted(void) ++{ ++ ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED, ++ &ext3_xattr_trusted_handler); ++} +Index: linux-2.4.18-chaos/include/linux/ext3_xattr.h +=================================================================== +--- linux-2.4.18-chaos.orig/include/linux/ext3_xattr.h 2003-10-22 14:23:51.000000000 +0400 ++++ linux-2.4.18-chaos/include/linux/ext3_xattr.h 2003-10-24 01:01:03.000000000 +0400 +@@ -19,6 +19,10 @@ + /* Name indexes */ + #define EXT3_XATTR_INDEX_MAX 10 + #define EXT3_XATTR_INDEX_USER 1 ++#define EXT3_XATTR_INDEX_TRUSTED 4 ++#define EXT3_XATTR_INDEX_LUSTRE 5 ++#define EXT3_XATTR_INDEX_SECURITY 6 ++ + + struct ext3_xattr_header { + __u32 h_magic; /* magic number for identification */ +@@ -82,6 +86,9 @@ + extern int init_ext3_xattr(void) __init; + extern void exit_ext3_xattr(void); + ++extern int init_ext3_xattr_trusted(void) __init; ++extern void exit_ext3_xattr_trusted(void); ++ + # else /* CONFIG_EXT3_FS_XATTR */ + # define ext3_setxattr NULL + # define ext3_getxattr NULL +Index: linux-2.4.18-chaos/fs/ext3/Makefile +=================================================================== +--- linux-2.4.18-chaos.orig/fs/ext3/Makefile 2003-10-22 14:23:53.000000000 +0400 ++++ linux-2.4.18-chaos/fs/ext3/Makefile 2003-10-24 01:02:28.000000000 +0400 +@@ -13,7 +13,7 @@ + + obj-y := balloc.o iopen.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ + ioctl.o namei.o super.o symlink.o xattr.o ext3-exports.o \ +- extents.o ++ extents.o xattr_trusted.o + obj-m := $(O_TARGET) + + include $(TOPDIR)/Rules.make diff --git a/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.20.patch b/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.20.patch new file mode 100644 index 0000000..0a3bdb8 --- /dev/null +++ b/lustre/kernel_patches/patches/ext3-trusted_ea-2.4.20.patch @@ -0,0 +1,180 @@ + fs/ext3/xattr.c | 12 +++++- + fs/ext3/xattr_trusted.c | 86 +++++++++++++++++++++++++++++++++++++++++++++ + include/linux/ext3_xattr.h | 6 +++ + 3 files changed, 102 insertions(+), 2 deletions(-) + +Index: linux-2.4.20/fs/ext3/xattr.c +=================================================================== +--- linux-2.4.20.orig/fs/ext3/xattr.c 2003-10-22 02:29:40.000000000 +0400 ++++ linux-2.4.20/fs/ext3/xattr.c 2003-10-24 01:03:22.000000000 +0400 +@@ -1771,18 +1771,25 @@ + int __init + init_ext3_xattr(void) + { ++ int error; ++ + ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL, + sizeof(struct mb_cache_entry) + + sizeof(struct mb_cache_entry_index), 1, 61); + if (!ext3_xattr_cache) + return -ENOMEM; + +- return 0; ++ error = init_ext3_xattr_trusted(); ++ if (error) ++ mb_cache_destroy(ext3_xattr_cache); ++ ++ return error; + } + + void + exit_ext3_xattr(void) + { ++ exit_ext3_xattr_trusted(); + if (ext3_xattr_cache) + mb_cache_destroy(ext3_xattr_cache); + ext3_xattr_cache = NULL; +@@ -1793,12 +1800,13 @@ + int __init + init_ext3_xattr(void) + { +- return 0; ++ return init_ext3_xattr_trusted(); + } + + void + exit_ext3_xattr(void) + { ++ exit_ext3_xattr_trusted(); + } + + #endif /* CONFIG_EXT3_FS_XATTR_SHARING */ +Index: linux-2.4.20/fs/ext3/xattr_trusted.c +=================================================================== +--- linux-2.4.20.orig/fs/ext3/xattr_trusted.c 2003-10-24 01:03:22.000000000 +0400 ++++ linux-2.4.20/fs/ext3/xattr_trusted.c 2003-10-24 01:03:22.000000000 +0400 +@@ -0,0 +1,86 @@ ++/* ++ * linux/fs/ext3/xattr_trusted.c ++ * Handler for trusted extended attributes. ++ * ++ * Copyright (C) 2003 by Andreas Gruenbacher, ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define XATTR_TRUSTED_PREFIX "trusted." ++ ++static size_t ++ext3_xattr_trusted_list(char *list, struct inode *inode, ++ const char *name, int name_len) ++{ ++ const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1; ++ ++ if (!capable(CAP_SYS_ADMIN)) ++ return 0; ++ ++ if (list) { ++ memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len); ++ memcpy(list+prefix_len, name, name_len); ++ list[prefix_len + name_len] = '\0'; ++ } ++ return prefix_len + name_len + 1; ++} ++ ++static int ++ext3_xattr_trusted_get(struct inode *inode, const char *name, ++ void *buffer, size_t size) ++{ ++ if (strcmp(name, "") == 0) ++ return -EINVAL; ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, ++ buffer, size); ++} ++ ++static int ++ext3_xattr_trusted_set(struct inode *inode, const char *name, ++ const void *value, size_t size, int flags) ++{ ++ handle_t *handle; ++ int error; ++ ++ if (strcmp(name, "") == 0) ++ return -EINVAL; ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS); ++ if (IS_ERR(handle)) ++ return PTR_ERR(handle); ++ error = ext3_xattr_set(handle, inode, EXT3_XATTR_INDEX_TRUSTED, name, ++ value, size, flags); ++ ext3_journal_stop(handle, inode); ++ ++ return error; ++} ++ ++struct ext3_xattr_handler ext3_xattr_trusted_handler = { ++ .prefix = XATTR_TRUSTED_PREFIX, ++ .list = ext3_xattr_trusted_list, ++ .get = ext3_xattr_trusted_get, ++ .set = ext3_xattr_trusted_set, ++}; ++ ++int __init ++init_ext3_xattr_trusted(void) ++{ ++ return ext3_xattr_register(EXT3_XATTR_INDEX_TRUSTED, ++ &ext3_xattr_trusted_handler); ++} ++ ++void ++exit_ext3_xattr_trusted(void) ++{ ++ ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED, ++ &ext3_xattr_trusted_handler); ++} +Index: linux-2.4.20/include/linux/ext3_xattr.h +=================================================================== +--- linux-2.4.20.orig/include/linux/ext3_xattr.h 2003-10-22 02:29:39.000000000 +0400 ++++ linux-2.4.20/include/linux/ext3_xattr.h 2003-10-24 01:03:22.000000000 +0400 +@@ -21,6 +21,9 @@ + #define EXT3_XATTR_INDEX_USER 1 + #define EXT3_XATTR_INDEX_POSIX_ACL_ACCESS 2 + #define EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT 3 ++#define EXT3_XATTR_INDEX_TRUSTED 4 ++#define EXT3_XATTR_INDEX_LUSTRE 5 ++#define EXT3_XATTR_INDEX_SECURITY 6 + + struct ext3_xattr_header { + __u32 h_magic; /* magic number for identification */ +@@ -84,6 +87,9 @@ + extern int init_ext3_xattr(void) __init; + extern void exit_ext3_xattr(void); + ++extern int init_ext3_xattr_trusted(void) __init; ++extern void exit_ext3_xattr_trusted(void); ++ + # else /* CONFIG_EXT3_FS_XATTR */ + # define ext3_setxattr NULL + # define ext3_getxattr NULL +Index: linux-2.4.20/fs/ext3/Makefile +=================================================================== +--- linux-2.4.20.orig/fs/ext3/Makefile 2003-10-22 02:29:40.000000000 +0400 ++++ linux-2.4.20/fs/ext3/Makefile 2003-10-24 01:03:47.000000000 +0400 +@@ -12,7 +12,8 @@ + export-objs := ext3-exports.o + + obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \ +- ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o ++ ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o \ ++ xattr_trusted.o + obj-m := $(O_TARGET) + + export-objs += xattr.o diff --git a/lustre/kernel_patches/patches/listman-2.4.18.patch b/lustre/kernel_patches/patches/listman-2.4.18.patch new file mode 100644 index 0000000..37535c09 --- /dev/null +++ b/lustre/kernel_patches/patches/listman-2.4.18.patch @@ -0,0 +1,21 @@ +Index: linux-2.4.18-chaos/include/linux/list.h +=================================================================== +--- linux-2.4.18-chaos.orig/include/linux/list.h 2003-10-22 13:43:39.000000000 +0400 ++++ linux-2.4.18-chaos/include/linux/list.h 2003-10-22 13:44:17.000000000 +0400 +@@ -173,6 +173,16 @@ + for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ + pos = pos->prev, prefetch(pos->prev)) + ++/* 2.5 uses hlists for some things, like the d_hash. we'll treat them ++ * as 2.5 and let macros drop back.. */ ++#define hlist_entry list_entry ++#define hlist_head list_head ++#define hlist_node list_head ++#define HLIST_HEAD LIST_HEAD ++#define INIT_HLIST_HEAD INIT_LIST_HEAD ++#define hlist_del_init list_del_init ++#define hlist_add_head list_add ++#define hlist_for_each_safe list_for_each_safe + + #endif /* __KERNEL__ || _LVM_H_INCLUDE */ + diff --git a/lustre/kernel_patches/patches/listman-2.4.20.patch b/lustre/kernel_patches/patches/listman-2.4.20.patch new file mode 100644 index 0000000..1e4508b --- /dev/null +++ b/lustre/kernel_patches/patches/listman-2.4.20.patch @@ -0,0 +1,22 @@ +Index: linux-2.4.20/include/linux/list.h +=================================================================== +--- linux-2.4.20.orig/include/linux/list.h 2003-10-17 23:56:26.000000000 +0400 ++++ linux-2.4.20/include/linux/list.h 2003-10-22 14:02:22.000000000 +0400 +@@ -227,6 +227,17 @@ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + ++/* 2.5 uses hlists for some things, like the d_hash. we'll treat them ++ * as 2.5 and let macros drop back.. */ ++#define hlist_entry list_entry ++#define hlist_head list_head ++#define hlist_node list_head ++#define HLIST_HEAD LIST_HEAD ++#define INIT_HLIST_HEAD INIT_LIST_HEAD ++#define hlist_del_init list_del_init ++#define hlist_add_head list_add ++#define hlist_for_each_safe list_for_each_safe ++ + #endif /* __KERNEL__ || _LVM_H_INCLUDE */ + + #endif -- 1.8.3.1