* miscellania
- add pid to ldlm debugging output (4922)
-2004-11-17 Cluster File Systems, Inc. <info@clusterfs.com>
+2004-11-16 Cluster File Systems, Inc. <info@clusterfs.com>
* version 1.2.8
* bug fixes
+ - fix TCP_NODELAY bug, which caused extreme perf regression (5134)
- allocate qswnal tx descriptors singly to avoid fragmentation (4504)
- don't LBUG on obdo_alloc() failure, use OBD_SLAB_ALLOC() (4800)
- fix NULL dereference in /proc/sys/portals/routes (4827)
- return async write errors to application if possible (2248)
- add /proc/sys/portal/memused (bytes allocated by PORTALS_ALLOC)
- print NAL number in %x format (4645)
+ - update barely-supported suse-2.4.21-171 series (4842)
+ - support for sles 9 %post scripts
+ - support for building 2.6 kernel-source packages
+ - support for sles km_* packages
2004-10-07 Cluster File Systems, Inc. <info@clusterfs.com>
* version 1.2.7
dep: .depend
.depend: $(LDISKFS) lvfs-sources
- $(MAKE) $(ARCH_UM) -C $(LINUX) -f $(PWD)/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) -o scripts -o include/config/MARKER _sfdep_$(PWD) _FASTDEP_ALL_SUB_DIRS="$(PWD)"
+ $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX_OBJ) -f $(PWD)/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) -o scripts -o include/config/MARKER _sfdep_$(PWD) _FASTDEP_ALL_SUB_DIRS="$(PWD)"
CLEANFILES = .depend
endif
$(MAKE) sources -C lvfs
modules: lustre_build_version $(DEP) $(LDISKFS) lvfs-sources
- $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX) -f $(PWD)/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o include/config/MARKER $@
+ $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX_OBJ) -f $(PWD)/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o include/config/MARKER $@
endif # MODULES
#
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_BLK_CPQ_DA=m
CONFIG_BLK_CPQ_CISS_DA=m
CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_CPQ_CISS_DA_NEW=m
CONFIG_BLK_DEV_DAC960=m
CONFIG_BLK_DEV_UMEM=m
CONFIG_BLK_DEV_LOOP=y
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC79XX_NEW is not set
+CONFIG_SCSI_DPT_I2O=m
CONFIG_SCSI_ADVANSYS=m
CONFIG_SCSI_IN2000=m
CONFIG_MEGARAID_NEWGEN=y
#
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_BLK_CPQ_DA=m
CONFIG_BLK_CPQ_CISS_DA=m
CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_CPQ_CISS_DA_NEW=m
CONFIG_BLK_DEV_DAC960=m
CONFIG_BLK_DEV_UMEM=m
CONFIG_BLK_DEV_LOOP=y
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC79XX_NEW is not set
+CONFIG_SCSI_DPT_I2O=m
CONFIG_SCSI_ADVANSYS=m
CONFIG_SCSI_IN2000=m
CONFIG_MEGARAID_NEWGEN=y
--- /dev/null
+ fs/ext3/file.c | 4
+ fs/ext3/inode.c | 116 ++++++++++++++++++++++
+ fs/ext3/super.c | 230 +++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/ext3_fs.h | 5
+ include/linux/ext3_fs_sb.h | 10 +
+ 5 files changed, 365 insertions(+)
+
+Index: linux-2.4.21-241/fs/ext3/super.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/super.c 2004-10-04 02:48:16.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/super.c 2004-10-04 02:48:18.000000000 -0400
+@@ -401,6 +401,221 @@
+ }
+ }
+
++#ifdef EXT3_DELETE_THREAD
++/*
++ * Delete inodes in a loop until there are no more to be deleted.
++ * Normally, we run in the background doing the deletes and sleeping again,
++ * and clients just add new inodes to be deleted onto the end of the list.
++ * If someone is concerned about free space (e.g. block allocation or similar)
++ * then they can sleep on s_delete_waiter_queue and be woken up when space
++ * has been freed.
++ */
++int ext3_delete_thread(void *data)
++{
++ struct super_block *sb = data;
++ struct ext3_sb_info *sbi = EXT3_SB(sb);
++ struct task_struct *tsk = current;
++
++ /* Almost like daemonize, but not quite */
++ exit_mm(current);
++ tsk->session = 1;
++ tsk->pgrp = 1;
++ tsk->tty = NULL;
++ exit_files(current);
++ reparent_to_init();
++
++ sprintf(tsk->comm, "kdelext3-%s", kdevname(sb->s_dev));
++ sigfillset(&tsk->blocked);
++
++ /*tsk->flags |= PF_KERNTHREAD;*/
++
++ INIT_LIST_HEAD(&sbi->s_delete_list);
++ wake_up(&sbi->s_delete_waiter_queue);
++ ext3_debug("delete thread on %s started\n", kdevname(sb->s_dev));
++
++ /* main loop */
++ for (;;) {
++ wait_event_interruptible(sbi->s_delete_thread_queue,
++ !list_empty(&sbi->s_delete_list) ||
++ !test_opt(sb, ASYNCDEL));
++ ext3_debug("%s woken up: %lu inodes, %lu blocks\n",
++ tsk->comm,sbi->s_delete_inodes,sbi->s_delete_blocks);
++
++ spin_lock(&sbi->s_delete_lock);
++ if (list_empty(&sbi->s_delete_list)) {
++ clear_opt(sbi->s_mount_opt, ASYNCDEL);
++ memset(&sbi->s_delete_list, 0,
++ sizeof(sbi->s_delete_list));
++ spin_unlock(&sbi->s_delete_lock);
++ ext3_debug("delete thread on %s exiting\n",
++ kdevname(sb->s_dev));
++ wake_up(&sbi->s_delete_waiter_queue);
++ break;
++ }
++
++ while (!list_empty(&sbi->s_delete_list)) {
++ struct inode *inode=list_entry(sbi->s_delete_list.next,
++ struct inode, i_dentry);
++ unsigned long blocks = inode->i_blocks >>
++ (inode->i_blkbits - 9);
++
++ list_del_init(&inode->i_dentry);
++ spin_unlock(&sbi->s_delete_lock);
++ ext3_debug("%s delete ino %lu blk %lu\n",
++ tsk->comm, inode->i_ino, blocks);
++
++ iput(inode);
++
++ spin_lock(&sbi->s_delete_lock);
++ sbi->s_delete_blocks -= blocks;
++ sbi->s_delete_inodes--;
++ }
++ if (sbi->s_delete_blocks != 0 || sbi->s_delete_inodes != 0) {
++ ext3_warning(sb, __FUNCTION__,
++ "%lu blocks, %lu inodes on list?\n",
++ sbi->s_delete_blocks,sbi->s_delete_inodes);
++ sbi->s_delete_blocks = 0;
++ sbi->s_delete_inodes = 0;
++ }
++ spin_unlock(&sbi->s_delete_lock);
++ wake_up(&sbi->s_delete_waiter_queue);
++ }
++
++ return 0;
++}
++
++static void ext3_start_delete_thread(struct super_block *sb)
++{
++ struct ext3_sb_info *sbi = EXT3_SB(sb);
++ int rc;
++
++ spin_lock_init(&sbi->s_delete_lock);
++ init_waitqueue_head(&sbi->s_delete_thread_queue);
++ init_waitqueue_head(&sbi->s_delete_waiter_queue);
++
++ if (!test_opt(sb, ASYNCDEL))
++ return;
++
++ rc = kernel_thread(ext3_delete_thread, sb, CLONE_VM | CLONE_FILES);
++ if (rc < 0)
++ printk(KERN_ERR "EXT3-fs: cannot start delete thread: rc %d\n",
++ rc);
++ else
++ wait_event(sbi->s_delete_waiter_queue, sbi->s_delete_list.next);
++}
++
++static void ext3_stop_delete_thread(struct ext3_sb_info *sbi)
++{
++ if (sbi->s_delete_list.next == 0) /* thread never started */
++ return;
++
++ clear_opt(sbi->s_mount_opt, ASYNCDEL);
++ wake_up(&sbi->s_delete_thread_queue);
++ wait_event(sbi->s_delete_waiter_queue,
++ sbi->s_delete_list.next == 0 && sbi->s_delete_inodes == 0);
++}
++
++/* Instead of playing games with the inode flags, destruction, etc we just
++ * create a new inode locally and put it on a list for the truncate thread.
++ * We need large parts of the inode struct in order to complete the
++ * truncate and unlink, so we may as well just have a real inode to do it.
++ *
++ * If we have any problem deferring the delete, just delete it right away.
++ * If we defer it, we also mark how many blocks it would free, so that we
++ * can keep the statfs data correct, and we know if we should sleep on the
++ * delete thread when we run out of space.
++ */
++static void ext3_delete_inode_thread(struct inode *old_inode)
++{
++ struct ext3_sb_info *sbi = EXT3_SB(old_inode->i_sb);
++ struct ext3_inode_info *nei, *oei = EXT3_I(old_inode);
++ struct inode *new_inode;
++ unsigned long blocks = old_inode->i_blocks >> (old_inode->i_blkbits-9);
++
++ if (is_bad_inode(old_inode)) {
++ clear_inode(old_inode);
++ return;
++ }
++
++ if (!test_opt(old_inode->i_sb, ASYNCDEL) || !sbi->s_delete_list.next)
++ goto out_delete;
++
++ /* We may want to delete the inode immediately and not defer it */
++ if (IS_SYNC(old_inode) || blocks <= EXT3_NDIR_BLOCKS)
++ goto out_delete;
++
++ /* We can't use the delete thread as-is during real orphan recovery,
++ * as we add to the orphan list here, causing ext3_orphan_cleanup()
++ * to loop endlessly. It would be nice to do so, but needs work.
++ */
++ if (oei->i_state & EXT3_STATE_DELETE ||
++ sbi->s_mount_state & EXT3_ORPHAN_FS) {
++ ext3_debug("doing deferred inode %lu delete (%lu blocks)\n",
++ old_inode->i_ino, blocks);
++ goto out_delete;
++ }
++
++ /* We can iget this inode again here, because our caller has unhashed
++ * old_inode, so new_inode will be in a different inode struct.
++ *
++ * We need to ensure that the i_orphan pointers in the other inodes
++ * point at the new inode copy instead of the old one so the orphan
++ * list doesn't get corrupted when the old orphan inode is freed.
++ */
++ down(&sbi->s_orphan_lock);
++
++ sbi->s_mount_state |= EXT3_ORPHAN_FS;
++ new_inode = iget(old_inode->i_sb, old_inode->i_ino);
++ sbi->s_mount_state &= ~EXT3_ORPHAN_FS;
++ if (is_bad_inode(new_inode)) {
++ printk(KERN_WARNING "read bad inode %lu\n", old_inode->i_ino);
++ iput(new_inode);
++ new_inode = NULL;
++ }
++ if (!new_inode) {
++ up(&sbi->s_orphan_lock);
++ ext3_debug("delete inode %lu directly (bad read)\n",
++ old_inode->i_ino);
++ goto out_delete;
++ }
++ J_ASSERT(new_inode != old_inode);
++
++ J_ASSERT(!list_empty(&oei->i_orphan));
++
++ nei = EXT3_I(new_inode);
++ /* Ugh. We need to insert new_inode into the same spot on the list
++ * as old_inode was, to ensure the in-memory orphan list is still
++ * in the same order as the on-disk orphan list (badness otherwise).
++ */
++ nei->i_orphan = oei->i_orphan;
++ nei->i_orphan.next->prev = &nei->i_orphan;
++ nei->i_orphan.prev->next = &nei->i_orphan;
++ nei->i_state |= EXT3_STATE_DELETE;
++ up(&sbi->s_orphan_lock);
++
++ clear_inode(old_inode);
++
++ spin_lock(&sbi->s_delete_lock);
++ J_ASSERT(list_empty(&new_inode->i_dentry));
++ list_add_tail(&new_inode->i_dentry, &sbi->s_delete_list);
++ sbi->s_delete_blocks += blocks;
++ sbi->s_delete_inodes++;
++ spin_unlock(&sbi->s_delete_lock);
++
++ ext3_debug("delete inode %lu (%lu blocks) by thread\n",
++ new_inode->i_ino, blocks);
++
++ wake_up(&sbi->s_delete_thread_queue);
++ return;
++
++out_delete:
++ ext3_delete_inode(old_inode);
++}
++#else
++#define ext3_start_delete_thread(sbi) do {} while(0)
++#define ext3_stop_delete_thread(sbi) do {} while(0)
++#endif /* EXT3_DELETE_THREAD */
++
+ void ext3_put_super (struct super_block * sb)
+ {
+ struct ext3_sb_info *sbi = EXT3_SB(sb);
+@@ -408,6 +623,7 @@
+ kdev_t j_dev = sbi->s_journal->j_dev;
+ int i;
+
++ J_ASSERT(sbi->s_delete_inodes == 0);
+ ext3_xattr_put_super(sb);
+ journal_destroy(sbi->s_journal);
+ if (!(sb->s_flags & MS_RDONLY)) {
+@@ -479,7 +695,11 @@
+ write_inode: ext3_write_inode, /* BKL not held. Don't need */
+ dirty_inode: ext3_dirty_inode, /* BKL not held. We take it */
+ put_inode: ext3_put_inode, /* BKL not held. Don't need */
++#ifdef EXT3_DELETE_THREAD
++ delete_inode: ext3_delete_inode_thread,/* BKL not held. We take it */
++#else
+ delete_inode: ext3_delete_inode, /* BKL not held. We take it */
++#endif
+ put_super: ext3_put_super, /* BKL held */
+ write_super: ext3_write_super, /* BKL held */
+ sync_fs: ext3_sync_fs,
+@@ -557,6 +777,13 @@
+ *mount_flags &= ~MS_POSIXACL;
+ else
+ #endif
++#ifdef EXT3_DELETE_THREAD
++ if (!strcmp(this_char, "asyncdel"))
++ set_opt(*mount_options, ASYNCDEL);
++ else if (!strcmp(this_char, "noasyncdel"))
++ clear_opt(*mount_options, ASYNCDEL);
++ else
++#endif
+ if (!strcmp (this_char, "bsddf"))
+ clear_opt (*mount_options, MINIX_DF);
+ else if (!strcmp (this_char, "nouid32")) {
+@@ -1261,6 +1488,7 @@
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++ ext3_start_delete_thread(sb);
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+@@ -1652,7 +1880,12 @@
+ static int ext3_sync_fs(struct super_block *sb)
+ {
+ tid_t target;
+-
++
++ if (atomic_read(&sb->s_active) == 0) {
++ /* fs is being umounted: time to stop delete thread */
++ ext3_stop_delete_thread(EXT3_SB(sb));
++ }
++
+ sb->s_dirt = 0;
+ target = log_start_commit(EXT3_SB(sb)->s_journal, NULL);
+ log_wait_commit(EXT3_SB(sb)->s_journal, target);
+@@ -1716,6 +1949,9 @@
+ if (!parse_options(data, &tmp, sbi, &mount_flags, &tmp, 1))
+ return -EINVAL;
+
++ if (!test_opt(sb, ASYNCDEL) || (*flags & MS_RDONLY))
++ ext3_stop_delete_thread(sbi);
++
+ if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
+ ext3_abort(sb, __FUNCTION__, "Abort forced by user");
+
+Index: linux-2.4.21-241/fs/ext3/inode.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/inode.c 2004-10-04 02:48:17.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/inode.c 2004-10-04 02:48:18.000000000 -0400
+@@ -2694,6 +2694,118 @@
+ return err;
+ }
+
++#ifdef EXT3_DELETE_THREAD
++/* Move blocks from to-be-truncated inode over to a new inode, and delete
++ * that one from the delete thread instead. This avoids a lot of latency
++ * when truncating large files.
++ *
++ * If we have any problem deferring the truncate, just truncate it right away.
++ * If we defer it, we also mark how many blocks it would free, so that we
++ * can keep the statfs data correct, and we know if we should sleep on the
++ * delete thread when we run out of space.
++ */
++void ext3_truncate_thread(struct inode *old_inode)
++{
++ struct ext3_sb_info *sbi = EXT3_SB(old_inode->i_sb);
++ struct ext3_inode_info *nei, *oei = EXT3_I(old_inode);
++ struct inode *new_inode;
++ handle_t *handle;
++ unsigned long blocks = old_inode->i_blocks >> (old_inode->i_blkbits-9);
++
++ if (!test_opt(old_inode->i_sb, ASYNCDEL) || !sbi->s_delete_list.next)
++ goto out_truncate;
++
++ /* XXX This is a temporary limitation for code simplicity.
++ * We could truncate to arbitrary sizes at some later time.
++ */
++ if (old_inode->i_size != 0)
++ goto out_truncate;
++
++ /* We may want to truncate the inode immediately and not defer it */
++ if (IS_SYNC(old_inode) || blocks <= EXT3_NDIR_BLOCKS ||
++ old_inode->i_size > oei->i_disksize)
++ goto out_truncate;
++
++ /* We can't use the delete thread as-is during real orphan recovery,
++ * as we add to the orphan list here, causing ext3_orphan_cleanup()
++ * to loop endlessly. It would be nice to do so, but needs work.
++ */
++ if (oei->i_state & EXT3_STATE_DELETE ||
++ sbi->s_mount_state & EXT3_ORPHAN_FS) {
++ ext3_debug("doing deferred inode %lu delete (%lu blocks)\n",
++ old_inode->i_ino, blocks);
++ goto out_truncate;
++ }
++
++ ext3_discard_prealloc(old_inode);
++
++ /* old_inode = 1
++ * new_inode = sb + GDT + ibitmap
++ * orphan list = 1 inode/superblock for add, 2 inodes for del
++ * quota files = 2 * EXT3_SINGLEDATA_TRANS_BLOCKS
++ */
++ handle = ext3_journal_start(old_inode, 7);
++ if (IS_ERR(handle))
++ goto out_truncate;
++
++ new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode);
++ if (IS_ERR(new_inode)) {
++ ext3_debug("truncate inode %lu directly (no new inodes)\n",
++ old_inode->i_ino);
++ goto out_journal;
++ }
++
++ nei = EXT3_I(new_inode);
++
++ down_write(&oei->truncate_sem);
++ new_inode->i_size = old_inode->i_size;
++ new_inode->i_blocks = old_inode->i_blocks;
++ new_inode->i_uid = old_inode->i_uid;
++ new_inode->i_gid = old_inode->i_gid;
++ new_inode->i_nlink = 0;
++
++ /* FIXME when we do arbitrary truncates */
++ old_inode->i_blocks = oei->i_file_acl ? old_inode->i_blksize / 512 : 0;
++ old_inode->i_mtime = old_inode->i_ctime = CURRENT_TIME;
++
++ memcpy(nei->i_data, oei->i_data, sizeof(nei->i_data));
++ memset(oei->i_data, 0, sizeof(oei->i_data));
++
++ nei->i_disksize = oei->i_disksize;
++ nei->i_state |= EXT3_STATE_DELETE;
++ up_write(&oei->truncate_sem);
++
++ if (ext3_orphan_add(handle, new_inode) < 0)
++ goto out_journal;
++
++ if (ext3_orphan_del(handle, old_inode) < 0) {
++ ext3_orphan_del(handle, new_inode);
++ iput(new_inode);
++ goto out_journal;
++ }
++
++ ext3_journal_stop(handle, old_inode);
++
++ spin_lock(&sbi->s_delete_lock);
++ J_ASSERT(list_empty(&new_inode->i_dentry));
++ list_add_tail(&new_inode->i_dentry, &sbi->s_delete_list);
++ sbi->s_delete_blocks += blocks;
++ sbi->s_delete_inodes++;
++ spin_unlock(&sbi->s_delete_lock);
++
++ ext3_debug("delete inode %lu (%lu blocks) by thread\n",
++ new_inode->i_ino, blocks);
++
++ wake_up(&sbi->s_delete_thread_queue);
++ return;
++
++out_journal:
++ ext3_journal_stop(handle, old_inode);
++out_truncate:
++ ext3_truncate(old_inode);
++}
++#endif /* EXT3_DELETE_THREAD */
++
+ /*
+ * On success, We end up with an outstanding reference count against
+ * iloc->bh. This _must_ be cleaned up later.
+Index: linux-2.4.21-241/fs/ext3/file.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/file.c 2004-10-04 02:48:13.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/file.c 2004-10-04 02:48:18.000000000 -0400
+@@ -132,7 +132,11 @@
+ };
+
+ struct inode_operations ext3_file_inode_operations = {
++#ifdef EXT3_DELETE_THREAD
++ truncate: ext3_truncate_thread, /* BKL held */
++#else
+ truncate: ext3_truncate, /* BKL held */
++#endif
+ setattr: ext3_setattr, /* BKL held */
+ setxattr: ext3_setxattr, /* BKL held */
+ getxattr: ext3_getxattr, /* BKL held */
+Index: linux-2.4.21-241/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.4.21-241.orig/include/linux/ext3_fs.h 2004-10-04 02:48:17.000000000 -0400
++++ linux-2.4.21-241/include/linux/ext3_fs.h 2004-10-04 02:48:18.000000000 -0400
+@@ -193,6 +193,7 @@
+ */
+ #define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
+ #define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
++#define EXT3_STATE_DELETE 0x00000010 /* deferred delete inode */
+
+ /*
+ * ioctl commands
+@@ -321,6 +322,7 @@
+ #define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
+ #define EXT3_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */
+ #define EXT3_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */
++#define EXT3_MOUNT_ASYNCDEL 0x20000 /* Delayed deletion */
+
+ /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
+ #ifndef _LINUX_EXT2_FS_H
+@@ -699,6 +701,9 @@
+ extern int ext3_change_inode_journal_flag(struct inode *, int);
+ extern void ext3_truncate (struct inode *);
+ extern void ext3_set_inode_flags(struct inode *);
++#ifdef EXT3_DELETE_THREAD
++extern void ext3_truncate_thread(struct inode *inode);
++#endif
+
+ /* ioctl.c */
+ extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
+Index: linux-2.4.21-241/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.4.21-241.orig/include/linux/ext3_fs_sb.h 2004-10-04 02:48:16.000000000 -0400
++++ linux-2.4.21-241/include/linux/ext3_fs_sb.h 2004-10-04 02:48:18.000000000 -0400
+@@ -29,6 +29,8 @@
+
+ #define EXT3_MAX_GROUP_LOADED 8
+
++#define EXT3_DELETE_THREAD
++
+ /*
+ * third extended-fs super-block data in memory
+ */
+@@ -76,6 +78,14 @@
+ struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
+ wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
+ #endif
++#ifdef EXT3_DELETE_THREAD
++ spinlock_t s_delete_lock;
++ struct list_head s_delete_list;
++ unsigned long s_delete_blocks;
++ unsigned long s_delete_inodes;
++ wait_queue_head_t s_delete_thread_queue;
++ wait_queue_head_t s_delete_waiter_queue;
++#endif
+ };
+
+ #endif /* _LINUX_EXT3_FS_SB */
--- /dev/null
+Index: linux-2.4.21-241/arch/um/kernel/Makefile
+===================================================================
+--- linux-2.4.21-241.orig/arch/um/kernel/Makefile 2004-10-03 17:30:07.000000000 -0400
++++ linux-2.4.21-241/arch/um/kernel/Makefile 2004-10-04 02:51:20.000000000 -0400
+@@ -37,7 +37,8 @@
+ export-objs-$(CONFIG_GPROF) += gprof_syms.o
+ export-objs-$(CONFIG_GCOV) += gmon_syms.o
+
+-export-objs = ksyms.o process_kern.o signal_kern.o user_syms.o $(export-objs-y)
++export-objs = ksyms.o process_kern.o signal_kern.o user_syms.o sysrq.o \
++ $(export-objs-y)
+
+ CFLAGS_user_syms.o = -D__AUTOCONF_INCLUDED__ $(DMODULES-y) $(DMODVERSIONS-y) \
+ -I/usr/include -I../include
+Index: linux-2.4.21-241/arch/um/kernel/sysrq.c
+===================================================================
+--- linux-2.4.21-241.orig/arch/um/kernel/sysrq.c 2004-10-03 17:30:07.000000000 -0400
++++ linux-2.4.21-241/arch/um/kernel/sysrq.c 2004-10-04 02:51:20.000000000 -0400
+@@ -86,6 +86,37 @@
+ show_trace((unsigned long *)esp);
+ }
+
++#ifdef CONFIG_MODULES
++extern struct module *module_list;
++extern struct module kernel_module;
++#endif
++
++int is_kernel_text_address(unsigned long addr)
++{
++ int retval = 0;
++#ifdef CONFIG_MODULES
++ struct module *mod;
++#endif
++ if (addr >= (unsigned long) &_stext &&
++ addr <= (unsigned long) &_etext)
++ return 1;
++
++#ifdef CONFIG_MODULES
++ for (mod = module_list; mod != &kernel_module; mod = mod->next) {
++ /* mod_bound tests for addr being inside the vmalloc'ed
++ * module area. Of course it'd be better to test only
++ * for the .text subset... */
++ if (mod_bound(addr, 0, mod)) {
++ retval = 1;
++ break;
++ }
++ }
++#endif
++ return retval;
++}
++
++EXPORT_SYMBOL(is_kernel_text_address);
++
+ /*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+Index: linux-2.4.21-241/arch/i386/kernel/Makefile
+===================================================================
+--- linux-2.4.21-241.orig/arch/i386/kernel/Makefile 2004-10-03 17:31:39.000000000 -0400
++++ linux-2.4.21-241/arch/i386/kernel/Makefile 2004-10-04 02:52:04.000000000 -0400
+@@ -20,7 +20,8 @@
+
+ O_TARGET := kernel.o
+
+-export-objs := mca.o mtrr.o msr.o cpuid.o microcode.o i386_ksyms.o time.o dr_alloc.o
++export-objs := mca.o mtrr.o msr.o cpuid.o microcode.o i386_ksyms.o time.o \
++ traps.o dr_alloc.o
+
+ ifdef CONFIG_X86_SPEEDSTEP_ICH
+ export-objs += speedstep-lib.o
+Index: linux-2.4.21-241/arch/i386/kernel/traps.c
+===================================================================
+--- linux-2.4.21-241.orig/arch/i386/kernel/traps.c 2004-10-04 02:48:05.000000000 -0400
++++ linux-2.4.21-241/arch/i386/kernel/traps.c 2004-10-04 02:51:20.000000000 -0400
+@@ -1339,3 +1339,41 @@
+ cobalt_init();
+ #endif
+ }
++
++#ifdef CONFIG_MODULES
++extern struct module *module_list;
++extern struct module kernel_module;
++#endif
++
++int is_kernel_text_address(unsigned long addr)
++{
++ int retval = 0;
++#ifdef CONFIG_MODULES
++ struct module *mod;
++#endif
++ if (addr >= (unsigned long) &_stext &&
++ addr <= (unsigned long) &_etext);
++ return 1;
++
++#ifdef CONFIG_MODULES
++ for (mod = module_list; mod != &kernel_module; mod = mod->next) {
++ /* mod_bound tests for addr being inside the vmalloc'ed
++ * module area. Of course it'd be better to test only
++ * for the .text subset... */
++ if (mod_bound(addr, 0, mod)) {
++ retval = 1;
++ break;
++ }
++ }
++#endif
++
++ return retval;
++}
++
++int lookup_symbol(unsigned long address, char *buf, int buflen)
++{
++ return -ENOSYS;
++}
++
++EXPORT_SYMBOL_GPL(is_kernel_text_address);
++EXPORT_SYMBOL_GPL(lookup_symbol);
--- /dev/null
+ Documentation/Configure.help | 66 ++
+ arch/alpha/defconfig | 7
+ arch/alpha/kernel/entry.S | 12
+ arch/arm/defconfig | 7
+ arch/arm/kernel/calls.S | 24
+ arch/i386/defconfig | 7
+ arch/ia64/defconfig | 7
+ arch/ia64/kernel/entry.S | 24
+ arch/m68k/defconfig | 7
+ arch/mips/defconfig | 7
+ arch/mips64/defconfig | 7
+ arch/ppc/defconfig | 14
+ arch/ppc64/kernel/misc.S | 2
+ arch/s390/defconfig | 7
+ arch/s390/kernel/entry.S | 24
+ arch/s390x/defconfig | 7
+ arch/s390x/kernel/entry.S | 24
+ arch/s390x/kernel/wrapper32.S | 92 +++
+ arch/sparc/defconfig | 7
+ arch/sparc/kernel/systbls.S | 10
+ arch/sparc64/defconfig | 7
+ arch/sparc64/kernel/systbls.S | 20
+ fs/Config.in | 14
+ fs/Makefile | 3
+ fs/ext2/Makefile | 4
+ fs/ext2/file.c | 5
+ fs/ext2/ialloc.c | 2
+ fs/ext2/inode.c | 34 -
+ fs/ext2/namei.c | 14
+ fs/ext2/super.c | 29
+ fs/ext2/symlink.c | 14
+ fs/ext2/xattr.c | 1212 +++++++++++++++++++++++++++++++++++++++++
+ fs/ext2/xattr_user.c | 103 +++
+ fs/ext3/Makefile | 10
+ fs/ext3/file.c | 5
+ fs/ext3/ialloc.c | 2
+ fs/ext3/inode.c | 35 -
+ fs/ext3/namei.c | 21
+ fs/ext3/super.c | 36 +
+ fs/ext3/symlink.c | 14
+ fs/ext3/xattr.c | 1225 ++++++++++++++++++++++++++++++++++++++++++
+ fs/ext3/xattr_user.c | 111 +++
+ fs/jfs/jfs_xattr.h | 6
+ fs/jfs/xattr.c | 6
+ fs/mbcache.c | 648 ++++++++++++++++++++++
+ include/asm-arm/unistd.h | 2
+ include/asm-ia64/unistd.h | 13
+ include/asm-ppc64/unistd.h | 2
+ include/asm-s390/unistd.h | 15
+ include/asm-s390x/unistd.h | 15
+ include/asm-sparc/unistd.h | 24
+ include/asm-sparc64/unistd.h | 24
+ include/linux/cache_def.h | 15
+ include/linux/errno.h | 4
+ include/linux/ext2_fs.h | 31 -
+ include/linux/ext2_xattr.h | 157 +++++
+ include/linux/ext3_fs.h | 31 -
+ include/linux/ext3_jbd.h | 8
+ include/linux/ext3_xattr.h | 157 +++++
+ include/linux/fs.h | 2
+ include/linux/mbcache.h | 69 ++
+ kernel/ksyms.c | 4
+ mm/vmscan.c | 35 +
+ fs/ext3/ext3-exports.c | 14 +
+ 64 files changed, 4355 insertions(+), 195 deletions(-)
+
+Index: linux-2.4.21-241/Documentation/Configure.help
+===================================================================
+--- linux-2.4.21-241.orig/Documentation/Configure.help 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/Documentation/Configure.help 2004-10-04 02:19:55.000000000 -0400
+@@ -16421,6 +16421,39 @@
+
+ If unsure, say N.
+
++Ext3 extended attributes
++CONFIG_EXT3_FS_XATTR
++ Extended attributes are name:value pairs associated with inodes by
++ the kernel or by users (see the attr(5) manual page, or visit
++ <http://acl.bestbits.at/> for details).
++
++ If unsure, say N.
++
++Ext3 extended attribute block sharing
++CONFIG_EXT3_FS_XATTR_SHARING
++ This options enables code for sharing identical extended attribute
++ blocks among multiple inodes.
++
++ Usually, say Y.
++
++Ext3 extended user attributes
++CONFIG_EXT3_FS_XATTR_USER
++ This option enables extended user attributes on ext3. Processes can
++ associate extended user attributes with inodes to store additional
++ information such as the character encoding of files, etc. (see the
++ attr(5) manual page, or visit <http://acl.bestbits.at/> for details).
++
++ If unsure, say N.
++
++Ext3 trusted extended attributes
++CONFIG_EXT3_FS_XATTR_TRUSTED
++ This option enables extended attributes on ext3 that are accessible
++ (and visible) only to users capable of CAP_SYS_ADMIN. Usually this
++ is only the super user. Trusted extended attributes are meant for
++ implementing system/security services.
++
++ If unsure, say N.
++
+ Journal Block Device support (JBD for ext3) (EXPERIMENTAL)
+ CONFIG_JBD
+ This is a generic journalling layer for block devices. It is
+Index: linux-2.4.21-241/fs/ext3/Makefile
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/Makefile 2004-10-04 02:19:51.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/Makefile 2004-10-04 02:19:55.000000000 -0400
+@@ -9,10 +9,10 @@
+
+ O_TARGET := ext3.o
+
+-export-objs := super.o inode.o
++export-objs := ext3-exports.o
+
+ obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+- ioctl.o namei.o super.o symlink.o hash.o
++ ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o
+ obj-m := $(O_TARGET)
+
+ export-objs += xattr.o
+Index: linux-2.4.21-241/fs/ext3/super.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/super.c 2004-10-04 02:19:51.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/super.c 2004-10-04 02:19:55.000000000 -0400
+@@ -1914,9 +1914,6 @@
+ unregister_filesystem(&ext3_fs_type);
+ }
+
+-EXPORT_SYMBOL(ext3_force_commit);
+-EXPORT_SYMBOL(ext3_bread);
+-
+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
+ MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
+ MODULE_LICENSE("GPL");
+Index: linux-2.4.21-241/fs/ext3/ext3-exports.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/ext3-exports.c 1969-12-31 19:00:00.000000000 -0500
++++ linux-2.4.21-241/fs/ext3/ext3-exports.c 2004-10-04 02:19:55.000000000 -0400
+@@ -0,0 +1,14 @@
++#include <linux/config.h>
++#include <linux/module.h>
++#include <linux/ext3_fs.h>
++#include <linux/ext3_jbd.h>
++#include <linux/ext3_xattr.h>
++
++EXPORT_SYMBOL(ext3_force_commit);
++EXPORT_SYMBOL(ext3_bread);
++EXPORT_SYMBOL(ext3_journal_abort_handle);
++EXPORT_SYMBOL(ext3_xattr_register);
++EXPORT_SYMBOL(ext3_xattr_unregister);
++EXPORT_SYMBOL(ext3_xattr_get);
++EXPORT_SYMBOL(ext3_xattr_list);
++EXPORT_SYMBOL(ext3_xattr_set);
+Index: linux-2.4.21-241/fs/ext3/xattr_trusted.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/xattr_trusted.c 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/xattr_trusted.c 2004-10-04 02:19:55.000000000 -0400
+@@ -50,7 +50,7 @@
+ return -EINVAL;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+- return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
++ return ext3_xattr_set_trans(inode, EXT3_XATTR_INDEX_TRUSTED, name,
+ value, size, flags);
+ }
+
+Index: linux-2.4.21-241/fs/ext3/xattr.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/xattr.c 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/xattr.c 2004-10-04 02:23:13.000000000 -0400
+@@ -785,7 +785,7 @@
+ * don't need to change the reference count. */
+ new_bh = old_bh;
+ get_bh(new_bh);
+- ext3_xattr_cache_insert(new_bh);
++ (void)ext3_xattr_cache_insert(new_bh);
+ } else {
+ /* We need to allocate a new block */
+ int goal = le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->
+@@ -814,7 +814,7 @@
+ memcpy(new_bh->b_data, header, new_bh->b_size);
+ mark_buffer_uptodate(new_bh, 1);
+ unlock_buffer(new_bh);
+- ext3_xattr_cache_insert(new_bh);
++ (void)ext3_xattr_cache_insert(new_bh);
+
+ ext3_xattr_update_super_block(handle, sb);
+ }
+@@ -870,7 +870,7 @@
+ }
+
+ /*
+- * ext3_xattr_set()
++ * ext3_xattr_set_trans()
+ *
+ * Like ext3_xattr_set_handle, but start from an inode. This extended
+ * attribute modification is a filesystem transaction by itself.
+@@ -878,7 +878,7 @@
+ * Returns 0, or a negative error number on failure.
+ */
+ int
+-ext3_xattr_set(struct inode *inode, int name_index, const char *name,
++ext3_xattr_set_trans(struct inode *inode, int name_index, const char *name,
+ const void *value, size_t value_len, int flags)
+ {
+ handle_t *handle;
+@@ -900,6 +900,20 @@
+ return error;
+ }
+
++int
++ext3_xattr_set(handle_t *handle, struct inode *inode, int name_index,
++ const char *name, const void *value, size_t value_len,
++ int flags)
++{
++ int error;
++
++ lock_kernel();
++ error = ext3_xattr_set_handle(handle, inode, name_index, name,
++ value, value_len, flags);
++ unlock_kernel();
++ return error;
++}
++
+ /*
+ * ext3_xattr_delete_inode()
+ *
+Index: linux-2.4.21-241/fs/ext3/xattr_user.c
+===================================================================
+--- linux-2.4.21-241.orig/fs/ext3/xattr_user.c 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/fs/ext3/xattr_user.c 2004-10-04 02:19:55.000000000 -0400
+@@ -70,7 +70,7 @@
+ if (error)
+ return error;
+
+- return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
++ return ext3_xattr_set_trans(inode, EXT3_XATTR_INDEX_USER, name,
+ value, size, flags);
+ }
+
+Index: linux-2.4.21-241/include/linux/errno.h
+===================================================================
+--- linux-2.4.21-241.orig/include/linux/errno.h 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/include/linux/errno.h 2004-10-04 02:19:55.000000000 -0400
+@@ -26,4 +26,8 @@
+
+ #endif
+
++/* Defined for extended attributes */
++#define ENOATTR ENODATA /* No such attribute */
++#define ENOTSUP EOPNOTSUPP /* Operation not supported */
++
+ #endif
+Index: linux-2.4.21-241/include/linux/ext3_xattr.h
+===================================================================
+--- linux-2.4.21-241.orig/include/linux/ext3_xattr.h 2004-10-03 17:37:47.000000000 -0400
++++ linux-2.4.21-241/include/linux/ext3_xattr.h 2004-10-04 02:19:55.000000000 -0400
+@@ -80,8 +80,10 @@
+ extern int ext3_xattr_list(struct inode *, char *, size_t);
+ extern int ext3_xattr_set_handle(handle_t *handle, struct inode *, int,
+ const char *, const void *, size_t, int);
+-extern int ext3_xattr_set(struct inode *, int, const char *, const void *,
++extern int ext3_xattr_set_trans(struct inode *, int, const char *, const void *,
+ size_t, int);
++extern int ext3_xattr_set(handle_t *, struct inode *, int, const char *,
++ const void *, size_t, int);
+
+ extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
+ extern void ext3_xattr_put_super(struct super_block *);
--- /dev/null
+Index: linux-2.4.21-241/arch/i386/kernel/process.c
+===================================================================
+--- linux-2.4.21-241.orig/arch/i386/kernel/process.c 2004-09-09 13:38:51.000000000 -0400
++++ linux-2.4.21-241/arch/i386/kernel/process.c 2004-10-08 16:58:22.000000000 -0400
+@@ -36,6 +36,7 @@
+ #ifdef CONFIG_KDB
+ #include <linux/kdb.h>
+ #endif /* CONFIG_KDB */
++#include <linux/version.h>
+
+ #include <asm/uaccess.h>
+ #include <asm/pgtable.h>
+@@ -768,10 +769,14 @@
+ void show_regs(struct pt_regs * regs)
+ {
+ unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
++ static char buffer[512];
++
++ lookup_symbol(regs->eip, buffer, 512);
+
+ printk("\n");
+ printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
+ printk("EIP: %04x:[<%08lx>] CPU: %d",0xffff & regs->xcs,regs->eip, smp_processor_id());
++ printk("\nEIP is at %s (" UTS_RELEASE ")\n", buffer);
+ if (regs->xcs & 3)
+ printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
+ printk(" EFLAGS: %08lx %s\n",regs->eflags, print_tainted());
+Index: linux-2.4.21-241/arch/i386/kernel/traps.c
+===================================================================
+--- linux-2.4.21-241.orig/arch/i386/kernel/traps.c 2004-10-08 16:58:22.000000000 -0400
++++ linux-2.4.21-241/arch/i386/kernel/traps.c 2004-10-08 16:58:22.000000000 -0400
+@@ -25,6 +25,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/interrupt.h>
+ #include <linux/highmem.h>
++#include <linux/version.h>
+
+ #include <linux/rashooks.h>
+
+@@ -275,7 +276,8 @@
+ {
+ int i;
+ unsigned long addr;
+- unsigned long *prev = NULL;
++ /* static to not take up stackspace; if we race here too bad */
++ static char buffer[512];
+
+ if (!stack)
+ stack = (unsigned long*)&stack;
+@@ -285,17 +287,12 @@
+ while (((long) stack & (THREAD_SIZE-1)) != 0) {
+ addr = *stack++;
+ if (kernel_text_address(addr)) {
+- if (prev)
+- printk(" (%02d)", (stack-prev)*sizeof(*stack));
+- prev = stack;
+- if ((i % 4) == 0)
+- printk("\n ");
+- printk(" [<%08lx>]", addr);
++ lookup_symbol(addr, buffer, 512);
++ printk(" [<%08lx>] %s (0x%p)\n",
++ addr, buffer, stack - 1);
+ i++;
+ }
+ }
+- if (prev)
+- printk(" (%02d)", (stack-prev)*sizeof(*stack));
+ printk("\n");
+ }
+
+@@ -341,12 +338,19 @@
+ printk("Code: <0>\n"); /* tell ksymoops trace ends here */
+ }
+
++#ifdef CONFIG_MK7
++#define ARCHIT "/athlon"
++#else
++#define ARCHIT "/i686"
++#endif
++
+ void show_registers(struct pt_regs *regs)
+ {
+ int i;
+ int in_kernel = 1;
+ unsigned long esp;
+ unsigned short ss;
++ static char buffer[512];
+
+ esp = (unsigned long) (®s->esp);
+ ss = __KERNEL_DS;
+@@ -355,10 +359,13 @@
+ esp = regs->esp;
+ ss = regs->xss & 0xffff;
+ }
++ print_modules();
++ lookup_symbol(regs->eip, buffer, 512);
+ module_oops_tracking_init();
+ kernel_text_address(regs->eip);
+ printk("CPU: %d\nEIP: %04x:[<%08lx>] %s\nEFLAGS: %08lx\n",
+ smp_processor_id(), 0xffff & regs->xcs, regs->eip, print_tainted(), regs->eflags);
++ printk("\nEIP is at %s (" UTS_RELEASE ARCHIT ")\n", buffer);
+ printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
+ regs->eax, regs->ebx, regs->ecx, regs->edx);
+ printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
+@@ -420,6 +427,7 @@
+ (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
+ file = "<bad filename>";
+
++ printk("-----------[ cut here ]------------\n");
+ printk("kernel BUG at %s:%d!\n", file, line);
+
+ no_bug:
+@@ -1370,10 +1378,4 @@
+ return retval;
+ }
+
+-int lookup_symbol(unsigned long address, char *buf, int buflen)
+-{
+- return -ENOSYS;
+-}
+-
+ EXPORT_SYMBOL_GPL(is_kernel_text_address);
+-EXPORT_SYMBOL_GPL(lookup_symbol);
+Index: linux-2.4.21-241/include/linux/kernel.h
+===================================================================
+--- linux-2.4.21-241.orig/include/linux/kernel.h 2004-09-09 13:38:50.000000000 -0400
++++ linux-2.4.21-241/include/linux/kernel.h 2004-10-08 16:58:22.000000000 -0400
+@@ -132,6 +132,9 @@
+
+ extern void dump_stack(void);
+
++extern int lookup_symbol(unsigned long address, char *buffer, int buflen);
++extern void print_modules(void);
++
+ extern char *oops_id;
+
+ #if DEBUG
+Index: linux-2.4.21-241/kernel/Makefile
+===================================================================
+--- linux-2.4.21-241.orig/kernel/Makefile 2004-09-09 13:38:51.000000000 -0400
++++ linux-2.4.21-241/kernel/Makefile 2004-10-08 16:58:22.000000000 -0400
+@@ -11,13 +11,13 @@
+
+ export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o \
+ printk.o cpufreq.o rcupdate.o syscall_ksyms.o fork.o hook.o \
+- rashooks.o module.o
++ rashooks.o module.o kksymoops.o
+
+ obj-y = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
+ module.o exit.o itimer.o info.o time.o softirq.o resource.o \
+ sysctl.o acct.o capability.o ptrace.o timer.o user.o \
+ signal.o sys.o kmod.o context.o rcupdate.o futex.o syscall_ksyms.o \
+- kexec.o
++ kexec.o kksymoops.o
+
+ obj-$(CONFIG_UID16) += uid16.o
+ obj-$(CONFIG_MODULES) += ksyms.o
+Index: linux-2.4.21-241/kernel/kksymoops.c
+===================================================================
+--- linux-2.4.21-241.orig/kernel/kksymoops.c 2004-06-30 15:04:37.000000000 -0400
++++ linux-2.4.21-241/kernel/kksymoops.c 2004-10-08 16:58:22.000000000 -0400
+@@ -0,0 +1,83 @@
++#include <linux/module.h>
++#include <linux/string.h>
++#include <linux/errno.h>
++#include <linux/kernel.h>
++#include <linux/config.h>
++#ifdef CONFIG_KALLSYMS
++#include <linux/kallsyms.h>
++#endif
++
++
++
++int lookup_symbol(unsigned long address, char *buffer, int buflen)
++{
++ struct module *this_mod;
++ unsigned long bestsofar;
++
++ const char *mod_name = NULL, *sec_name = NULL, *sym_name = NULL;
++ unsigned long mod_start,mod_end,sec_start,sec_end,sym_start,sym_end;
++
++ if (!buffer)
++ return -EFAULT;
++
++ if (buflen<256)
++ return -ENOMEM;
++
++ memset(buffer,0,buflen);
++
++#ifdef CONFIG_KALLSYMS
++ if (!kallsyms_address_to_symbol(address,&mod_name,&mod_start,&mod_end,&sec_name,
++ &sec_start, &sec_end, &sym_name, &sym_start, &sym_end)) {
++ /* kallsyms doesn't have a clue; lets try harder */
++ bestsofar = 0;
++ snprintf(buffer,buflen-1,"[unresolved]");
++
++ this_mod = module_list;
++
++ while (this_mod != NULL) {
++ int i;
++ /* walk the symbol list of this module. Only symbols
++ who's address is smaller than the searched for address
++ are relevant; and only if it's better than the best so far */
++ for (i=0; i< this_mod->nsyms; i++)
++ if ((this_mod->syms[i].value<=address) &&
++ (bestsofar<this_mod->syms[i].value)) {
++ snprintf(buffer,buflen-1,"%s [%s] 0x%x",
++ this_mod->syms[i].name,
++ this_mod->name,
++ (unsigned int)(address - this_mod->syms[i].value));
++ bestsofar = this_mod->syms[i].value;
++ }
++ this_mod = this_mod->next;
++ }
++
++ } else { /* kallsyms success */
++ snprintf(buffer,buflen-1,"%s [%s] 0x%x",sym_name,mod_name,(unsigned int)(address-sym_start));
++ }
++#endif
++ return strlen(buffer);
++}
++EXPORT_SYMBOL(lookup_symbol);
++
++static char modlist[4096];
++/* this function isn't smp safe but that's not really a problem; it's called from
++ * oops context only and any locking could actually prevent the oops from going out;
++ * the line that is generated is informational only and should NEVER prevent the real oops
++ * from going out.
++ */
++void print_modules(void)
++{
++ struct module *this_mod;
++ int pos = 0, i;
++ memset(modlist,0,4096);
++
++#ifdef CONFIG_KALLSYMS
++ this_mod = module_list;
++ while (this_mod != NULL) {
++ if (this_mod->name != NULL)
++ pos +=snprintf(modlist+pos,160-pos-1,"%s ",this_mod->name);
++ this_mod = this_mod->next;
++ }
++ printk("%s\n",modlist);
++#endif
++}
kernel/ksyms.c | 1
12 files changed, 558 insertions(+), 128 deletions(-)
-Index: linux-2.4.21-171/fs/dcache.c
+Index: linux-2.4.21-241/fs/dcache.c
===================================================================
---- linux-2.4.21-171.orig/fs/dcache.c 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/fs/dcache.c 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/fs/dcache.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/fs/dcache.c 2004-10-08 17:59:16.000000000 -0400
@@ -186,6 +186,13 @@
spin_unlock(&dcache_lock);
return 0;
}
#define do_switch(x,y) do { \
-Index: linux-2.4.21-171/fs/exec.c
+Index: linux-2.4.21-241/fs/exec.c
===================================================================
---- linux-2.4.21-171.orig/fs/exec.c 2004-02-24 14:03:21.000000000 -0500
-+++ linux-2.4.21-171/fs/exec.c 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/fs/exec.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/fs/exec.c 2004-10-08 17:59:16.000000000 -0400
@@ -113,8 +113,10 @@
struct file * file;
struct nameidata nd;
path_release(&nd);
}
goto out;
-@@ -1148,7 +1155,7 @@
+@@ -1147,7 +1154,7 @@
goto close_fail;
if (!file->f_op->write)
goto close_fail;
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
-Index: linux-2.4.21-171/fs/namei.c
+Index: linux-2.4.21-241/fs/namei.c
===================================================================
---- linux-2.4.21-171.orig/fs/namei.c 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/fs/namei.c 2004-04-03 16:13:23.000000000 -0500
+--- linux-2.4.21-241.orig/fs/namei.c 2004-10-03 17:40:41.000000000 -0400
++++ linux-2.4.21-241/fs/namei.c 2004-10-08 18:00:45.000000000 -0400
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
/* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
* kernel data space before using them..
-@@ -260,10 +267,19 @@
+@@ -274,10 +281,19 @@
* Internal lookup() using the new generic dcache.
* SMP-safe
*/
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
dput(dentry);
-@@ -281,11 +297,15 @@
+@@ -295,11 +311,15 @@
* make sure that nobody added the entry to the dcache in the meantime..
* SMP-safe
*/
down(&dir->i_sem);
/*
* First re-do the cached lookup just in case it was created
-@@ -300,6 +320,9 @@
+@@ -314,6 +334,9 @@
result = ERR_PTR(-ENOMEM);
if (dentry) {
lock_kernel();
result = dir->i_op->lookup(dir, dentry);
unlock_kernel();
if (result)
-@@ -321,6 +344,15 @@
+@@ -335,6 +358,15 @@
dput(result);
result = ERR_PTR(-ENOENT);
}
}
return result;
}
-@@ -332,7 +364,8 @@
+@@ -346,7 +378,8 @@
* Without that kind of total limit, nasty chains of consecutive
* symlinks can cause almost arbitrarily long lookups.
*/
{
int err;
if (current->link_count >= 8)
-@@ -346,10 +379,12 @@
+@@ -360,10 +393,12 @@
current->link_count++;
current->total_link_count++;
UPDATE_ATIME(dentry->d_inode);
path_release(nd);
return -ELOOP;
}
-@@ -448,7 +483,8 @@
+@@ -462,7 +497,8 @@
* We expect 'base' to be positive and a directory.
*/
static inline int __attribute__((always_inline))
{
struct dentry *dentry;
struct inode *inode;
-@@ -525,12 +561,12 @@
+@@ -539,12 +575,12 @@
break;
}
/* This does the actual lookups.. */
err = PTR_ERR(dentry);
if (IS_ERR(dentry))
break;
-@@ -548,7 +584,7 @@
+@@ -562,7 +598,7 @@
goto out_dput;
if (inode->i_op->follow_link) {
dput(dentry);
if (err)
goto return_err;
-@@ -564,7 +600,7 @@
+@@ -578,7 +614,7 @@
nd->dentry = dentry;
}
err = -ENOTDIR;
break;
continue;
/* here ends the main loop */
-@@ -591,12 +627,12 @@
+@@ -605,12 +641,12 @@
if (err < 0)
break;
}
err = PTR_ERR(dentry);
if (IS_ERR(dentry))
break;
-@@ -606,7 +642,7 @@
+@@ -620,7 +656,7 @@
inode = dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) {
dput(dentry);
if (err)
goto return_err;
-@@ -620,7 +656,8 @@
+@@ -634,7 +670,8 @@
goto no_inode;
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
break;
}
goto return_base;
-@@ -644,6 +681,25 @@
+@@ -658,6 +695,34 @@
* Check the cached dentry for staleness.
*/
dentry = nd->dentry;
+ dput(dentry);
+ nd->dentry = new;
+ }
++ if (!nd->dentry->d_inode)
++ goto no_inode;
++ if (lookup_flags & LOOKUP_DIRECTORY) {
++ err = -ENOTDIR;
++ if (!nd->dentry->d_inode->i_op ||
++ (!nd->dentry->d_inode->i_op->lookup &&
++ !nd->dentry->d_inode->i_op->lookup_it))
++ break;
++ }
+ } else
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
err = -ESTALE;
if (!dentry->d_op->d_revalidate(dentry, lookup_flags & LOOKUP_PARENT)) {
-@@ -657,6 +713,8 @@
+@@ -671,6 +736,8 @@
dput(dentry);
break;
}
path_release(nd);
return_err:
return err;
-@@ -664,13 +722,13 @@
+@@ -678,13 +745,13 @@
- int link_path_walk(const char * name, struct nameidata *nd)
+ int FASTCALL(link_path_walk(const char * name, struct nameidata *nd))
{
- return __link_path_walk(name,nd);
+ return __link_path_walk_it(name, nd, NULL);
+ return __link_path_walk_it(name, nd, NULL);
}
- int path_walk(const char * name, struct nameidata *nd)
-@@ -678,6 +736,12 @@
+ int FASTCALL(path_walk(const char * name, struct nameidata *nd))
+@@ -692,6 +759,12 @@
return __path_walk(name, nd);
}
/* SMP-safe */
/* returns 1 if everything is done */
static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
-@@ -760,6 +824,17 @@
+@@ -774,6 +847,17 @@
}
/* SMP-safe */
+
+
+/* SMP-safe */
- int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
+ int FASTCALL(path_lookup(const char *path, unsigned flags, struct nameidata *nd))
{
int error = 0;
-@@ -774,6 +849,7 @@
+@@ -788,6 +872,7 @@
{
nd->last_type = LAST_ROOT; /* if there are only slashes... */
nd->flags = flags;
if (*name=='/')
return walk_init_root(name,nd);
read_lock(¤t->fs->lock);
-@@ -788,7 +864,8 @@
+@@ -802,7 +887,8 @@
* needs parent already locked. Doesn't follow mounts.
* SMP-safe.
*/
{
struct dentry * dentry;
struct inode *inode;
-@@ -811,13 +888,16 @@
+@@ -825,13 +911,16 @@
goto out;
}
dentry = inode->i_op->lookup(inode, new);
unlock_kernel();
if (!dentry)
-@@ -829,6 +909,12 @@
+@@ -843,6 +932,12 @@
return dentry;
}
/* SMP-safe */
struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
{
-@@ -850,7 +936,7 @@
+@@ -864,7 +959,7 @@
}
this.hash = end_name_hash(hash);
access:
return ERR_PTR(-EACCES);
}
-@@ -881,6 +967,23 @@
+@@ -895,6 +990,23 @@
return err;
}
-+int __user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
-+ struct lookup_intent *it)
++int FASTCALL(__user_walk_it(const char *name, unsigned flags, struct nameidata *nd,
++ struct lookup_intent *it))
+{
+ char *tmp;
+ int err;
/*
* It's inline, so penalty for filesystems that don't use sticky bit is
* minimal.
-@@ -978,7 +1081,8 @@
+@@ -992,7 +1104,8 @@
return retval;
}
{
int error;
-@@ -991,12 +1095,15 @@
+@@ -1005,12 +1118,15 @@
goto exit_lock;
error = -EACCES; /* shouldn't it be ENOSYS? */
unlock_kernel();
exit_lock:
up(&dir->i_zombie);
-@@ -1005,6 +1112,11 @@
+@@ -1019,6 +1135,11 @@
return error;
}
/*
* open_namei()
*
-@@ -1019,7 +1131,8 @@
+@@ -1033,7 +1154,8 @@
* for symlinks (where the permissions are checked later).
* SMP-safe
*/
{
int acc_mode, error = 0;
struct inode *inode;
-@@ -1029,11 +1142,14 @@
+@@ -1043,11 +1165,14 @@
acc_mode = ACC_MODE(flag);
if (error)
return error;
dentry = nd->dentry;
-@@ -1043,6 +1159,10 @@
+@@ -1057,6 +1182,10 @@
/*
* Create - we need to know the parent.
*/
error = path_lookup(pathname, LOOKUP_PARENT, nd);
if (error)
return error;
-@@ -1058,7 +1178,7 @@
+@@ -1072,7 +1201,7 @@
dir = nd->dentry;
down(&dir->d_inode->i_sem);
do_last:
error = PTR_ERR(dentry);
-@@ -1067,11 +1187,12 @@
+@@ -1081,11 +1210,12 @@
goto exit;
}
up(&dir->d_inode->i_sem);
#ifndef DENTRY_WASTE_RAM
if (error)
-@@ -1179,7 +1300,7 @@
+@@ -1193,7 +1323,7 @@
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1191,8 +1312,10 @@
+@@ -1205,8 +1335,10 @@
return 0;
exit_dput:
path_release(nd);
return error;
-@@ -1211,7 +1334,10 @@
+@@ -1225,7 +1357,10 @@
* are done. Procfs-like symlinks just set LAST_BIND.
*/
UPDATE_ATIME(dentry->d_inode);
dput(dentry);
if (error)
return error;
-@@ -1233,13 +1359,20 @@
+@@ -1247,13 +1382,20 @@
}
dir = nd->dentry;
down(&dir->d_inode->i_sem);
{
struct dentry *dentry;
-@@ -1247,7 +1380,7 @@
+@@ -1261,7 +1403,7 @@
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
if (IS_ERR(dentry))
goto fail;
if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1303,7 +1436,16 @@
+@@ -1317,7 +1459,20 @@
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
- dentry = lookup_create(&nd, 0);
+
++ if (nd.last_type != LAST_NORM) {
++ error = -EEXIST;
++ goto out2;
++ }
+ if (nd.dentry->d_inode->i_op->mknod_raw) {
+ struct inode_operations *op = nd.dentry->d_inode->i_op;
+ error = op->mknod_raw(&nd, mode, dev);
error = PTR_ERR(dentry);
if (!IS_POSIXACL(nd.dentry->d_inode))
-@@ -1325,6 +1467,7 @@
+@@ -1339,6 +1494,7 @@
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1372,7 +1515,14 @@
+@@ -1386,7 +1542,18 @@
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
- dentry = lookup_create(&nd, 1);
++ if (nd.last_type != LAST_NORM) {
++ error = -EEXIST;
++ goto out2;
++ }
+ if (nd.dentry->d_inode->i_op->mkdir_raw) {
+ struct inode_operations *op = nd.dentry->d_inode->i_op;
+ error = op->mkdir_raw(&nd, mode);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
if (!IS_POSIXACL(nd.dentry->d_inode))
-@@ -1381,6 +1531,7 @@
+@@ -1395,6 +1562,7 @@
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1481,8 +1632,16 @@
+@@ -1495,8 +1663,16 @@
error = -EBUSY;
goto exit1;
}
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1540,8 +1699,15 @@
+@@ -1554,8 +1730,15 @@
error = -EISDIR;
if (nd.last_type != LAST_NORM)
goto exit1;
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */
-@@ -1608,15 +1774,23 @@
+@@ -1622,15 +1805,27 @@
error = path_lookup(to, LOOKUP_PARENT, &nd);
if (error)
goto out;
- dentry = lookup_create(&nd, 0);
++ if (nd.last_type != LAST_NORM) {
++ error = -EEXIST;
++ goto out2;
++ }
+ if (nd.dentry->d_inode->i_op->symlink_raw) {
+ struct inode_operations *op = nd.dentry->d_inode->i_op;
+ error = op->symlink_raw(&nd, from);
putname(to);
}
putname(from);
-@@ -1692,7 +1866,14 @@
+@@ -1706,7 +1901,18 @@
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
goto out_release;
- new_dentry = lookup_create(&nd, 0);
++ if (nd.last_type != LAST_NORM) {
++ error = -EEXIST;
++ goto out_release;
++ }
+ if (nd.dentry->d_inode->i_op->link_raw) {
+ struct inode_operations *op = nd.dentry->d_inode->i_op;
+ error = op->link_raw(&old_nd, &nd);
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
-@@ -1736,7 +1917,7 @@
+@@ -1750,7 +1956,7 @@
* locking].
*/
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
struct inode *target;
-@@ -1815,7 +1996,7 @@
+@@ -1829,7 +2035,7 @@
}
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
-@@ -1903,9 +2084,18 @@
+@@ -1917,9 +2123,18 @@
if (newnd.last_type != LAST_NORM)
goto exit2;
error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry))
goto exit3;
-@@ -1921,16 +2111,16 @@
+@@ -1935,16 +2150,16 @@
if (newnd.last.name[newnd.last.len])
goto exit4;
}
dput(new_dentry);
exit4:
dput(old_dentry);
-@@ -1981,20 +2171,26 @@
+@@ -1995,20 +2210,26 @@
}
static inline int __attribute__((always_inline))
out:
if (current->link_count || res || nd->last_type!=LAST_NORM)
return res;
-@@ -2018,7 +2214,13 @@
+@@ -2032,7 +2253,13 @@
int vfs_follow_link(struct nameidata *nd, const char *link)
{
}
/* get the link contents into pagecache */
-@@ -2060,7 +2262,7 @@
+@@ -2074,7 +2301,7 @@
{
struct page *page = NULL;
char *s = page_getlink(dentry, &page);
if (page) {
kunmap(page);
page_cache_release(page);
-Index: linux-2.4.21-171/fs/namespace.c
+Index: linux-2.4.21-241/fs/namespace.c
===================================================================
---- linux-2.4.21-171.orig/fs/namespace.c 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/fs/namespace.c 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/fs/namespace.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/fs/namespace.c 2004-10-08 17:59:16.000000000 -0400
@@ -98,6 +98,7 @@
{
old_nd->dentry = mnt->mnt_mountpoint;
path_release(&new_nd);
out0:
unlock_kernel();
-Index: linux-2.4.21-171/fs/open.c
+Index: linux-2.4.21-241/fs/open.c
===================================================================
---- linux-2.4.21-171.orig/fs/open.c 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/fs/open.c 2004-04-03 16:09:50.000000000 -0500
-@@ -19,6 +19,8 @@
+--- linux-2.4.21-241.orig/fs/open.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/fs/open.c 2004-10-08 17:59:16.000000000 -0400
+@@ -20,6 +20,8 @@
#include <asm/uaccess.h>
#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
int vfs_statfs(struct super_block *sb, struct statfs *buf)
{
-@@ -95,9 +97,10 @@
+@@ -96,9 +98,10 @@
write_unlock(&files->file_lock);
}
int error;
struct iattr newattrs;
-@@ -109,7 +112,13 @@
+@@ -110,7 +113,13 @@
down(&inode->i_sem);
newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
up(&inode->i_sem);
up_write(&inode->i_alloc_sem);
return error;
-@@ -120,12 +129,13 @@
+@@ -121,12 +130,13 @@
struct nameidata nd;
struct inode * inode;
int error;
if (error)
goto out;
inode = nd.dentry->d_inode;
-@@ -165,11 +175,13 @@
+@@ -166,11 +176,13 @@
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
path_release(&nd);
out:
return error;
-@@ -217,7 +229,7 @@
+@@ -218,7 +230,7 @@
error = locks_verify_truncate(inode, file, length);
if (!error)
out_putf:
fput(file);
out:
-@@ -262,11 +274,13 @@
+@@ -263,11 +275,13 @@
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -281,11 +295,25 @@
+@@ -282,11 +296,25 @@
goto dput_and_out;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
error = notify_change(nd.dentry, &newattrs);
dput_and_out:
path_release(&nd);
-@@ -306,12 +334,14 @@
+@@ -307,12 +335,14 @@
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -326,7 +356,20 @@
+@@ -327,7 +357,20 @@
newattrs.ia_atime = times[0].tv_sec;
newattrs.ia_mtime = times[1].tv_sec;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
if (current->fsuid != inode->i_uid &&
(error = permission(inode,MAY_WRITE)) != 0)
goto dput_and_out;
-@@ -349,6 +392,7 @@
+@@ -350,6 +393,7 @@
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res;
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
-@@ -366,13 +410,14 @@
+@@ -367,13 +411,14 @@
else
current->cap_effective = current->cap_permitted;
path_release(&nd);
}
-@@ -387,8 +432,9 @@
+@@ -388,8 +433,9 @@
{
int error;
struct nameidata nd;
if (error)
goto out;
-@@ -399,6 +445,7 @@
+@@ -400,6 +446,7 @@
set_fs_pwd(current->fs, nd.mnt, nd.dentry);
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -438,9 +485,10 @@
+@@ -439,9 +486,10 @@
{
int error;
struct nameidata nd;
if (error)
goto out;
-@@ -456,39 +504,56 @@
+@@ -457,39 +505,56 @@
set_fs_altroot();
error = 0;
dput_and_out:
fput(file);
out:
return err;
-@@ -497,30 +562,14 @@
+@@ -498,30 +563,14 @@
asmlinkage long sys_chmod(const char * filename, mode_t mode)
{
struct nameidata nd;
path_release(&nd);
out:
return error;
-@@ -540,6 +589,20 @@
+@@ -541,6 +590,20 @@
error = -EROFS;
if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
-@@ -644,6 +707,7 @@
+@@ -645,6 +708,7 @@
{
int namei_flags, error;
struct nameidata nd;
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -651,14 +715,15 @@
+@@ -652,14 +716,15 @@
if (namei_flags & O_TRUNC)
namei_flags |= 2;
{
struct file * f;
struct inode *inode;
-@@ -686,7 +751,9 @@
+@@ -687,7 +752,9 @@
file_move(f, &inode->i_sb->s_files);
if (f->f_op && f->f_op->open) {
if (error)
goto cleanup_all;
}
-@@ -698,6 +765,7 @@
+@@ -699,6 +766,7 @@
!inode->i_mapping->a_ops->direct_IO))
goto cleanup_all;
return f;
cleanup_all:
-@@ -710,11 +778,17 @@
+@@ -711,11 +779,17 @@
cleanup_file:
put_filp(f);
cleanup_dentry:
/*
* Find an empty file descriptor entry, and mark it busy.
*/
-Index: linux-2.4.21-171/fs/stat.c
+Index: linux-2.4.21-241/fs/stat.c
===================================================================
---- linux-2.4.21-171.orig/fs/stat.c 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/fs/stat.c 2004-04-03 16:09:50.000000000 -0500
-@@ -17,10 +17,14 @@
+--- linux-2.4.21-241.orig/fs/stat.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/fs/stat.c 2004-10-08 17:59:16.000000000 -0400
+@@ -17,10 +17,12 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
static __inline__ int
{
struct inode * inode = dentry->d_inode;
- if (inode->i_op && inode->i_op->revalidate)
-+ if (!inode)
-+ return -ENOENT;
+ if (inode->i_op && inode->i_op->revalidate_it)
+ return inode->i_op->revalidate_it(dentry, it);
+ else if (inode->i_op && inode->i_op->revalidate)
return inode->i_op->revalidate(dentry);
return 0;
}
-@@ -141,13 +145,15 @@
+@@ -141,13 +143,15 @@
asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -157,13 +163,15 @@
+@@ -157,13 +161,15 @@
asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -178,13 +186,15 @@
+@@ -178,13 +184,15 @@
asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -195,13 +205,15 @@
+@@ -195,13 +203,15 @@
asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -222,7 +234,7 @@
+@@ -222,7 +232,7 @@
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_old_stat(dentry->d_inode, statbuf);
fput(f);
-@@ -241,7 +253,7 @@
+@@ -241,7 +251,7 @@
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_new_stat(dentry->d_inode, statbuf);
fput(f);
-@@ -263,7 +275,7 @@
+@@ -263,7 +273,7 @@
error = -EINVAL;
if (inode->i_op && inode->i_op->readlink &&
UPDATE_ATIME(inode);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
-@@ -339,12 +351,14 @@
+@@ -339,12 +349,14 @@
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -354,12 +368,14 @@
+@@ -354,12 +366,14 @@
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -374,7 +390,7 @@
+@@ -374,7 +388,7 @@
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_new_stat64(dentry->d_inode, statbuf);
fput(f);
-Index: linux-2.4.21-171/include/linux/dcache.h
+Index: linux-2.4.21-241/include/linux/dcache.h
===================================================================
---- linux-2.4.21-171.orig/include/linux/dcache.h 2004-03-31 14:58:26.000000000 -0500
-+++ linux-2.4.21-171/include/linux/dcache.h 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/include/linux/dcache.h 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/include/linux/dcache.h 2004-10-08 17:59:16.000000000 -0400
@@ -7,6 +7,51 @@
#include <linux/gdb.h>
#include <linux/mount.h>
extern spinlock_t dcache_lock;
-Index: linux-2.4.21-171/include/linux/fs.h
+Index: linux-2.4.21-241/include/linux/fs.h
===================================================================
---- linux-2.4.21-171.orig/include/linux/fs.h 2004-04-03 16:07:40.000000000 -0500
-+++ linux-2.4.21-171/include/linux/fs.h 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/include/linux/fs.h 2004-10-08 17:59:14.000000000 -0400
++++ linux-2.4.21-241/include/linux/fs.h 2004-10-08 17:59:16.000000000 -0400
@@ -74,6 +74,7 @@
#define FMODE_READ 1
extern int page_readlink(struct dentry *, char *, int);
extern int page_follow_link(struct dentry *, struct nameidata *);
extern struct inode_operations page_symlink_inode_operations;
-Index: linux-2.4.21-171/include/linux/fs_struct.h
+Index: linux-2.4.21-241/include/linux/fs_struct.h
===================================================================
---- linux-2.4.21-171.orig/include/linux/fs_struct.h 2004-02-24 13:42:29.000000000 -0500
-+++ linux-2.4.21-171/include/linux/fs_struct.h 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/include/linux/fs_struct.h 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/include/linux/fs_struct.h 2004-10-08 17:59:16.000000000 -0400
@@ -34,10 +34,12 @@
write_lock(&fs->lock);
old_root = fs->root;
dput(old_pwd);
mntput(old_pwdmnt);
}
-Index: linux-2.4.21-171/kernel/exit.c
+Index: linux-2.4.21-241/kernel/exit.c
===================================================================
---- linux-2.4.21-171.orig/kernel/exit.c 2004-02-24 14:03:21.000000000 -0500
-+++ linux-2.4.21-171/kernel/exit.c 2004-04-03 16:09:50.000000000 -0500
+--- linux-2.4.21-241.orig/kernel/exit.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/kernel/exit.c 2004-10-08 17:59:16.000000000 -0400
@@ -292,11 +292,14 @@
{
/* No need to hold fs->lock if we are killing it */
dput(fs->altroot);
mntput(fs->altrootmnt);
}
-Index: linux-2.4.21-171/kernel/fork.c
+Index: linux-2.4.21-241/kernel/fork.c
===================================================================
---- linux-2.4.21-171.orig/kernel/fork.c 2004-02-24 14:03:21.000000000 -0500
-+++ linux-2.4.21-171/kernel/fork.c 2004-04-03 16:09:50.000000000 -0500
-@@ -467,10 +467,13 @@
+--- linux-2.4.21-241.orig/kernel/fork.c 2004-10-03 17:38:59.000000000 -0400
++++ linux-2.4.21-241/kernel/fork.c 2004-10-08 17:59:16.000000000 -0400
+@@ -466,10 +466,13 @@
fs->umask = old->umask;
read_lock(&old->lock);
fs->rootmnt = mntget(old->rootmnt);
fs->altrootmnt = mntget(old->altrootmnt);
fs->altroot = dget(old->altroot);
} else {
-Index: linux-2.4.21-171/kernel/ksyms.c
+Index: linux-2.4.21-241/kernel/ksyms.c
===================================================================
---- linux-2.4.21-171.orig/kernel/ksyms.c 2004-04-03 16:07:40.000000000 -0500
-+++ linux-2.4.21-171/kernel/ksyms.c 2004-04-03 16:09:50.000000000 -0500
-@@ -334,6 +334,7 @@
+--- linux-2.4.21-241.orig/kernel/ksyms.c 2004-10-08 17:59:14.000000000 -0400
++++ linux-2.4.21-241/kernel/ksyms.c 2004-10-08 17:59:16.000000000 -0400
+@@ -329,6 +329,7 @@
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
EXPORT_SYMBOL(vfs_follow_link);
export-truncate.patch
iod-stock-24-exports_hp.patch
ext3-htree-2.4.21-chaos.patch
-linux-2.4.21-xattr-0.8.54-suse2.patch
+linux-2.4.21-xattr-0.8.54-suse-171.patch
ext3-orphan_lock-2.4.22-rh.patch
ext3-noread-2.4.21-suse2.patch
-ext3-delete_thread-2.4.21-chaos.patch
+ext3-delete_thread-2.4.21-suse-171.patch
extN-wantedi-2.4.21-suse2.patch
ext3-san-2.4.20.patch
ext3-map_inode_page-2.4.21-suse2.patch
ext3-ea-in-inode-2.4.21-suse2.patch
listman-2.4.20.patch
ext3-truncate-buffer-head.patch
+lookup-stack-symbols-2.4.21-suse-171.patch
lnxmaj="2.6.5"
-lnxrel="SLES9_SP1_BRANCH_2004110217390391"
+lnxrel="SLES9_SP1_BRANCH_2004111114454891"
KERNEL=linux-$lnxmaj-$lnxrel.tar.gz
# they include our patches
SERIES=
VERSION=$lnxmaj
-EXTRA_VERSION=$lnxrel_lustre.@VERSION@
+EXTRA_VERSION="${lnxrel}_lustre.@VERSION@"
RHBUILD=0
LINUX26=1
+SUSEBUILD=1
BASE_ARCHS="i686 ppc"
BIGMEM_ARCHS=""
BOOT_ARCHS=""
JENSEN_ARCHS=""
-SMP_ARCHS="i686 ppc"
+SMP_ARCHS=""
+BIGSMP_ARCHS="i686 ppc"
UP_ARCHS=""
SRC_ARCHS=""
SERIES MNEMONIC COMMENT ARCH
+SUPPORTED KERNELS:
+rhel-2.4.21 linux-2.4.21-20.3EL same as chaos-2.4.21 all
+2.6-suse linux-2.6 SLES9 SP1 kernel all
+
+UNSUPPORTED KERNELS; BEING PHASED OUT; MAY BE MISSING CRITICAL BUG FIXES:
hp-pnnl-2.4.20 linux-2.4.20-hp4_pnnl1 same as vanilla but no uml ia64
vanilla-2.4.24 linux-2.4.24 patch with uml-2.4.24-6 um
-chaos-2.4.21 linux-chaos-2.4.21 same as rh-2.4.21-15.EL i386
-rhel-2.4.21 linux-2.4.21-15.3EL same as chaos-2.4.21 i386
-vanilla-2.4.24 linux-2.4.24 patch with uml-2.4.24-1 um
-kgdb-2.5.73 linux-2.5.73 vanilla 2.5.73 with kgdb i386
+chaos-2.4.21 linux-chaos-2.4.21 same as rh-2.4.21-20.EL i386
+suse-2.4.21-jvn linux-2.4.21-241 sles8 2.4 kernel i386
ln -s `pwd` $LINUX/fs/lustre
fi
+ # -------- linux objects (for 2.6) --
+ AC_MSG_CHECKING([for Linux objects dir])
+ AC_ARG_WITH([linux-obj],
+ AC_HELP_STRING([--with-linux-obj=path],
+ [set path to Linux objects dir (default=\$LINUX)]),
+ [LINUX_OBJ=$with_linux_obj],
+ [LINUX_OBJ=$LINUX])
+ AC_MSG_RESULT([$LINUX_OBJ])
+ AC_SUBST(LINUX_OBJ)
+
# -------- check for .confg --------
AC_ARG_WITH([linux-config],
[AC_HELP_STRING([--with-linux-config=path],
- [set path to Linux .conf (default=\$LINUX/.config)])],
+ [set path to Linux .conf (default=\$LINUX_OBJ/.config)])],
[LINUX_CONFIG=$with_linux_config],
- [LINUX_CONFIG=$LINUX/.config])
+ [LINUX_CONFIG=$LINUX_OBJ/.config])
AC_SUBST(LINUX_CONFIG)
AC_CHECK_FILE([/boot/kernel.h],
AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
[m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl
rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko
-AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] CC="$CC" -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])],
+AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] CC="$CC" -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM $MODULE_TARGET=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])],
[$4],
[_AC_MSG_LOG_CONFTEST
m4_ifvaln([$5],[$5])dnl])dnl
[AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult README.kernel-source])])
# ----------- make dep run? ------------------
- AC_CHECK_FILES([$LINUX/include/linux/autoconf.h
- $LINUX/include/linux/version.h
+ AC_CHECK_FILES([$LINUX_OBJ/include/linux/autoconf.h
+ $LINUX_OBJ/include/linux/version.h
$LINUX/include/linux/config.h],[],
[AC_MSG_ERROR([Run make config in $LINUX.])])
# tarred up the tree and ran make dep etc. in it, then
# version.h gets overwritten with a standard linux one.
- if grep rhconfig $LINUX/include/linux/version.h >/dev/null ; then
+ if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
# This is a clean kernel-source tree, we need to
# enable extensive workarounds to get this to build
# modules
EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
fi
- # --- check that we can build modules at all
- AC_MSG_CHECKING([that modules can be built])
- LUSTRE_MODULE_TRY_COMPILE([],[],
- [
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_WARN([Consult config.log for details.])
- AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
- AC_MSG_ERROR([Kernel modules could not be built.])
- ])
-
- # ------------ LINUXRELEASE and moduledir ------------------
+ # ------------ external module support ---------------------
MODULE_TARGET="SUBDIRS"
if test $linux25 = 'yes' ; then
- # ------------ external module support ---------------------
makerule="$PWD/kernel-tests"
AC_MSG_CHECKING([for external module build support])
rm -f kernel-tests/conftest.i
makerule="_dir_$PWD/kernel-tests"
fi
AC_SUBST(MODULE_TARGET)
+
+ # --- check that we can build modules at all
+ AC_MSG_CHECKING([that modules can be built])
+ LUSTRE_MODULE_TRY_COMPILE([],[],
+ [
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Consult config.log for details.])
+ AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
+ AC_MSG_ERROR([Kernel modules could not be built.])
+ ])
+
+ # ------------ LINUXRELEASE and moduledir ------------------
LINUXRELEASE=
rm -f kernel-tests/conftest.i
AC_MSG_CHECKING([for Linux release])
AC_SUBST(GMCPPFLAGS)
AC_SUBST(GMNAL)
+ if test $linux25 = 'no' ; then
#### OpenIB
AC_MSG_CHECKING([if OpenIB kernel headers are present])
OPENIBCPPFLAGS="-I$LINUX/drivers/infiniband/include -DIN_TREE_BUILD"
EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
AC_SUBST(OPENIBCPPFLAGS)
AC_SUBST(OPENIBNAL)
+ fi
#### Infinicon IB
AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
#include <linux/fs.h>
#include <linux/version.h>
],[
- #if defined(CONFIG_X86_64) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
- #error "x86_64 down_read_trylock broken before 2.4.24"
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
+ #error "down_read_trylock broken before 2.4.24"
#endif
struct inode i;
return (char *)&i.i_alloc_sem - (char *)&i;
EXTRA_DIST = license-status maketags.sh lustre.spec version_tag.pl.in \
lustre lustrefs lustre.spec.in lustre-kernel-2.4.spec.in \
lmake linux-merge-config.awk linux-merge-modules.awk \
- linux-rhconfig.h
+ linux-rhconfig.h suse-functions.sh suse-postun.sh suse-post.sh \
+ suse-trigger-script.sh.in
initddir = $(sysconfdir)/init.d
if UTILS
VERSION=
RHBUILD=0
+SUSEBUILD=0
LINUX26=0
SUSEBUILD=0
BOOT_ARCHS=
JENSEN_ARCHS=
SMP_ARCHS=
+BIGSMP_ARCHS=
UP_ARCHS=
DATE=$(date)
fi
# EXTRA_VERSION=${EXTRA_VERSION//-/_}
- ALL_ARCHS="$BASE_ARCHS $BIGMEM_ARCHS $BOOT_ARCHS $JENSEN_ARCHS $SMP_ARCHS $UP_ARCHS"
+ ALL_ARCHS="$BASE_ARCHS $BIGMEM_ARCHS $BOOT_ARCHS $JENSEN_ARCHS $SMP_ARCHS $BIGSMP_ARCHS $UP_ARCHS"
BUILD_ARCHS=
for arch in $(uniqify "$ALL_ARCHS") ; do
-e "s/@BOOT_ARCHS@/$BOOT_ARCHS/g" \
-e "s/@JENSEN_ARCHS@/$BOOT_ARCHS/g" \
-e "s/@SMP_ARCHS@/$SMP_ARCHS/g" \
+ -e "s/@BIGSMP_ARCHS@/$BIGSMP_ARCHS/g" \
-e "s/@UP_ARCHS@/$UP_ARCHS/g" \
-e "s/@RHBUILD@/$RHBUILD/g" \
+ -e "s/@SUSEBUILD@/$SUSEBUILD/g" \
-e "s/@LINUX26@/$LINUX26/g" \
-e "s/@SUSEBUILD@/$SUSEBUILD/g" \
-e "s/@ENABLE_INIT_SCRIPTS@/$ENABLE_INIT_SCRIPTS/g" \
[ -d RPMS ] || mkdir RPMS
[ -d BUILD ] || mkdir BUILD
[ -d SOURCES ] || mkdir SOURCES
- cp $TOPDIR/lustre/scripts/linux-rhconfig.h SOURCES
- cp $TOPDIR/lustre/scripts/linux-merge-config.awk SOURCES
- cp $TOPDIR/lustre/scripts/linux-merge-modules.awk SOURCES
+ for script in linux-{rhconfig.h,merge-config.awk,merge-modules.awk} \
+ suse-{functions.sh,post.sh,postun.sh,trigger-script.sh.in} ; do
+ cp $TOPDIR/lustre/scripts/$script SOURCES
+ done
cp "$LUSTRE" "$KERNEL_FILE" SOURCES
}
BOOT_ARCHS=
JENSEN_ARCHS=
SMP_ARCHS=
+BIGSMP_ARCHS=
UP_ARCHS=
+RHBUILD=0
+SUSEBUILD=0
+
# flat-out globals
TOPDIR=
TARGET_FILE=
file. Default is i386.
--target-config=CONFIG
- Specifies a special option (such as smp, bigmem, or BOOT) to use
- when choosing a kernel config file. This also modifies the kernel
- version and modules directory.
+ Specifies a special option (such as smp, bigsmp, bigmem, or BOOT)
+ to use when choosing a kernel config file. This also modifies the
+ kernel version and modules directory.
--unpack-kernel
Untars and patches the kernel source.
echo "Making depend in $PWD..."
$MAKE mrproper || fatal 1 "Error running make mrproper"
cp "$CONFIG_FILE" .config
- if grep -q oldconfig_nonint Makefile ; then
- OLDCONFIG='oldconfig_nonint'
- else
- OLDCONFIG='oldconfig'
- fi
+ for oc in oldconfig_nonint silentoldconfig oldconfig ; do
+ if grep -q "$oc" Makefile ; then
+ OLDCONFIG="$oc"
+ break
+ fi
+ done
$MAKE $OLDCONFIG || fatal 1 "Error running make oldconfig"
case "$VERSION" in
2.6*)
SYMLINKS="include/asm"
;;
2.4*)
- SYMLINKS="symlinnks"
+ SYMLINKS="symlinks"
;;
esac
$MAKE $SYMLINKS
;;
esac
+ if [ -e init/kerntypes.o ] ; then
+ cp init/kerntypes.o "$DESTDIR/boot/Kerntypes-${FULL_VERSION}"
+ fi
popd >/dev/null
}
install_lustre()
{
(( $INSTALL_LUSTRE )) || return 0
+ set_make
FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}"
pushd "$TOPDIR" >/dev/null
- make -s install "DESTDIR=$DESTDIR" KERNELRELEASE="$FULL_VERSION" || fatal 1 "Error installing Lustre."
+ $MAKE -s install "DESTDIR=$DESTDIR" KERNELRELEASE="$FULL_VERSION" || fatal 1 "Error installing Lustre."
popd >/dev/null
}
+build_kms()
+{
+ (( $BUILD_KERNEL )) || return 0
+ (( $SUSEBUILD )) || return 0
+ set_make
+ FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}"
+ mkdir -p "${TOPDIR}/modules-${FULL_VERSION}"
+ for dir in /usr/src/kernel-modules/* ; do
+ # we are replacing lustre-lite, so don't include it
+ if [ ${dir##*/} != "lustre-lite" -a -e $dir/Makefile ]; then
+ build_dir="${TOPDIR}/modules-${FULL_VERSION}/${dir##*/}"
+ cp -a $dir $build_dir
+ # these modules are terrible, and don't all build
+ $MAKE_J -C $build_dir modules KERNEL_SOURCE="${TOPDIR}/linux"
+ fi
+ done
+}
+
+symver()
+{
+ local file=$1 name=${1%.ko}
+ nm $file \
+ | sed -ne 's,^0*\([0-9a-f]\{8\}\) A __crc_\(.*\),0x\1\t\2\t'"$name"',p'
+}
+
+install_kms()
+{
+ (( $INSTALL_KERNEL )) || return 0
+ (( $SUSEBUILD )) || return 0
+ set_make
+ FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}"
+ for build_dir in "${TOPDIR}/modules-${FULL_VERSION}/*" ; do
+ [ -d $build_dir ] || continue
+ # these modules are terrible, and don't all build
+ $MAKE -C $build_dir KERNEL_SOURCE="${TOPDIR}/linux" INSTALL_MOD_PATH="$DESTDIR"
+ done
+ ( symver vmlinux
+ moddir="${DESTDIR}/lib/modules/${FULL_VERSION}"
+ cd $moddir/kernel
+ for module in $(find * -name '*.ko'); do
+ symver $module
+ done
+ cd $moddir
+ for module in $(find * -path 'kernel/*' -prune -o \
+ -name '*.ko' -print); do
+ symver $module
+ done
+ ) | sort -u -k2 \
+ | gzip -c9 > "${DESTDIR}/boot/symvers-${VERSION}-${EXTRA_VERSION}-${TARGET_ARCH}${TARGET_CONFIG}.gz"
+}
+
save_headers()
{
echo "Saving headers for $1 $2..."
save_headers smp $arch
done
+ for arch in $BIGSMP_ARCHS ; do
+ save_headers bigsmp $arch
+ done
for arch in $UP_ARCHS ; do
save_headers up $arch
done
configure_lustre
build_lustre
+build_kms
+
install_kernel
install_lustre
+install_kms
+
save_all_headers
exit 0
%define nptlarchs %{all_x86}
#define nptlarchs noarch
%define rhbuild @RHBUILD@
+%define susebuild @SUSEBUILD@
%define linux26 @LINUX26@
# disable build root strip policy
%define buildBOOT 0
%define buildjensen 0
%define buildsmp 0
+%define buildbigsmp 0
%define buildup 0
%define buildsrc 0
%define buildsmp 1
%endif
+%ifarch @BIGSMP_ARCHS@
+%define buildbigsmp 1
+%endif
+
%ifarch @UP_ARCHS@
%define buildup 1
%endif
# For board-specific kernels, build only the normal kernel (which may actually be smp, not up).
%if %{withtargetboard}
%define buildsmp 0
+%define buildbigsmp 0
%define buildBOOT 0
%define buildbigmem 0
%define buildjensen 0
# we can't test values inline, only whether a macro exists
%{expand: %%define buildup_%{buildup} yadda}
%{expand: %%define buildsmp_%{buildsmp} yadda}
+%{expand: %%define buildbigsmp_%{buildbigsmp} yadda}
%{expand: %%define buildBOOT_%{buildBOOT} yadda}
%{expand: %%define buildbigmem_%{buildbigmem} yadda}
%{expand: %%define buildjensen_%{buildjensen} yadda}
Source16: linux-merge-config.awk
Source17: linux-merge-modules.awk
+Source25: suse-functions.sh
+Source26: suse-post.sh
+Source27: suse-postun.sh
+Source28: suse-trigger-script.sh.in
+
%package source
Summary: The source code for the Linux kernel.
Group: Development/System
Prereq: fileutils
Requires: gawk
Requires: gcc >= 2.96-98
+Autoreqprov: 0
%package doc
Summary: Various documentation bits found in the kernel source.
Install the kernel-smp package if your machine uses two or more CPUs.
+%package bigsmp
+Summary: The Linux kernel compiled for SMP machines.
+Group: System/Kernel
+Provides: module-info, kernel = %{version}, k_smp4G
+Obsoletes: k_smp4G
+%ifarch %{all_x86} ia64 x86_64
+Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
+%endif
+%if %{rhbuild}
+Prereq: %{kernel_prereq}
+Conflicts: %{kernel_conflicts}
+%endif
+
+%description bigsmp
+This package includes a SMP version of the Linux kernel. It is
+required only on machines with two or more CPUs, although it should
+work fine on single-CPU boxes.
+
+Install the kernel-bigsmp package if your machine uses two or more CPUs.
+
%package bigmem
Summary: The Linux Kernel for machines with more than 4 Gigabyte of memory.
Group: System Environment/Kernel
--kerneldir $RPM_SOURCE_DIR
popd >/dev/null
+# handle both SuSE and Red Hat's new-kernel-pkg bits
+for flavor in "" smp bigmem bigsmp BOOT jensen ; do
+ for when in pre preun post postun ; do
+ script="${when}${flavor}.sh"
+ echo "if [ -f /etc/SuSE-release ] ; then" > ${script}
+ sed -e "s/@when@/$when/g" -e "s^%ver_str^%{KVERREL}${flavor}^g" %{SOURCE28} >> ${script}
+ cat %{SOURCE25} >> ${script}
+ case $when in
+ post)
+ sed -e "s^%ver_str^%{KVERREL}${flavor}^g" %{SOURCE26} >> ${script}
+ ;;
+ postun)
+ sed -e "s^%ver_str^%{KVERREL}${flavor}^g" %{SOURCE27} >> ${script}
+ ;;
+ esac
+ echo "exit 0; fi" >> ${script}
+ case $when in
+ post)
+ if [ -z "${flavor}" ] ; then
+ cat >> ${script} <<EOF
+cd /boot
+%ifnarch ia64
+ln -sf vmlinuz-%{KVERREL} vmlinuz
+%endif
+ln -sf System.map-%{KVERREL} System.map
+ln -sf module-info-%{KVERREL} module-info
+EOF
+ fi
+ cat >> ${script} <<EOF
+[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
+[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
+if [ -x /sbin/new-kernel-pkg ] ; then
+ /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}${flavor}
+fi
+EOF
+ ;;
+ postun)
+ ;;
+ pre)
+ cat >> ${script} <<EOF
+/sbin/modprobe loop 2>/dev/null >/dev/null || :
+exit 0
+EOF
+ ;;
+ preun)
+ cat >> ${script} <<EOF
+/sbin/modprobe loop 2> /dev/null > /dev/null || :
+rm -f /lib/modules/%{KVERREL}${flavor}/modules.*
+if [ -x /sbin/new-kernel-pkg ] ; then
+ /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}${flavor}
+fi
+EOF
+ ;;
+ esac
+ done
+done
+
%build
# if RPM_BUILD_NCPUS unset, set it
if [ -z "$RPM_BUILD_NCPUS" ] ; then
BuildKernel smp
%endif
+%if %{buildbigsmp}
+BuildKernel bigsmp
+%endif
+
%if %{buildup}
BuildKernel
%endif
# mark the vmlinux* non-executable to fool strip-to-file
chmod a-x $RPM_BUILD_ROOT/boot/vmlinux*
+BuildObj ()
+{
+ flavor=$1
+ if [ $flavor = "up" ] ; then
+ flavext=""
+ else
+ flavext="-$flavor"
+ fi
+ c="$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}"
+ o="${c}-obj/%{_target_cpu}/$flavor"
+ mkdir -p $o
+ cp ../kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}${flavext}.config \
+ $o/.config
+ for oc in oldconfig_nonint silentoldconfig oldconfig ; do
+ if grep -q "$oc" Makefile ; then
+ OLDCONFIG="$oc"
+ break
+ fi
+ done
+ MAKE="make -s O=$o -C ${c}"
+ $MAKE $OLDCONFIG
+ $MAKE prepare-all
+ $MAKE clean
+ rm -rf $o/.config.old $o/include/config
+ # Replace the Makefile in the object directory with a version
+ # that has relative path names.
+ read VERSION PATCHLEVEL SUBLEVEL <<-EOF
+$(set -- 2.6.5 ; echo ${*//./ })
+EOF
+ source scripts/mkmakefile \
+ ../../../linux-%{KVERREL} \
+ ../linux-%{KVERREL}-obj/%{_target_cpu}/$flavor \
+ $VERSION \
+ $PATCHLEVEL \
+ > $o/Makefile
+ zcat "$RPM_BUILD_ROOT/boot/symvers-%{KVERREL}-%{_target_cpu}${flavor}.gz" \
+ > $o/Module.symvers
+}
+
##
## do -source package cleanup/install
##
%if %{buildbase}
-pushd linux >/dev/null
-mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-rm -f drivers/net/hamradio/soundmodem/gentbl scripts/mkdep
-tar cf - . | tar xf - -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{kextraver}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile
-ln -sf linux-%{KVERREL} $RPM_BUILD_ROOT/usr/src/linux
-# install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-
-#clean up the destination
-make -s mrproper -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
-mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
-cp ../kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@*.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
-cp ../kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config
-if grep -q oldconfig_nonint $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile ; then
- OLDCONFIG='oldconfig_nonint'
-else
- OLDCONFIG='oldconfig'
-fi
-make -s $OLDCONFIG -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-%if %{linux26}
-make -s include/asm -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-%else
-make -s symlinks -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-%endif
-make -s include/linux/version.h -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-
-#this generates modversions info which we want to include and we may as
-#well include the depends stuff as well, after we fix the paths
-make -s depend -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
-find $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} -name ".*depend" | \
-while read file ; do
- mv $file $file.old
- sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file
- rm -f $file.old
-done
-
-# Try to put some smarter autoconf.h and version.h files in place
-pushd $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/include/linux ; {
-rm -rf modules modversions.h autoconf.h version.h
-cat > modversions.h <<EOF
+ pushd linux >/dev/null
+ mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ rm -f drivers/net/hamradio/soundmodem/gentbl scripts/mkdep
+ tar cf - . | tar xf - -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{kextraver}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile
+ ln -sf linux-%{KVERREL} $RPM_BUILD_ROOT/usr/src/linux
+ # install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+
+ #clean up the destination
+ make -s mrproper -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
+ mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
+ cp ../kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@*.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
+ %if %{linux26}
+ # this only works because CFS only builds one kernel per target/arch per kernel-source rpm
+ objdir=$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}-obj
+ mkdir -p $objdir
+ %if %{buildbigmem}
+ BuildObj bigmem
+ %endif
+ %if %{buildBOOT}
+ BuildObj BOOT
+ %endif
+ %if %{buildjensen}
+ BuildObj jensen
+ %endif
+ %if %{buildsmp}
+ BuildObj smp
+ %endif
+ %if %{buildbigsmp}
+ BuildObj bigsmp
+ %endif
+ %if %{buildup}
+ BuildObj up
+ %endif
+ # Remove $RPM_BUILD_ROOT prefix from symlinks.
+ for link in $(find $objdir -type l); do
+ target=$(readlink $link)
+ rm -f $link
+ ln -s ${target/$RPM_BUILD_ROOT/} $link
+ done
+ %else # 2.4 rh-style
+ cp ../kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config
+ for oc in oldconfig_nonint silentoldconfig oldconfig ; do
+ if grep -q "$oc" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile ; then
+ OLDCONFIG="$oc"
+ break
+ fi
+ done
+ make -s $OLDCONFIG -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ %if %{linux26}
+ make -s include/asm -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ %else
+ make -s symlinks -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ %endif
+ make -s include/linux/version.h -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+
+ #this generates modversions info which we want to include and we may as
+ #well include the depends stuff as well, after we fix the paths
+ make -s depend -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
+ find $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} -name ".*depend" | \
+ while read file ; do
+ mv $file $file.old
+ sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file
+ rm -f $file.old
+ done
+
+ # Try to put some smarter autoconf.h and version.h files in place
+ pushd $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/include/linux ; {
+ rm -rf modules modversions.h autoconf.h version.h
+ cat > modversions.h <<EOF
#ifndef _LINUX_MODVERSIONS_H
#define _LINUX_MODVERSIONS_H
#include <linux/rhconfig.h>
#include <linux/modsetver.h>
EOF
-echo '#include <linux/rhconfig.h>' > autoconf.h
-list=`find ../../savedheaders/* -name '*.ver' -exec basename '{}' \; | sort`
-mkdir modules
-for l in $list; do
- sed 's,$,modules/'$l, ../../savedheaders/list | awk -f %{SOURCE17} > modules/$l
- touch -r modules/$l modules/`basename $l .ver`.stamp
- echo '#include <linux/modules/'$l'>' >> modversions.h
-done
-echo '#endif' >> modversions.h
-sed 's,$,autoconf.h,' ../../savedheaders/list | awk -f %{SOURCE16} >> autoconf.h
-install -m 644 %{SOURCE15} rhconfig.h
-echo "#include <linux/rhconfig.h>" >> version.h
-keyword=if
-for i in smp BOOT BOOTsmp bigmem up ; do
-# When we build in an i386, we don't have an bigmem header directory
-# in savedheaders/i386/bigmem. We also don't have a BOOT directory
-# anywhere except in savedheaders/i386. So, we need to use this method
-# of determining if a kernel version string needs to be included in the
-# version.h file
- verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print $1 } '`
- if [ -n "$verh" -a -f "$verh" ]; then
- if [ "$i" = up ]; then
- if [ "$keyword" = if ]; then
- echo "#if 0" >> version.h
- fi
- echo "#else" >> version.h
- else
- echo "#$keyword defined(__module__$i)" >> version.h
- keyword=elif
- fi
- grep UTS_RELEASE $verh >> version.h
- fi
-done
-echo "#endif" >> version.h
-if [ -f ../../savedheaders/%{_target_cpu}/up/version.h ] ; then
- # keep to a standard normally
- HEADER_FILE=../../savedheaders/%{_target_cpu}/up/version.h
-else
- # test build not including uniprocessor, must get info from somewhere
- HEADER_FILE=$(ls ../../savedheaders/*/*/version.h | head -n 1)
-fi
-grep -v UTS_RELEASE $HEADER_FILE >> version.h
-rm -rf ../../savedheaders
-} ; popd
-touch $RPM_BUILD_ROOT/boot/kernel.h-%{kversion}
-
-# rm -f $RPM_BUILD_ROOT/usr/include/linux
-
-rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/savedheaders
-
-%if %{rhbuild}
-# fix up the tmp_include_depends file wrt the buildroot
-perl -p -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/tmp_include_depends
-%endif
-
-popd >/dev/null
-%endif
+ echo '#include <linux/rhconfig.h>' > autoconf.h
+ list=`find ../../savedheaders/* -name '*.ver' -exec basename '{}' \; | sort`
+ mkdir modules
+ for l in $list; do
+ sed 's,$,modules/'$l, ../../savedheaders/list | awk -f %{SOURCE17} > modules/$l
+ touch -r modules/$l modules/`basename $l .ver`.stamp
+ echo '#include <linux/modules/'$l'>' >> modversions.h
+ done
+ echo '#endif' >> modversions.h
+ sed 's,$,autoconf.h,' ../../savedheaders/list | awk -f %{SOURCE16} >> autoconf.h
+ install -m 644 %{SOURCE15} rhconfig.h
+ echo "#include <linux/rhconfig.h>" >> version.h
+ keyword=if
+ for i in smp BOOT BOOTsmp bigmem bigsmp up ; do
+ # When we build in an i386, we don't have an bigmem header directory
+ # in savedheaders/i386/bigmem. We also don't have a BOOT directory
+ # anywhere except in savedheaders/i386. So, we need to use this method
+ # of determining if a kernel version string needs to be included in the
+ # version.h file
+ verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print $1 } '`
+ if [ -n "$verh" -a -f "$verh" ]; then
+ if [ "$i" = up ]; then
+ if [ "$keyword" = if ]; then
+ echo "#if 0" >> version.h
+ fi
+ echo "#else" >> version.h
+ else
+ echo "#$keyword defined(__module__$i)" >> version.h
+ keyword=elif
+ fi
+ grep UTS_RELEASE $verh >> version.h
+ fi
+ done
+ echo "#endif" >> version.h
+ if [ -f ../../savedheaders/%{_target_cpu}/up/version.h ] ; then
+ # keep to a standard normally
+ HEADER_FILE=../../savedheaders/%{_target_cpu}/up/version.h
+ else
+ # test build not including uniprocessor, must get info from somewhere
+ HEADER_FILE=$(ls ../../savedheaders/*/*/version.h | head -n 1)
+ fi
+ grep -v UTS_RELEASE $HEADER_FILE >> version.h
+ rm -rf ../../savedheaders
+ } ; popd
+ touch $RPM_BUILD_ROOT/boot/kernel.h-%{kversion}
+
+ # rm -f $RPM_BUILD_ROOT/usr/include/linux
+
+ rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/savedheaders
+
+ %if %{rhbuild}
+ # fix up the tmp_include_depends file wrt the buildroot
+ perl -p -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/tmp_include_depends
+ %endif
+ %endif # linux26
+ popd >/dev/null
+%endif # buildbase
popd >/dev/null
# do this for upgrades...in case the old modules get removed we have
# loopback in the kernel so that mkinitrd will work.
-%pre
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-exit 0
+%pre -f pre.sh
-%pre smp
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-exit 0
+%pre smp -f presmp.sh
-%pre bigmem
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-exit 0
+%pre bigsmp -f prebigsmp.sh
-%post
-cd /boot
-%ifnarch ia64
-ln -sf vmlinuz-%{KVERREL} vmlinuz
-%endif
-ln -sf System.map-%{KVERREL} System.map
-ln -sf module-info-%{KVERREL} module-info
-[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}
-fi
+%pre bigmem -f prebigmem.sh
+%post -f post.sh
-%post smp
-[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}smp
-fi
+%post smp -f postsmp.sh
-%post bigmem
-[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}bigmem
-fi
+%post bigsmp -f postbigsmp.sh
-%post jensen
-[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}jensen
-fi
+%post bigmem -f postbigmem.sh
+
+%post jensen -f postjensen.sh
%ifnarch ia64
-%post BOOT
-[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}BOOT
-fi
+%post BOOT -f postBOOT.sh
%endif
fi
# Allow clean removal of modules directory
-%preun
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-#rm -f /lib/modules/%{KVERREL}/modules.*
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}
-fi
+%preun -f preun.sh
+%preun smp -f preunsmp.sh
-%preun smp
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-rm -f /lib/modules/%{KVERREL}smp/modules.*
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}smp
-fi
+%preun bigsmp -f preunbigsmp.sh
+%preun bigmem -f preunbigmem.sh
-%preun bigmem
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-rm -f /lib/modules/%{KVERREL}bigmem/modules.*
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}bigmem
-fi
+%preun BOOT -f preunBOOT.sh
+%preun jensen -f preunjensen.sh
-%preun BOOT
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-#rm -f /lib/modules/%{KVERREL}BOOT/modules.*
-if [ -x /sbin/new-kernel-pkg ] ; then
- /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}BOOT
-fi
+# suse needs these i guess
+%postun -f postun.sh
+%postun smp -f postunsmp.sh
-%preun jensen
-/sbin/modprobe loop 2> /dev/null > /dev/null || :
-#rm -f /lib/modules/%{KVERREL}jensen/modules.*
+%postun bigsmp -f postunbigsmp.sh
+
+%postun bigmem -f postunbigmem.sh
+
+%postun BOOT -f postunBOOT.sh
+%postun jensen -f postunjensen.sh
# We need this here because we don't prereq kudzu; it could be
# installed after the kernel
%triggerin smp -- kudzu
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
+%triggerin bigsmp -- kudzu
+[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
+
%triggerin bigmem -- kudzu
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
%dir /lib/modules
%dir /dev/shm
/lib/modules/%{KVERREL}
+%if %{linux26}
+/boot/Kerntypes-%{KVERREL}
+/boot/symvers-%{KVERREL}-%{_target_cpu}.gz
+%endif # linux26
%endif
%if %{buildsmp}
%dir /lib/modules
%dir /dev/shm
/lib/modules/%{KVERREL}smp
+%if %{linux26}
+/boot/Kerntypes-%{KVERREL}smp
+/boot/symvers-%{KVERREL}-%{_target_cpu}smp.gz
+%endif # linux26
+%endif
+
+%if %{buildbigsmp}
+%files bigsmp
+%defattr(-, root, root)
+/boot/%{kernel_glob}bigsmp
+%ifarch ia64
+/boot/efi/redhat/%{kernel_glob}bigsmp
+%endif
+/boot/System.map-%{KVERREL}bigsmp
+/boot/config-%{KVERREL}bigsmp
+%dir /lib/modules
+%dir /dev/shm
+/lib/modules/%{KVERREL}bigsmp
+%if %{linux26}
+/boot/Kerntypes-%{KVERREL}bigsmp
+/boot/symvers-%{KVERREL}-%{_target_cpu}bigsmp.gz
+%endif # linux26
%endif
%if %{buildbigmem}
%dir /lib/modules
%dir /dev/shm
/lib/modules/%{KVERREL}bigmem
+%if %{linux26}
+/boot/Kerntypes-%{KVERREL}bigmem
+/boot/symvers-%{KVERREL}-%{_target_cpu}bigmem.gz
+%endif # linux26
%endif
%if %{buildBOOT}
%dir /lib/modules
%dir /dev/shm
/lib/modules/%{KVERREL}BOOT
+%if %{linux26}
+/boot/Kerntypes-%{KVERREL}BOOT
+/boot/symvers-%{KVERREL}-%{_target_cpu}BOOT.gz
+%endif # linux26
%endif
%if %{buildbase}
%defattr(-,root,root)
%dir /usr/src/linux-%{KVERREL}
/usr/src/linux-%{KVERREL}/*
+%if %{linux26}
+%dir /usr/src/linux-%{KVERREL}-obj
+/usr/src/linux-%{KVERREL}-obj/*
+%endif # linux26
%endif
%files doc
--- /dev/null
+# Readlink is not present on some older distributions: emulate it.
+readlink() {
+ local path=$1 ll
+
+ if [ -L "$path" ]; then
+ ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" &&
+ echo "${ll/* -> }"
+ else
+ return 1
+ fi
+}
+relink() {
+ if [ -h "$2" ]; then
+ local old=$(readlink "$2")
+ [ "$old" = "$1" ] && return 0
+ echo "Changing symlink $2 from $old to $1"
+ elif [ -e "$2" ]; then
+ echo "Replacing file $2 with symlink to $1"
+ fi
+ rm -f "$2" \
+ && ln -s "$1" "$2"
+}
--- /dev/null
+if [ -f /boot/vmlinuz-%ver_str ]; then
+ image=vmlinuz
+elif [ -f /boot/image-%ver_str ]; then
+ image=image
+elif [ -f /boot/vmlinux-%ver_str ]; then
+ image=vmlinux
+else
+ # nothing to do (UML kernels for example).
+ exit 0
+fi
+
+# If we have old symlinks, rename them to *.previous
+if [ -L /boot/$image -a -L /boot/initrd -a \
+ "$(readlink /boot/$image)" != $image-%ver_str -a \
+ "$(readlink /boot/initrd)" != initrd-%ver_str ]; then
+ mv /boot/$image /boot/$image.previous
+ mv /boot/initrd /boot/initrd.previous
+fi
+
+# update /boot/vmlinuz symlink
+relink $image-%ver_str /boot/$image
+
+if test "$YAST_IS_RUNNING" != instsys ; then
+ if [ -f /etc/fstab ]; then
+ echo Setting up /lib/modules/%ver_str
+ /sbin/update-modules.dep -v %ver_str
+ cd /boot
+ /sbin/mkinitrd -k $image-%ver_str -i initrd-%ver_str
+
+ if [ -e /boot/initrd-%ver_str ]; then
+ relink initrd-%ver_str /boot/initrd
+ else
+ rm -f /boot/initrd
+ fi
+ else
+ echo "please run mkinitrd as soon as your system is complete"
+ fi
+fi
+
+if [ "$YAST_IS_RUNNING" != instsys -a -x /sbin/new-kernel-pkg ]; then
+ # Notify boot loader that a new kernel image has been installed.
+ # (during initial installation the boot loader configuration does not
+ # yet exist when the kernel is installed, but yast kicks the boot
+ # loader itself later.)
+ /sbin/new-kernel-pkg %ver_str
+fi
--- /dev/null
+if [ -L /boot/vmlinux ]; then
+ image=vmlinux
+elif [ -L /boot/vmlinuz ]; then
+ image=vmlinuz
+elif [ -L /boot/image ]; then
+ image=image
+else
+ # nothing to do (UML kernels for example).
+ exit 0
+fi
+
+if [ "$(readlink /boot/$image)" = $image-%ver_str ]; then
+ # This may be the last kernel RPM on the system, or it may
+ # be an update. In both of those cases the symlinks will
+ # eventually be correct. Only if this kernel
+ # is removed and other kernel rpms remain installed,
+ # find the most recent of the remaining kernels, and make
+ # the symlinks point to it. This makes sure that the boot
+ # manager will always have a kernel to boot in its default
+ # configuration.
+ shopt -s nullglob
+ for image in $(cd /boot ; ls -dt $image-*); do
+ initrd=initrd-${image#*-}
+ if [ -f /boot/$image -a -f /boot/$initrd ]; then
+ relink $image /boot/${image%%%%-*}
+ relink $initrd /boot/${initrd%%%%-*}
+ break
+ fi
+ done
+ shopt -u nullglob
+fi
+
+# Created in the other kernel's %post
+case "$(readlink /boot/$image.previous)" in
+$image-%ver_str|$(readlink /boot/$image))
+ rm -f /boot/$image.previous ;;
+esac
+case "$(readlink /boot/initrd.previous)" in
+initrd-%ver_str|$(readlink /boot/initrd))
+ rm -f /boot/initrd.previous ;;
+esac
+# created in %post
+rm -f /boot/initrd-%ver_str
--- /dev/null
+old_shopt=$(shopt -p nullglob || :)
+shopt -s nullglob
+for script in /lib/modules/scripts/* ; do
+ if [ -f "$script" -a -x "$script" ] \
+ && ! "$script" --@when@ %ver_str $1 ; then
+ echo "$script failed."
+ fi
+done
+eval $old_shopt