Whamcloud - gitweb
land "final" b_release_1_2_8 changes
authorjacob <jacob>
Thu, 18 Nov 2004 23:24:50 +0000 (23:24 +0000)
committerjacob <jacob>
Thu, 18 Nov 2004 23:24:50 +0000 (23:24 +0000)
       - make lustrefs init script start after nfs is mounted
       - fix CWARN/ERROR duplication (4930)
       - return async write errors to application if possible (2248)
       - 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

also:

 - disable openib on 2.6 until that gets fixed

21 files changed:
lustre/ChangeLog
lustre/autoMakefile.am
lustre/kernel_patches/kernel_configs/kernel-2.6.5-2.6-suse-i686-bigsmp.config [moved from lustre/kernel_patches/kernel_configs/kernel-2.6.5-2.6-suse-i686-smp.config with 99% similarity]
lustre/kernel_patches/kernel_configs/kernel-2.6.5-2.6-suse-i686.config
lustre/kernel_patches/patches/ext3-delete_thread-2.4.21-suse-171.patch [new file with mode: 0644]
lustre/kernel_patches/patches/kernel_text_address-2.4.21-suse-171.patch [new file with mode: 0644]
lustre/kernel_patches/patches/linux-2.4.21-xattr-0.8.54-suse-171.patch [new file with mode: 0644]
lustre/kernel_patches/patches/lookup-stack-symbols-2.4.21-suse-171.patch [new file with mode: 0644]
lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch
lustre/kernel_patches/series/suse-2.4.21-jvn [moved from lustre/kernel_patches/series/suse-2.4.21-171 with 86% similarity]
lustre/kernel_patches/targets/2.6-suse.target.in
lustre/kernel_patches/which_patch
lustre/portals/archdep.m4
lustre/scripts/Makefile.am
lustre/scripts/lbuild
lustre/scripts/lmake
lustre/scripts/lustre-kernel-2.4.spec.in
lustre/scripts/suse-functions.sh [new file with mode: 0644]
lustre/scripts/suse-post.sh [new file with mode: 0644]
lustre/scripts/suse-postun.sh [new file with mode: 0644]
lustre/scripts/suse-trigger-script.sh.in [new file with mode: 0644]

index 85f9bae..fe9fc16 100644 (file)
@@ -21,9 +21,10 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        * 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)
@@ -47,6 +48,10 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        - 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
index 81bde4b..f8b503c 100644 (file)
@@ -41,7 +41,7 @@ DEP = dep
 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
@@ -56,7 +56,7 @@ lvfs-sources:
        $(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
 
@@ -18,6 +18,7 @@ CONFIG_CLEAN_COMPILE=y
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=17
@@ -451,7 +452,6 @@ CONFIG_PARIDE_ON26=m
 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
@@ -602,6 +602,7 @@ CONFIG_AIC79XX_RESET_DELAY_MS=15000
 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
index f0a8a4b..349bca7 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_CLEAN_COMPILE=y
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=17
@@ -451,7 +452,6 @@ CONFIG_PARIDE_ON26=m
 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
@@ -602,6 +602,7 @@ CONFIG_AIC79XX_RESET_DELAY_MS=15000
 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
diff --git a/lustre/kernel_patches/patches/ext3-delete_thread-2.4.21-suse-171.patch b/lustre/kernel_patches/patches/ext3-delete_thread-2.4.21-suse-171.patch
new file mode 100644 (file)
index 0000000..7eb6442
--- /dev/null
@@ -0,0 +1,496 @@
+ 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 */
diff --git a/lustre/kernel_patches/patches/kernel_text_address-2.4.21-suse-171.patch b/lustre/kernel_patches/patches/kernel_text_address-2.4.21-suse-171.patch
new file mode 100644 (file)
index 0000000..4088b4f
--- /dev/null
@@ -0,0 +1,116 @@
+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);
diff --git a/lustre/kernel_patches/patches/linux-2.4.21-xattr-0.8.54-suse-171.patch b/lustre/kernel_patches/patches/linux-2.4.21-xattr-0.8.54-suse-171.patch
new file mode 100644 (file)
index 0000000..f203b15
--- /dev/null
@@ -0,0 +1,276 @@
+ 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 *);
diff --git a/lustre/kernel_patches/patches/lookup-stack-symbols-2.4.21-suse-171.patch b/lustre/kernel_patches/patches/lookup-stack-symbols-2.4.21-suse-171.patch
new file mode 100644 (file)
index 0000000..b4b1a8d
--- /dev/null
@@ -0,0 +1,245 @@
+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) (&regs->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
++}
index a3d6de3..109d949 100644 (file)
  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;
@@ -53,10 +53,10 @@ Index: linux-2.4.21-171/fs/dcache.c
  }
  
  #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;
@@ -109,7 +109,7 @@ Index: linux-2.4.21-171/fs/exec.c
                path_release(&nd);
        }
        goto out;
-@@ -1148,7 +1155,7 @@
+@@ -1147,7 +1154,7 @@
                goto close_fail;
        if (!file->f_op->write)
                goto close_fail;
@@ -118,10 +118,10 @@ Index: linux-2.4.21-171/fs/exec.c
                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...
   */
@@ -136,7 +136,7 @@ Index: linux-2.4.21-171/fs/namei.c
  /* 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
   */
@@ -157,7 +157,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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
   */
@@ -174,7 +174,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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();
@@ -184,7 +184,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        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);
                }
@@ -200,7 +200,7 @@ Index: linux-2.4.21-171/fs/namei.c
        }
        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. 
   */
@@ -210,7 +210,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        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);
@@ -223,7 +223,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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))
@@ -233,7 +233,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        struct dentry *dentry;
        struct inode *inode;
-@@ -525,12 +561,12 @@
+@@ -539,12 +575,12 @@
                                break;
                }
                /* This does the actual lookups.. */
@@ -248,7 +248,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        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) {
@@ -257,7 +257,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        dput(dentry);
                        if (err)
                                goto return_err;
-@@ -564,7 +600,7 @@
+@@ -578,7 +614,7 @@
                        nd->dentry = dentry;
                }
                err = -ENOTDIR; 
@@ -266,7 +266,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        break;
                continue;
                /* here ends the main loop */
-@@ -591,12 +627,12 @@
+@@ -605,12 +641,12 @@
                        if (err < 0)
                                break;
                }
@@ -281,7 +281,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        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) {
@@ -290,7 +290,7 @@ Index: linux-2.4.21-171/fs/namei.c
                        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; 
@@ -300,7 +300,7 @@ Index: linux-2.4.21-171/fs/namei.c
                                break;
                }
                goto return_base;
-@@ -644,6 +681,25 @@
+@@ -658,6 +695,34 @@
                 * Check the cached dentry for staleness.
                 */
                dentry = nd->dentry;
@@ -322,11 +322,20 @@ Index: linux-2.4.21-171/fs/namei.c
 +                              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;
        }
@@ -335,9 +344,9 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -350,8 +359,8 @@ Index: linux-2.4.21-171/fs/namei.c
 +      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);
  }
  
@@ -364,7 +373,7 @@ Index: linux-2.4.21-171/fs/namei.c
  /* 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 */
@@ -379,10 +388,10 @@ Index: linux-2.4.21-171/fs/namei.c
 +
 +
 +/* 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;
@@ -390,7 +399,7 @@ Index: linux-2.4.21-171/fs/namei.c
        if (*name=='/')
                return walk_init_root(name,nd);
        read_lock(&current->fs->lock);
-@@ -788,7 +864,8 @@
+@@ -802,7 +887,8 @@
   * needs parent already locked. Doesn't follow mounts.
   * SMP-safe.
   */
@@ -400,7 +409,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        struct dentry * dentry;
        struct inode *inode;
-@@ -811,13 +888,16 @@
+@@ -825,13 +911,16 @@
                        goto out;
        }
  
@@ -418,7 +427,7 @@ Index: linux-2.4.21-171/fs/namei.c
                dentry = inode->i_op->lookup(inode, new);
                unlock_kernel();
                if (!dentry)
-@@ -829,6 +909,12 @@
+@@ -843,6 +932,12 @@
        return dentry;
  }
  
@@ -431,7 +440,7 @@ Index: linux-2.4.21-171/fs/namei.c
  /* 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);
  
@@ -440,12 +449,12 @@ Index: linux-2.4.21-171/fs/namei.c
  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;
@@ -464,7 +473,7 @@ Index: linux-2.4.21-171/fs/namei.c
  /*
   * 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;
  }
  
@@ -474,7 +483,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        int error;
  
-@@ -991,12 +1095,15 @@
+@@ -1005,12 +1118,15 @@
                goto exit_lock;
  
        error = -EACCES;        /* shouldn't it be ENOSYS? */
@@ -492,7 +501,7 @@ Index: linux-2.4.21-171/fs/namei.c
        unlock_kernel();
  exit_lock:
        up(&dir->i_zombie);
-@@ -1005,6 +1112,11 @@
+@@ -1019,6 +1135,11 @@
        return error;
  }
  
@@ -504,7 +513,7 @@ Index: linux-2.4.21-171/fs/namei.c
  /*
   *    open_namei()
   *
-@@ -1019,7 +1131,8 @@
+@@ -1033,7 +1154,8 @@
   * for symlinks (where the permissions are checked later).
   * SMP-safe
   */
@@ -514,7 +523,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        int acc_mode, error = 0;
        struct inode *inode;
-@@ -1029,11 +1142,14 @@
+@@ -1043,11 +1165,14 @@
  
        acc_mode = ACC_MODE(flag);
  
@@ -530,7 +539,7 @@ Index: linux-2.4.21-171/fs/namei.c
                if (error)
                        return error;
                dentry = nd->dentry;
-@@ -1043,6 +1159,10 @@
+@@ -1057,6 +1182,10 @@
        /*
         * Create - we need to know the parent.
         */
@@ -541,7 +550,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -550,7 +559,7 @@ Index: linux-2.4.21-171/fs/namei.c
  
  do_last:
        error = PTR_ERR(dentry);
-@@ -1067,11 +1187,12 @@
+@@ -1081,11 +1210,12 @@
                goto exit;
        }
  
@@ -564,7 +573,7 @@ Index: linux-2.4.21-171/fs/namei.c
                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);
                        
@@ -573,7 +582,7 @@ Index: linux-2.4.21-171/fs/namei.c
                }
                put_write_access(inode);
                if (error)
-@@ -1191,8 +1312,10 @@
+@@ -1205,8 +1335,10 @@
        return 0;
  
  exit_dput:
@@ -584,7 +593,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -595,7 +604,7 @@ Index: linux-2.4.21-171/fs/namei.c
        dput(dentry);
        if (error)
                return error;
-@@ -1233,13 +1359,20 @@
+@@ -1247,13 +1382,20 @@
        }
        dir = nd->dentry;
        down(&dir->d_inode->i_sem);
@@ -618,7 +627,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        struct dentry *dentry;
  
-@@ -1247,7 +1380,7 @@
+@@ -1261,7 +1403,7 @@
        dentry = ERR_PTR(-EEXIST);
        if (nd->last_type != LAST_NORM)
                goto fail;
@@ -627,12 +636,16 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -645,7 +658,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -653,11 +666,15 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -669,7 +686,7 @@ Index: linux-2.4.21-171/fs/namei.c
                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);
@@ -677,7 +694,7 @@ Index: linux-2.4.21-171/fs/namei.c
                path_release(&nd);
  out:
                putname(tmp);
-@@ -1481,8 +1632,16 @@
+@@ -1495,8 +1663,16 @@
                        error = -EBUSY;
                        goto exit1;
        }
@@ -695,7 +712,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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;
@@ -712,11 +729,15 @@ Index: linux-2.4.21-171/fs/namei.c
        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);
@@ -738,11 +759,15 @@ Index: linux-2.4.21-171/fs/namei.c
                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);
@@ -754,7 +779,7 @@ Index: linux-2.4.21-171/fs/namei.c
                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,
@@ -763,7 +788,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        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,
@@ -772,7 +797,7 @@ Index: linux-2.4.21-171/fs/namei.c
  {
        int error;
  
-@@ -1903,9 +2084,18 @@
+@@ -1917,9 +2123,18 @@
        if (newnd.last_type != LAST_NORM)
                goto exit2;
  
@@ -792,7 +817,7 @@ Index: linux-2.4.21-171/fs/namei.c
        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;
        }
@@ -811,7 +836,7 @@ Index: linux-2.4.21-171/fs/namei.c
        dput(new_dentry);
  exit4:
        dput(old_dentry);
-@@ -1981,20 +2171,26 @@
+@@ -1995,20 +2210,26 @@
  }
  
  static inline int __attribute__((always_inline))
@@ -840,7 +865,7 @@ Index: linux-2.4.21-171/fs/namei.c
  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)
  {
@@ -855,7 +880,7 @@ Index: linux-2.4.21-171/fs/namei.c
  }
  
  /* get the link contents into pagecache */
-@@ -2060,7 +2262,7 @@
+@@ -2074,7 +2301,7 @@
  {
        struct page *page = NULL;
        char *s = page_getlink(dentry, &page);
@@ -864,10 +889,10 @@ Index: linux-2.4.21-171/fs/namei.c
        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;
@@ -981,11 +1006,11 @@ Index: linux-2.4.21-171/fs/namespace.c
        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))
@@ -994,7 +1019,7 @@ Index: linux-2.4.21-171/fs/open.c
  
  int vfs_statfs(struct super_block *sb, struct statfs *buf)
  {
-@@ -95,9 +97,10 @@
+@@ -96,9 +98,10 @@
        write_unlock(&files->file_lock);
  }
  
@@ -1006,7 +1031,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1021,7 +1046,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1036,7 +1061,7 @@ Index: linux-2.4.21-171/fs/open.c
        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);
@@ -1051,7 +1076,7 @@ Index: linux-2.4.21-171/fs/open.c
        path_release(&nd);
  out:
        return error;
-@@ -217,7 +229,7 @@
+@@ -218,7 +230,7 @@
  
        error = locks_verify_truncate(inode, file, length);
        if (!error)
@@ -1060,7 +1085,7 @@ Index: linux-2.4.21-171/fs/open.c
  out_putf:
        fput(file);
  out:
-@@ -262,11 +274,13 @@
+@@ -263,11 +275,13 @@
        struct inode * inode;
        struct iattr newattrs;
  
@@ -1075,7 +1100,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1102,7 +1127,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
  
@@ -1118,7 +1143,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1140,7 +1165,7 @@ Index: linux-2.4.21-171/fs/open.c
                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;
@@ -1148,7 +1173,7 @@ Index: linux-2.4.21-171/fs/open.c
  
        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;
  
@@ -1164,7 +1189,7 @@ Index: linux-2.4.21-171/fs/open.c
                path_release(&nd);
        }
  
-@@ -387,8 +432,9 @@
+@@ -388,8 +433,9 @@
  {
        int error;
        struct nameidata nd;
@@ -1175,7 +1200,7 @@ Index: linux-2.4.21-171/fs/open.c
        if (error)
                goto out;
  
-@@ -399,6 +445,7 @@
+@@ -400,6 +446,7 @@
        set_fs_pwd(current->fs, nd.mnt, nd.dentry);
  
  dput_and_out:
@@ -1183,7 +1208,7 @@ Index: linux-2.4.21-171/fs/open.c
        path_release(&nd);
  out:
        return error;
-@@ -438,9 +485,10 @@
+@@ -439,9 +486,10 @@
  {
        int error;
        struct nameidata nd;
@@ -1196,7 +1221,7 @@ Index: linux-2.4.21-171/fs/open.c
        if (error)
                goto out;
  
-@@ -456,39 +504,56 @@
+@@ -457,39 +505,56 @@
        set_fs_altroot();
        error = 0;
  dput_and_out:
@@ -1267,7 +1292,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1299,7 +1324,7 @@ Index: linux-2.4.21-171/fs/open.c
        path_release(&nd);
  out:
        return error;
-@@ -540,6 +589,20 @@
+@@ -541,6 +590,20 @@
        error = -EROFS;
        if (IS_RDONLY(inode))
                goto out;
@@ -1320,7 +1345,7 @@ Index: linux-2.4.21-171/fs/open.c
        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;
@@ -1328,7 +1353,7 @@ Index: linux-2.4.21-171/fs/open.c
  
        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;
  
@@ -1349,7 +1374,7 @@ Index: linux-2.4.21-171/fs/open.c
  {
        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) {
@@ -1359,7 +1384,7 @@ Index: linux-2.4.21-171/fs/open.c
                if (error)
                        goto cleanup_all;
        }
-@@ -698,6 +765,7 @@
+@@ -699,6 +766,7 @@
                                      !inode->i_mapping->a_ops->direct_IO))
                goto cleanup_all;
  
@@ -1367,7 +1392,7 @@ Index: linux-2.4.21-171/fs/open.c
        return f;
  
  cleanup_all:
-@@ -710,11 +778,17 @@
+@@ -711,11 +779,17 @@
  cleanup_file:
        put_filp(f);
  cleanup_dentry:
@@ -1385,11 +1410,11 @@ Index: linux-2.4.21-171/fs/open.c
  /*
   * 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
@@ -1398,15 +1423,13 @@ Index: linux-2.4.21-171/fs/stat.c
  {
        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;
@@ -1424,7 +1447,7 @@ Index: linux-2.4.21-171/fs/stat.c
                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;
@@ -1442,7 +1465,7 @@ Index: linux-2.4.21-171/fs/stat.c
                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;
@@ -1460,7 +1483,7 @@ Index: linux-2.4.21-171/fs/stat.c
                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;
@@ -1478,7 +1501,7 @@ Index: linux-2.4.21-171/fs/stat.c
                path_release(&nd);
        }
        return error;
-@@ -222,7 +234,7 @@
+@@ -222,7 +232,7 @@
        if (f) {
                struct dentry * dentry = f->f_dentry;
  
@@ -1487,7 +1510,7 @@ Index: linux-2.4.21-171/fs/stat.c
                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;
  
@@ -1496,7 +1519,7 @@ Index: linux-2.4.21-171/fs/stat.c
                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 &&
@@ -1505,7 +1528,7 @@ Index: linux-2.4.21-171/fs/stat.c
                        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;
@@ -1522,7 +1545,7 @@ Index: linux-2.4.21-171/fs/stat.c
                path_release(&nd);
        }
        return error;
-@@ -354,12 +368,14 @@
+@@ -354,12 +366,14 @@
  {
        struct nameidata nd;
        int error;
@@ -1539,7 +1562,7 @@ Index: linux-2.4.21-171/fs/stat.c
                path_release(&nd);
        }
        return error;
-@@ -374,7 +390,7 @@
+@@ -374,7 +388,7 @@
        if (f) {
                struct dentry * dentry = f->f_dentry;
  
@@ -1548,10 +1571,10 @@ Index: linux-2.4.21-171/fs/stat.c
                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>
@@ -1635,10 +1658,10 @@ Index: linux-2.4.21-171/include/linux/dcache.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
@@ -1766,10 +1789,10 @@ Index: linux-2.4.21-171/include/linux/fs.h
  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;
@@ -1796,10 +1819,10 @@ Index: linux-2.4.21-171/include/linux/fs_struct.h
                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 */
@@ -1815,11 +1838,11 @@ Index: linux-2.4.21-171/kernel/exit.c
                        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);
@@ -1833,11 +1856,11 @@ Index: linux-2.4.21-171/kernel/fork.c
                        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);
similarity index 86%
rename from lustre/kernel_patches/series/suse-2.4.21-171
rename to lustre/kernel_patches/series/suse-2.4.21-jvn
index 6a0919e..6751795 100644 (file)
@@ -8,10 +8,10 @@ invalidate_show.patch
 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 
@@ -27,3 +27,4 @@ ext3-raw-lookup.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
index a914114..9166d1b 100644 (file)
@@ -1,19 +1,21 @@
 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=""
 
index 0421ab3..05d8b98 100644 (file)
@@ -1,8 +1,11 @@
 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
index 5354226..26e86ed 100644 (file)
@@ -141,12 +141,22 @@ if test x$enable_modules != xno ; then
                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],
@@ -241,7 +251,7 @@ _ACEOF
 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
@@ -266,8 +276,8 @@ if test x$enable_modules != xno ; then
                [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.])])
 
@@ -278,7 +288,7 @@ if test x$enable_modules != xno ; then
        # 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
@@ -292,22 +302,9 @@ if test x$enable_modules != xno ; then
                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
@@ -325,6 +322,20 @@ if test x$enable_modules != xno ; then
                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])
@@ -466,6 +477,7 @@ if test x$enable_modules != xno ; then
        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"
@@ -488,6 +500,7 @@ if test x$enable_modules != xno ; then
        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
        AC_SUBST(OPENIBCPPFLAGS)
        AC_SUBST(OPENIBNAL)
+       fi
 
        #### Infinicon IB
        AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
@@ -660,8 +673,8 @@ if test x$enable_modules != xno ; then
                        #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;
index e400307..86b9255 100644 (file)
@@ -6,7 +6,8 @@
 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
index 1c01eb0..136279a 100755 (executable)
@@ -21,6 +21,7 @@ CONFIG=
 VERSION=
 
 RHBUILD=0
+SUSEBUILD=0
 LINUX26=0
 SUSEBUILD=0
 
@@ -29,6 +30,7 @@ BIGMEM_ARCHS=
 BOOT_ARCHS=
 JENSEN_ARCHS=
 SMP_ARCHS=
+BIGSMP_ARCHS=
 UP_ARCHS=
 
 DATE=$(date)
@@ -197,7 +199,7 @@ load_target()
     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
@@ -322,8 +324,10 @@ prep_build()
        -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" \
@@ -333,9 +337,10 @@ prep_build()
     [ -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
 }
 
index b15c4eb..8613723 100755 (executable)
@@ -32,8 +32,12 @@ BIGMEM_ARCHS=
 BOOT_ARCHS=
 JENSEN_ARCHS=
 SMP_ARCHS=
+BIGSMP_ARCHS=
 UP_ARCHS=
 
+RHBUILD=0
+SUSEBUILD=0
+
 # flat-out globals
 TOPDIR=
 TARGET_FILE=
@@ -129,9 +133,9 @@ Options:
     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.
@@ -310,18 +314,19 @@ depend_kernel()
     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
@@ -420,6 +425,9 @@ install_kernel()
 
            ;;
     esac
+    if [ -e init/kerntypes.o ] ; then
+       cp init/kerntypes.o "$DESTDIR/boot/Kerntypes-${FULL_VERSION}"
+    fi
 
     popd >/dev/null
 }
@@ -427,12 +435,64 @@ install_kernel()
 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..."
@@ -470,6 +530,9 @@ save_all_headers()
        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
@@ -583,9 +646,13 @@ build_kernel
 configure_lustre
 build_lustre
 
+build_kms
+
 install_kernel
 install_lustre
 
+install_kms
+
 save_all_headers
 
 exit 0
index f7f6a70..8267879 100644 (file)
@@ -21,6 +21,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define nptlarchs %{all_x86}
 #define nptlarchs noarch
 %define rhbuild @RHBUILD@
+%define susebuild @SUSEBUILD@
 %define linux26 @LINUX26@
 
 # disable build root strip policy
@@ -49,6 +50,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildBOOT 0
 %define buildjensen 0
 %define buildsmp 0
+%define buildbigsmp 0
 %define buildup 0
 %define buildsrc 0
 
@@ -72,6 +74,10 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildsmp 1
 %endif
 
+%ifarch @BIGSMP_ARCHS@
+%define buildbigsmp 1
+%endif
+
 %ifarch @UP_ARCHS@
 %define buildup 1
 %endif
@@ -79,6 +85,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 # 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
@@ -97,6 +104,7 @@ Second, per-architecture exclusions (ifarch)
 # 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}
@@ -162,12 +170,18 @@ Source15: linux-rhconfig.h
 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.
@@ -213,6 +227,26 @@ work fine on single-CPU boxes.
 
 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
@@ -316,6 +350,63 @@ sh -x ./scripts/lmake \
        --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
@@ -413,6 +504,10 @@ BuildKernel jensen
 BuildKernel smp
 %endif
 
+%if %{buildbigsmp}
+BuildKernel bigsmp
+%endif
+
 %if %{buildup}
 BuildKernel
 %endif
@@ -441,113 +536,182 @@ done
 # 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
 
@@ -560,60 +724,26 @@ rm -rf $RPM_BUILD_ROOT
 
 # 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
 
@@ -630,42 +760,30 @@ if [ -f /etc/init.d/lustre ] ; then
 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
@@ -675,6 +793,9 @@ fi
 %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 || :
 
@@ -730,6 +851,10 @@ fi
 %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}
@@ -744,6 +869,28 @@ fi
 %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}
@@ -758,6 +905,10 @@ fi
 %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}
@@ -772,6 +923,10 @@ fi
 %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}
@@ -781,6 +936,10 @@ fi
 %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
diff --git a/lustre/scripts/suse-functions.sh b/lustre/scripts/suse-functions.sh
new file mode 100644 (file)
index 0000000..a7e421d
--- /dev/null
@@ -0,0 +1,22 @@
+# 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"
+}
diff --git a/lustre/scripts/suse-post.sh b/lustre/scripts/suse-post.sh
new file mode 100644 (file)
index 0000000..ec38664
--- /dev/null
@@ -0,0 +1,46 @@
+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
diff --git a/lustre/scripts/suse-postun.sh b/lustre/scripts/suse-postun.sh
new file mode 100644 (file)
index 0000000..eb86d03
--- /dev/null
@@ -0,0 +1,43 @@
+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
diff --git a/lustre/scripts/suse-trigger-script.sh.in b/lustre/scripts/suse-trigger-script.sh.in
new file mode 100644 (file)
index 0000000..0ead9e8
--- /dev/null
@@ -0,0 +1,9 @@
+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