[Pkg-lustre-svn-commit] r510 - in /trunk/debian/patches: 00list bug16680_detect_on_disc_corruption.dpatch patchless_support_2.6.26.dpatch

winnie at users.alioth.debian.org winnie at users.alioth.debian.org
Fri Sep 19 07:43:42 UTC 2008


Author: winnie
Date: Fri Sep 19 07:43:42 2008
New Revision: 510

URL: http://svn.debian.org/wsvn/pkg-lustre/?sc=1&rev=510
Log:
Forked patchless_support_2.6.24 since there are patches inside for upcoming 2.6.27 kernel

Added patch from bug 16680, in oder to (maybe) fix ost oops

Added:
    trunk/debian/patches/bug16680_detect_on_disc_corruption.dpatch
    trunk/debian/patches/patchless_support_2.6.26.dpatch   (with props)
Modified:
    trunk/debian/patches/00list

Modified: trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/00list?rev=510&op=diff
==============================================================================
--- trunk/debian/patches/00list (original)
+++ trunk/debian/patches/00list Fri Sep 19 07:43:42 2008
@@ -15,6 +15,7 @@
 fix_late_release_pa_structure.dpatch
 bug16906_FULL_state_server_in_recovery.dpatch
 patchless_support_2.6.24.dpatch
+bug16680_detect_on_disc_corruption.dpatch
 # Debian patches
 bash_completion.dpatch
 lustre_manpage.dpatch

Added: trunk/debian/patches/bug16680_detect_on_disc_corruption.dpatch
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/bug16680_detect_on_disc_corruption.dpatch?rev=510&op=file
==============================================================================
--- trunk/debian/patches/bug16680_detect_on_disc_corruption.dpatch (added)
+++ trunk/debian/patches/bug16680_detect_on_disc_corruption.dpatch Fri Sep 19 07:43:42 2008
@@ -1,0 +1,449 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## lustre_manpatch.dpatch by Patrick Winnert <winnie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: registred symbol not allowed.
+
+ at DPATCH@
+Index: ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch
+===================================================================
+RCS file: /cvsroot/cfs/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch,v
+retrieving revision 1.19
+diff -p -u -r1.19 ext3-mballoc3-core.patch
+--- ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch	26 Jul 2008 11:08:13 -0000	1.19
++++ ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch	19 Sep 2008 06:54:56 -0000
+@@ -1,8 +1,8 @@
+-Index: linux-2.6.5-7.311/include/linux/ext3_fs.h
++Index: linux-2.6.18-53.1.19/include/linux/ext3_fs.h
+ ===================================================================
+---- linux-2.6.5-7.311.orig/include/linux/ext3_fs.h
+-+++ linux-2.6.5-7.311/include/linux/ext3_fs.h
+-@@ -57,6 +57,30 @@ struct statfs;
++--- linux-2.6.18-53.1.19.orig/include/linux/ext3_fs.h	2008-09-18 15:44:26.000000000 +0400
+++++ linux-2.6.18-53.1.19/include/linux/ext3_fs.h	2008-09-18 15:44:26.000000000 +0400
++@@ -53,6 +53,30 @@
+  #define ext3_debug(f, a...)	do {} while (0)
+  #endif
+  
+@@ -33,7 +33,7 @@ Index: linux-2.6.5-7.311/include/linux/e
+  /*
+   * Special inodes numbers
+   */
+-@@ -361,6 +385,14 @@ struct ext3_inode {
++@@ -398,6 +422,14 @@ struct ext3_inode {
+  #define ext3_find_first_zero_bit	ext2_find_first_zero_bit
+  #define ext3_find_next_zero_bit		ext2_find_next_zero_bit
+  
+@@ -48,7 +48,7 @@ Index: linux-2.6.5-7.311/include/linux/e
+  /*
+   * Maximal mount counts between two filesystem checks
+   */
+-@@ -735,6 +767,20 @@ extern unsigned long ext3_count_dirs (st
++@@ -799,6 +831,20 @@ extern unsigned long ext3_count_dirs (st
+  extern void ext3_check_inodes_bitmap (struct super_block *);
+  extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
+  
+@@ -68,9 +68,9 @@ Index: linux-2.6.5-7.311/include/linux/e
+ +
+  
+  /* inode.c */
+- extern int ext3_block_truncate_page(handle_t *, struct page *,
+-@@ -769,6 +815,10 @@ extern int ext3_htree_fill_tree(struct f
+- 				__u32 start_minor_hash, __u32 *next_hash);
++ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
++@@ -843,6 +889,10 @@ extern int ext3_group_extend(struct supe
++ 				ext3_fsblk_t n_blocks_count);
+  
+  /* super.c */
+ +extern struct proc_dir_entry *proc_root_ext3;
+@@ -80,13 +80,13 @@ Index: linux-2.6.5-7.311/include/linux/e
+  extern void ext3_error (struct super_block *, const char *, const char *, ...)
+  	__attribute__ ((format (printf, 3, 4)));
+  extern void __ext3_std_error (struct super_block *, const char *, int);
+-Index: linux-2.6.5-7.311/include/linux/ext3_fs_sb.h
++Index: linux-2.6.18-53.1.19/include/linux/ext3_fs_sb.h
+ ===================================================================
+---- linux-2.6.5-7.311.orig/include/linux/ext3_fs_sb.h
+-+++ linux-2.6.5-7.311/include/linux/ext3_fs_sb.h
+-@@ -78,6 +78,61 @@ struct ext3_sb_info {
+- 	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 */
++--- linux-2.6.18-53.1.19.orig/include/linux/ext3_fs_sb.h	2008-09-18 15:44:26.000000000 +0400
+++++ linux-2.6.18-53.1.19/include/linux/ext3_fs_sb.h	2008-09-18 15:44:26.000000000 +0400
++@@ -88,6 +88,61 @@ struct ext3_sb_info {
++ 	unsigned long s_ext_blocks;
++ 	unsigned long s_ext_extents;
+  #endif
+ +
+ +	/* for buddy allocator */
+@@ -146,11 +146,11 @@ Index: linux-2.6.5-7.311/include/linux/e
+ +				 [(group) & (EXT3_DESC_PER_BLOCK(sb) - 1)]
+ +
+  #endif	/* _LINUX_EXT3_FS_SB */
+-Index: linux-2.6.5-7.311/fs/ext3/super.c
++Index: linux-2.6.18-53.1.19/fs/ext3/super.c
+ ===================================================================
+---- linux-2.6.5-7.311.orig/fs/ext3/super.c
+-+++ linux-2.6.5-7.311/fs/ext3/super.c
+-@@ -389,6 +389,7 @@ void ext3_put_super (struct super_block 
++--- linux-2.6.18-53.1.19.orig/fs/ext3/super.c	2008-09-18 15:44:26.000000000 +0400
+++++ linux-2.6.18-53.1.19/fs/ext3/super.c	2008-09-18 15:44:26.000000000 +0400
++@@ -391,6 +391,7 @@ static void ext3_put_super (struct super
+  	struct ext3_super_block *es = sbi->s_es;
+  	int i;
+  
+@@ -158,7 +158,7 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+  	ext3_ext_release(sb);
+  	ext3_xattr_put_super(sb);
+  	journal_destroy(sbi->s_journal);
+-@@ -428,6 +429,8 @@ void ext3_put_super (struct super_block 
++@@ -433,6 +434,8 @@ static void ext3_put_super (struct super
+  		invalidate_bdev(sbi->journal_bdev, 0);
+  		ext3_blkdev_remove(sbi);
+  	}
+@@ -167,16 +167,16 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+  	sb->s_fs_info = NULL;
+  	kfree(sbi);
+  	return;
+-@@ -453,6 +456,8 @@ static struct inode *ext3_alloc_inode(st
++@@ -458,6 +461,8 @@ static struct inode *ext3_alloc_inode(st
+  	ei->vfs_inode.i_version = 1;
+- 	
++ 
+  	memset(&ei->i_cached_extent, 0, sizeof(ei->i_cached_extent));
+ +	INIT_LIST_HEAD(&ei->i_prealloc_list);
+ +	spin_lock_init(&ei->i_prealloc_lock);
+  	return &ei->vfs_inode;
+  }
+  
+-@@ -1151,6 +1156,13 @@ static int ext3_fill_super (struct super
++@@ -1454,6 +1459,13 @@ static int ext3_fill_super (struct super
+  	sbi->s_mount_opt = 0;
+  	sbi->s_resuid = EXT3_DEF_RESUID;
+  	sbi->s_resgid = EXT3_DEF_RESGID;
+@@ -188,9 +188,9 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+ +		return -ENOMEM;
+ +	}
+  
+- 	blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
+- 	if (!blocksize) {
+-@@ -1526,6 +1538,8 @@ failed_mount:
++ 	unlock_kernel();
++ 
++@@ -1857,6 +1869,8 @@ failed_mount:
+  	ext3_blkdev_remove(sbi);
+  	brelse(bh);
+  out_fail:
+@@ -198,8 +198,8 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+ +	sbi->s_dev_proc = NULL;
+  	sb->s_fs_info = NULL;
+  	kfree(sbi);
+- 	return -EINVAL;
+-@@ -2158,9 +2172,46 @@ static struct file_system_type ext3_fs_t
++ 	lock_kernel();
++@@ -2782,9 +2796,46 @@ static struct file_system_type ext3_fs_t
+  	.fs_flags	= FS_REQUIRES_DEV,
+  };
+  
+@@ -247,7 +247,7 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+  	if (err)
+  		return err;
+  	err = init_inodecache();
+-@@ -2189,6 +2240,7 @@ static void __exit exit_ext3_fs(void)
++@@ -2806,6 +2857,7 @@ static void __exit exit_ext3_fs(void)
+  	unregister_filesystem(&ext3_fs_type);
+  	destroy_inodecache();
+  	exit_ext3_xattr();
+@@ -255,11 +255,11 @@ Index: linux-2.6.5-7.311/fs/ext3/super.c
+  }
+  
+  int ext3_map_inode_page(struct inode *inode, struct page *page,
+-Index: linux-2.6.5-7.311/fs/ext3/mballoc.c
++Index: linux-2.6.18-53.1.19/fs/ext3/mballoc.c
+ ===================================================================
+---- /dev/null
+-+++ linux-2.6.5-7.311/fs/ext3/mballoc.c
+-@@ -0,0 +1,4385 @@
++--- linux-2.6.18-53.1.19.orig/fs/ext3/mballoc.c	2008-09-03 21:31:05.040005509 +0400
+++++ linux-2.6.18-53.1.19/fs/ext3/mballoc.c	2008-09-19 10:44:57.000000000 +0400
++@@ -0,0 +1,4469 @@
+ +/*
+ + * Copyright 2008 Sun Microsystems, Inc.
+ + * Written by Alex Tomas <alex at clusterfs.com>
+@@ -589,6 +589,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	unsigned short	bb_free;
+ +	unsigned short	bb_fragments;
+ +	struct		list_head bb_prealloc_list;
+++	unsigned long   bb_prealloc_nr;
+ +#ifdef DOUBLE_CHECK
+ +	void		*bb_bitmap;
+ +#endif
+@@ -692,7 +693,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	__u16 tail;	/* what tail broke some buddy */
+ +	__u16 buddy;	/* buddy the tail ^^^ broke */
+ +	__u16 flags;
+-+	__u8 cr:3;	/* which phase the result extent was found at */
+++	__u8 cr:8;	/* which phase the result extent was found at */
+ +	__u8 op:4;
+ +	__u8 merged:1;
+ +};
+@@ -725,7 +726,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +void ext3_mb_release_blocks(struct super_block *, int);
+ +void ext3_mb_poll_new_transaction(struct super_block *, handle_t *);
+ +void ext3_mb_free_committed_blocks(struct super_block *);
+-+void ext3_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group);
+++int ext3_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group);
+ +void ext3_mb_free_consumed_preallocations(struct ext3_allocation_context *ac);
+ +void ext3_mb_return_to_preallocation(struct inode *inode, struct ext3_buddy *e3b,
+ +					sector_t block, int count);
+@@ -1150,8 +1151,12 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	grp->bb_fragments = fragments;
+ +
+ +	if (free != grp->bb_free) {
+-+		printk("EXT3-fs: group %u: %u blocks in bitmap, %u in gd\n",
+-+			group, free, grp->bb_free);
+++		struct ext3_group_desc *gdp;
+++		gdp = ext3_get_group_desc (sb, group, NULL);
+++		printk("EXT3-fs: group %u: %u blocks in bitmap, %u in bb, "
+++			"%u in gd, %lu pa's\n", group, free, grp->bb_free,
+++			le16_to_cpu(gdp->bg_free_blocks_count),
+++			grp->bb_prealloc_nr);
+ +		grp->bb_free = free;
+ +	}
+ +
+@@ -1239,8 +1244,9 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +		if (!buffer_uptodate(bh[i]))
+ +			goto out;
+ +
+++	err = 0;
+ +	first_block = page->index * blocks_per_page;
+-+	for (i = 0; i < blocks_per_page; i++) {
+++	for (i = 0; i < blocks_per_page && err == 0; i++) {
+ +		int group;
+ +
+ +		group = (first_block + i) >> 1;
+@@ -1272,13 +1278,14 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +			memcpy(data, bitmap, blocksize);
+ +
+ +			/* mark all preallocated blocks used in in-core bitmap */
+-+			ext3_mb_generate_from_pa(sb, data, group);
+++			err = ext3_mb_generate_from_pa(sb, data, group);
+ +			ext3_unlock_group(sb, group);
+ +
+ +			incore = data;
+ +		}
+ +	}
+-+	SetPageUptodate(page);
+++	if (likely(err == 0))
+++		SetPageUptodate(page);
+ +
+ +out:
+ +	if (bh) {
+@@ -2233,6 +2240,8 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +			hs->result.fe_start, hs->result.fe_len);
+ +		seq_printf(seq, "%-5u %-8u %-23s free\n",
+ +				hs->pid, hs->ino, buf2);
+++	} else {
+++		seq_printf(seq, "unknown op %d\n", hs->op);
+ +	}
+ +	return 0;
+ +}
+@@ -2358,8 +2367,9 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +static int ext3_mb_seq_groups_show(struct seq_file *seq, void *v)
+ +{
+ +	struct super_block *sb = seq->private;
+++	struct ext3_group_desc *gdp;
+ +	long group = (long) v;
+-+	int i, err;
+++	int i, err, free = 0;
+ +	struct ext3_buddy e3b;
+ +	struct sg {
+ +		struct ext3_group_info info;
+@@ -2368,10 +2378,10 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +
+ +	group--;
+ +	if (group == 0)
+-+		seq_printf(seq, "#%-5s: %-5s %-5s %-5s "
+++		seq_printf(seq, "#%-5s: %-5s %-5s %-5s %-5s %-5s "
+ +				"[ %-5s %-5s %-5s %-5s %-5s %-5s %-5s "
+ +				  "%-5s %-5s %-5s %-5s %-5s %-5s %-5s ]\n",
+-+			   "group", "free", "frags", "first",
+++			   "group", "free", "ingd", "frags", "first", "pa",
+ +			   "2^0", "2^1", "2^2", "2^3", "2^4", "2^5","2^6",
+ +			   "2^7", "2^8", "2^9", "2^10", "2^11", "2^12", "2^13");
+ +
+@@ -2382,13 +2392,20 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +		seq_printf(seq, "#%-5lu: I/O error\n", group);
+ +		return 0;
+ +	}
+++
+++	gdp = ext3_get_group_desc(sb, group, NULL);
+++	if (gdp != NULL)
+++		free = le16_to_cpu(gdp->bg_free_blocks_count);
+++
+ +	ext3_lock_group(sb, group);
+ +	memcpy(&sg, EXT3_GROUP_INFO(sb, group), i);
+ +	ext3_unlock_group(sb, group);
+ +	ext3_mb_release_desc(&e3b);
+ +
+-+	seq_printf(seq, "#%-5lu: %-5u %-5u %-5u [", group, sg.info.bb_free,
+-+			sg.info.bb_fragments, sg.info.bb_first_free);
+++	seq_printf(seq, "#%-5lu: %-5u %-5u %-5u %-5u %-5lu [", group,
+++			sg.info.bb_free, free,
+++			sg.info.bb_fragments, sg.info.bb_first_free,
+++			sg.info.bb_prealloc_nr);
+ +	for (i = 0; i <= 13; i++)
+ +		seq_printf(seq, " %-5u", i <= sb->s_blocksize_bits + 1 ?
+ +				sg.info.bb_counters[i] : 0);
+@@ -2489,6 +2506,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	h.result = ac->ac_b_ex;
+ +	h.flags = ac->ac_flags;
+ +	h.merged = 0;
+++	h.cr = ac->ac_criteria;
+ +	if (ac->ac_op == EXT3_MB_HISTORY_ALLOC) {
+ +		if (ac->ac_g_ex.fe_start == ac->ac_b_ex.fe_start &&
+ +				ac->ac_g_ex.fe_group == ac->ac_b_ex.fe_group)
+@@ -3558,17 +3576,59 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +}
+ +
+ +/*
+++ * check free blocks in bitmap match free block in group descriptor
+++ * do this before taking preallocated blocks into account to be able
+++ * to detect on-disk corruptions
+++ */
+++int ext3_mb_check_ondisk_bitmap(struct super_block *sb, void *bitmap,
+++				struct ext3_group_desc *gdp, int group)
+++{
+++	unsigned short max = EXT3_BLOCKS_PER_GROUP(sb);
+++	unsigned short i, first, free = 0;
+++
+++	i = mb_find_next_zero_bit(bitmap, max, 0);
+++
+++	while (i < max) {
+++		first = i;
+++		i = ext2_find_next_le_bit(bitmap, max, i);
+++		if (i > max)
+++			i = max;
+++		free += i - first;
+++		if (i < max)
+++			i = mb_find_next_zero_bit(bitmap, max, i);
+++	}
+++
+++	if (free != le16_to_cpu(gdp->bg_free_blocks_count)) {
+++		ext3_error(sb, __FUNCTION__, "on-disk bitmap for group %d"
+++			"corrupted: %u blocks free in bitmap, %u - in gd\n",
+++			group, free, le16_to_cpu(gdp->bg_free_blocks_count));
+++		return -EIO;
+++	}
+++	return 0;
+++}
+++
+++/*
+ + * the function goes through all preallocation in this group and marks them
+ + * used in in-core bitmap. buddy must be generated from this bitmap
+ + */
+-+void ext3_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group)
+++int ext3_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group)
+ +{
+ +	struct ext3_group_info *grp = EXT3_GROUP_INFO(sb, group);
+ +	struct ext3_prealloc_space *pa;
+++	struct ext3_group_desc *gdp;
+ +	struct list_head *cur;
+ +	unsigned long groupnr;
+ +	unsigned long start;
+-+	int preallocated = 0, count = 0, len;
+++	int preallocated = 0, count = 0, len, skip = 0, err;
+++
+++	gdp = ext3_get_group_desc (sb, group, NULL);
+++	if (gdp == NULL)
+++		return -EIO;
+++
+++	/* before applying preallocations, check bitmap consistency */
+++	err = ext3_mb_check_ondisk_bitmap(sb, bitmap, gdp, group);
+++	if (err)
+++		return err;
+ +
+ + 	/* all form of preallocation discards first load group,
+ +	 * so the only competing code is preallocation use.
+@@ -3584,14 +3644,30 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +		ext3_get_group_no_and_offset(sb, pa->pa_pstart, &groupnr, &start);
+ +		len = pa->pa_len;
+ +		spin_unlock(&pa->pa_lock);
+-+		if (unlikely(len == 0))
+++		if (unlikely(len == 0)) {
+++			skip++;
+ +			continue;
+++		}
+ +		BUG_ON(groupnr != group && len != 0);
+ +		mb_set_bits(sb_bgl_lock(EXT3_SB(sb), group), bitmap, start,len);
+ +		preallocated += len;
+ +		count++;
+ +	}
+++	if (count + skip != grp->bb_prealloc_nr) {
+++		ext3_error(sb, __FUNCTION__, "lost preallocations: "
+++			"count %d, bb_prealloc_nr %lu, skip %d\n",
+++			count, grp->bb_prealloc_nr, skip);
+++		return -EIO;
+++	}
+++	if (preallocated+le16_to_cpu(gdp->bg_free_blocks_count)!=grp->bb_free) {
+++		ext3_error(sb, __FUNCTION__, "in-core bitmap for group %d"
+++			"corrupted: preallocated %d bg_free_blocks_count %d "
+++			"bb_free %u\n", group, preallocated,
+++			le16_to_cpu(gdp->bg_free_blocks_count), grp->bb_free);
+++		return -EIO;
+++	}
+ +	mb_debug("prellocated %u for group %u\n", preallocated, group);
+++	return 0;
+ +}
+ +
+ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,5)
+@@ -3651,6 +3727,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	 */
+ +	ext3_lock_group(sb, grp);
+ +	list_del_rcu(&pa->pa_group_list);
+++	EXT3_GROUP_INFO(sb, grp)->bb_prealloc_nr--;
+ +	ext3_unlock_group(sb, grp);
+ +
+ +	spin_lock(pa->pa_obj_lock);
+@@ -3735,6 +3812,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +
+ +	ext3_lock_group(sb, ac->ac_b_ex.fe_group);
+ +	list_add_rcu(&pa->pa_group_list, &grp->bb_prealloc_list);
+++	grp->bb_prealloc_nr++;
+ +	ext3_unlock_group(sb, ac->ac_b_ex.fe_group);
+ +
+ +	spin_lock(pa->pa_obj_lock);
+@@ -3792,6 +3870,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +
+ +	ext3_lock_group(sb, ac->ac_b_ex.fe_group);
+ +	list_add_rcu(&pa->pa_group_list, &grp->bb_prealloc_list);
+++	grp->bb_prealloc_nr++;
+ +	ext3_unlock_group(sb, ac->ac_b_ex.fe_group);
+ +
+ +	spin_lock(pa->pa_obj_lock);
+@@ -3839,6 +3918,7 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +	ac.ac_sb = sb;
+ +	ac.ac_inode = pa->pa_inode;
+ +	ac.ac_op = EXT3_MB_HISTORY_DISCARD;
+++	ac.ac_o_ex.fe_len = 1;
+ +
+ +	while (bit < end) {
+ +		bit = mb_find_next_zero_bit(bitmap_bh->b_data, end, bit);
+@@ -3965,6 +4045,8 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +
+ +		spin_unlock(&pa->pa_lock);
+ +
+++		BUG_ON(grp->bb_prealloc_nr == 0);
+++		grp->bb_prealloc_nr--;
+ +		list_del_rcu(&pa->pa_group_list);
+ +		list_add(&pa->u.pa_tmp_list, &list);
+ +	}
+@@ -4086,6 +4168,8 @@ Index: linux-2.6.5-7.311/fs/ext3/mballoc
+ +		bitmap_bh = read_block_bitmap(sb, group);
+ +
+ +		ext3_lock_group(sb, group);
+++		BUG_ON(e3b.bd_info->bb_prealloc_nr == 0);
+++		e3b.bd_info->bb_prealloc_nr--;
+ +		list_del_rcu(&pa->pa_group_list);
+ +
+ +		/* can be NULL due to IO error, at worst

Added: trunk/debian/patches/patchless_support_2.6.26.dpatch
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/patchless_support_2.6.26.dpatch?rev=510&op=file
==============================================================================
--- trunk/debian/patches/patchless_support_2.6.26.dpatch (added)
+++ trunk/debian/patches/patchless_support_2.6.26.dpatch Fri Sep 19 07:43:42 2008
@@ -1,0 +1,4246 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## posix_acl.patch by Patrick Winnertz <winnie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch which will enable 2.6.24 patchless support for lustre, taken from #14250
+
+ at DPATCH@
+diff -urNad trunk~/lnet/autoconf/lustre-lnet.m4 trunk/lnet/autoconf/lustre-lnet.m4
+--- trunk~/lnet/autoconf/lustre-lnet.m4	2008-06-26 06:43:33.000000000 +0200
++++ trunk/lnet/autoconf/lustre-lnet.m4	2008-09-18 23:45:47.000000000 +0200
+@@ -1263,6 +1263,55 @@
+ ])
+ ])
+ 
++# 2.6.24 request not use real numbers for ctl_name
++AC_DEFUN([LN_SYSCTL_UNNUMBERED],
++[AC_MSG_CHECKING([for CTL_UNNUMBERED])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/sysctl.h>
++],[
++	#ifndef CTL_UNNUMBERED
++	#error CTL_UNNUMBERED not exist in kernel
++	#endif
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_SYSCTL_UNNUMBERED, 1,
++                  [sysctl has CTL_UNNUMBERED])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
++# 2.6.24 lost scatterlist->page
++AC_DEFUN([LN_SCATTERLIST_SETPAGE],
++[AC_MSG_CHECKING([for exist sg_set_page])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/scatterlist.h>
++],[
++	sg_set_page(NULL,NULL,0,0);
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_SCATTERLIST_SETPAGE, 1,
++                  [struct scatterlist has page member])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
++AC_DEFUN([LN_SOCKMAP_FD_EXTRA_FLAG],
++[AC_MSG_CHECKING([if sock_map_fd accepts flags])
++LB_LINUX_TRY_COMPILLE([
++        #include <linux/net.h>
++],[
++        sock_map_fd(NULL,0);
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_EXTRA_SOCKMAP_FD_FLAG, 1,
++                  [sock_map_fd accepts two parameters])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
+ #
+ # LN_PROG_LINUX
+ #
+@@ -1305,6 +1354,11 @@
+ LN_KMEM_CACHE
+ # 2.6.23
+ LN_KMEM_CACHE_CREATE_DTOR
++# 2.6.24
++LN_SYSCTL_UNNUMBERED
++LN_SCATTERLIST_SETPAGE
++#2.6.27
++LN_SOCKMAP_FD_EXTRA_FLAG
+ ])
+ 
+ #
+diff -urNad trunk~/lnet/include/libcfs/curproc.h trunk/lnet/include/libcfs/curproc.h
+--- trunk~/lnet/include/libcfs/curproc.h	2007-02-10 01:04:30.000000000 +0100
++++ trunk/lnet/include/libcfs/curproc.h	2008-09-18 23:45:47.000000000 +0200
+@@ -49,6 +49,11 @@
+  */
+ cfs_kernel_cap_t cfs_curproc_cap_get(void);
+ void cfs_curproc_cap_set(cfs_kernel_cap_t cap);
++
++typedef __u32 cfs_cap_t;
++
++cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t cap);
++
+ #endif
+ 
+ /* __LIBCFS_CURPROC_H__ */
+diff -urNad trunk~/lnet/include/libcfs/linux/linux-prim.h trunk/lnet/include/libcfs/linux/linux-prim.h
+--- trunk~/lnet/include/libcfs/linux/linux-prim.h	2008-01-14 02:12:18.000000000 +0100
++++ trunk/lnet/include/libcfs/linux/linux-prim.h	2008-09-18 23:45:47.000000000 +0200
+@@ -68,6 +68,17 @@
+ #endif
+ #define cfs_unregister_sysctl_table(t)	unregister_sysctl_table(t)
+ 
++#define DECLARE_PROC_HANDLER(name)                      \
++static int                                              \
++LL_PROC_PROTO(name)                                     \
++{                                                       \
++        DECLARE_LL_PROC_PPOS_DECL;                      \
++                                                        \
++        return proc_call_handler(table->data, write,    \
++                                 ppos, buffer, lenp,    \
++                                 __##name);             \
++}
++
+ /*
+  * Symbol register
+  */
+diff -urNad trunk~/lnet/klnds/gmlnd/gmlnd_module.c trunk/lnet/klnds/gmlnd/gmlnd_module.c
+--- trunk~/lnet/klnds/gmlnd/gmlnd_module.c	2007-09-27 04:30:24.000000000 +0200
++++ trunk/lnet/klnds/gmlnd/gmlnd_module.c	2008-09-18 23:45:47.000000000 +0200
+@@ -62,9 +62,37 @@
+ };
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_GMLND       202
++
++enum {
++        GMLND_PORT = 1,
++        GMLND_NTX,
++        GMLND_CREDITS,
++        GMLND_PEERCREDITS,
++        GMLND_NLARGE_TX_BUFS,
++        GMLND_NRX_SMALL,
++        GMLND_NRX_LARGE
++};
++
++#else
++#define CTL_GMLND       CTL_UNNUMBERED
++
++#define GMLND_PORT              CTL_UNNUMBERED
++#define GMLND_NTX               CTL_UNNUMBERED
++#define GMLND_CREDITS           CTL_UNNUMBERED
++#define GMLND_PEERCREDITS       CTL_UNNUMBERED
++#define GMLND_NLARGE_TX_BUFS    CTL_UNNUMBERED
++#define GMLND_NRX_SMALL         CTL_UNNUMBERED
++#define GMLND_NRX_LARGE         CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t gmnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = GMLND_PORT,
+                 .procname = "port",
+                 .data     = &port,
+                 .maxlen   = sizeof (int),
+@@ -72,7 +100,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = GMLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof (int),
+@@ -80,7 +108,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = GMLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof (int),
+@@ -88,7 +116,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = GMLND_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof (int),
+@@ -96,7 +124,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = GMLND_NLARGE_TX_BUFS,
+                 .procname = "nlarge_tx_bufs",
+                 .data     = &nlarge_tx_bufs,
+                 .maxlen   = sizeof (int),
+@@ -104,7 +132,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = GMLND_NRX_SMALL,
+                 .procname = "nrx_small",
+                 .data     = &nrx_small,
+                 .maxlen   = sizeof (int),
+@@ -112,7 +140,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = GMLND_NRX_LARGE,
+                 .procname = "nrx_large",
+                 .data     = &nrx_large,
+                 .maxlen   = sizeof (int),
+@@ -124,7 +152,7 @@
+ 
+ static cfs_sysctl_table_t gmnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 207,
++                .ctl_name = CTL_GMLND,
+                 .procname = "gmnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/iiblnd/iiblnd_modparams.c trunk/lnet/klnds/iiblnd/iiblnd_modparams.c
+--- trunk~/lnet/klnds/iiblnd/iiblnd_modparams.c	2007-09-10 17:35:53.000000000 +0200
++++ trunk/lnet/klnds/iiblnd/iiblnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -102,9 +102,50 @@
+  * not to truncate the printout; it only needs to be the actual size of the
+  * string buffer if we allow writes (and we don't) */
+ 
++#ifdef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_IIBLND      203
++
++enum {
++        IIBLND_IPIF_BASENAME = 1,
++        IIBLND_SERVICE_NAME,
++        IIBLND_SERVICE_NUMBER,
++        IIBLND_RECONNECT_MIN,
++        IIBLND_RECONNECT_MAX,
++        IIBLND_CONCURRENT_PEERS,
++        IIBLND_CKSUM,
++        IIBLND_TIMEOUT,
++        IIBLND_NTX,
++        IIBLND_CREDITS,
++        IIBLND_PEER_CREDITS,
++        IIBLND_SD_RETRIES,
++        IIBLND_KEEPALIVE,
++        IIBLND_CONCURRENT_SENDS
++};
++
++#else
++#define CTL_IIBLND      CTL_UNNUMBERED
++
++#define IIBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define IIBLND_SERVICE_NAME     CTL_UNNUMBERED
++#define IIBLND_SERVICE_NUMBER   CTL_UNNUMBERED
++#define IIBLND_RECONNECT_MIN    CTL_UNNUMBERED
++#define IIBLND_RECONNECT_MAX    CTL_UNNUMBERED
++#define IIBLND_CONCURRENT_PEERS CTL_UNNUMBERED
++#define IIBLND_CKSUM            CTL_UNNUMBERED
++#define IIBLND_TIMEOUT          CTL_UNNUMBERED
++#define IIBLND_NTX              CTL_UNNUMBERED
++#define IIBLND_CREDITS          CTL_UNNUMBERED
++#define IIBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define IIBLND_SD_RETRIES       CTL_UNNUMBERED
++#define IIBLND_KEEPALIVE        CTL_UNNUMBERED
++#define IIBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = IBLND_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = &ipif_basename,
+                 .maxlen   = 1024,
+@@ -112,7 +153,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = IIBLND_SERVICE_NAME,
+                 .procname = "service_name",
+                 .data     = &service_name,
+                 .maxlen   = 1024,
+@@ -120,7 +161,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = IIBLND_SERVICE_NUMBER,
+                 .procname = "service_number",
+                 .data     = &service_number,
+                 .maxlen   = sizeof(int),
+@@ -128,7 +169,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = IIBLND_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -136,7 +177,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = IIBLND_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -144,7 +185,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = IIBLND_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -152,7 +193,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = IIBLND_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -160,7 +201,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = IIBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -168,7 +209,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = IIBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -176,7 +217,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = IIBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -184,7 +225,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = IIBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -192,7 +233,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = IIBLND_SD_RETRIES,
+                 .procname = "sd_retries",
+                 .data     = &sd_retries,
+                 .maxlen   = sizeof(int),
+@@ -200,7 +241,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = IIBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -208,7 +249,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = IIBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -220,7 +261,7 @@
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_IIBLND,
+                 .procname = "openibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/o2iblnd/o2iblnd.h trunk/lnet/klnds/o2iblnd/o2iblnd.h
+--- trunk~/lnet/klnds/o2iblnd/o2iblnd.h	2008-03-14 19:18:05.000000000 +0100
++++ trunk/lnet/klnds/o2iblnd/o2iblnd.h	2008-09-18 23:45:47.000000000 +0200
+@@ -759,3 +759,13 @@
+ 
+ 
+ 
++/* compat macros */
++#ifndef HAVE_SCATTERLIST_SETPAGE
++static inline void sg_set_page(struct scatterlist *sg, struct page *page,
++                                               unsigned int len, unsigned int offset)
++{
++        sg->page = page;
++        sg->offset = offset;
++        sg->length = len;
++}
++#endif
+diff -urNad trunk~/lnet/klnds/o2iblnd/o2iblnd_cb.c trunk/lnet/klnds/o2iblnd/o2iblnd_cb.c
+--- trunk~/lnet/klnds/o2iblnd/o2iblnd_cb.c	2008-03-28 08:12:34.000000000 +0100
++++ trunk/lnet/klnds/o2iblnd/o2iblnd_cb.c	2008-09-18 23:45:47.000000000 +0200
+@@ -626,9 +626,7 @@
+                 fragnob = min((int)(iov->iov_len - offset), nob);
+                 fragnob = min(fragnob, (int)PAGE_SIZE - page_offset);
+ 
+-                sg->page = page;
+-                sg->offset = page_offset;
+-                sg->length = fragnob;
++                sg_set_page(sg, page, fragnob, page_offset);
+                 sg++;
+ 
+                 if (offset + fragnob < iov->iov_len) {
+@@ -691,11 +689,10 @@
+                 fragnob = min((int)(kiov->kiov_len - offset), nob);
+ 
+                 memset(sg, 0, sizeof(*sg));
+-                sg->page = kiov->kiov_page;
+-                sg->offset = kiov->kiov_offset + offset;
+-                sg->length = fragnob;
++                sg_set_page(sg, kiov->kiov_page, fragnob,
++                            kiov->kiov_offset + offset);
+                 sg++;
+-                
++ 
+                 offset = 0;
+                 kiov++;
+                 nkiov--;
+diff -urNad trunk~/lnet/klnds/o2iblnd/o2iblnd_modparams.c trunk/lnet/klnds/o2iblnd/o2iblnd_modparams.c
+--- trunk~/lnet/klnds/o2iblnd/o2iblnd_modparams.c	2007-09-10 17:35:53.000000000 +0200
++++ trunk/lnet/klnds/o2iblnd/o2iblnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -113,9 +113,51 @@
+ 
+ static char ipif_basename_space[32];
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_O2IBLND      205
++
++enum {
++        O2IBLND_SERVICE  = 1,
++        O2IBLND_CKSUM,
++        O2IBLND_TIMEOUT,
++        O2IBLND_NTX,
++        O2IBLND_CREDITS,
++        O2IBLND_PEER_CREDITS,
++        O2IBLND_IPIF_BASENAME,
++        O2IBLND_RETRY_COUNT,
++        O2IBLND_RNR_RETRY_COUNT,
++        O2IBLND_KEEPALIVE,
++        O2IBLND_CONCURRENT_SENDS,
++        O2IBLND_IB_MTU,
++        O2IBLND_FMR_POOL_SIZE,
++        O2IBLND_FMR_FLUSH_TRIGGER,
++        O2IBLND_FMR_CACHE
++};
++#else
++#define CTL_O2IBLND              CTL_UNNUMBERED
++
++#define O2IBLND_SERVICE          CTL_UNNUMBERED
++#define O2IBLND_CKSUM            CTL_UNNUMBERED
++#define O2IBLND_TIMEOUT          CTL_UNNUMBERED
++#define O2IBLND_NTX              CTL_UNNUMBERED
++#define O2IBLND_CREDITS          CTL_UNNUMBERED
++#define O2IBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define O2IBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define O2IBLND_RETRY_COUNT      CTL_UNNUMBERED
++#define O2IBLND_RNR_RETRY_COUNT  CTL_UNNUMBERED
++#define O2IBLND_KEEPALIVE        CTL_UNNUMBERED
++#define O2IBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++#define O2IBLND_IB_MTU           CTL_UNNUMBERED
++#define O2IBLND_FMR_POOL_SIZE    CTL_UNNUMBERED
++#define O2IBLND_FMR_FLUSH_TRIGGER CTL_UNNUMBERED
++#define O2IBLND_FMR_CACHE        CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kiblnd_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = O2IBLND_SERVICE,
+                 .procname = "service",
+                 .data     = &service,
+                 .maxlen   = sizeof(int),
+@@ -123,7 +165,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = O2IBLND_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -131,7 +173,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = O2IBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -139,7 +181,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = O2IBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -147,7 +189,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = O2IBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -155,7 +197,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = O2IBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -163,7 +205,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = O2IBLND_IPIF_BASENAME,
+                 .procname = "ipif_name",
+                 .data     = ipif_basename_space,
+                 .maxlen   = sizeof(ipif_basename_space),
+@@ -171,7 +213,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = O2IBLND_RETRY_COUNT,
+                 .procname = "retry_count",
+                 .data     = &retry_count,
+                 .maxlen   = sizeof(int),
+@@ -179,7 +221,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = O2IBLND_RNR_RETRY_COUNT,
+                 .procname = "rnr_retry_count",
+                 .data     = &rnr_retry_count,
+                 .maxlen   = sizeof(int),
+@@ -187,7 +229,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = O2IBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -195,7 +237,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = O2IBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -203,7 +245,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = O2IBLND_IB_MTU,
+                 .procname = "ib_mtu",
+                 .data     = &ib_mtu,
+                 .maxlen   = sizeof(int),
+@@ -212,7 +254,7 @@
+         },
+ #if IBLND_MAP_ON_DEMAND
+         {
+-                .ctl_name = 13,
++                .ctl_name = O2IBLND_FMR_POOL_SIZE,
+                 .procname = "fmr_pool_size",
+                 .data     = &fmr_pool_size,
+                 .maxlen   = sizeof(int),
+@@ -220,7 +262,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = O2IBLND_FMR_FLUSH_TRIGGER,
+                 .procname = "fmr_flush_trigger",
+                 .data     = &fmr_flush_trigger,
+                 .maxlen   = sizeof(int),
+@@ -228,7 +270,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 15,
++                .ctl_name = O2IBLND_FMR_CACHE,
+                 .procname = "fmr_cache",
+                 .data     = &fmr_cache,
+                 .maxlen   = sizeof(int),
+@@ -241,7 +283,7 @@
+ 
+ static cfs_sysctl_table_t kiblnd_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_O2IBLND,
+                 .procname = "o2iblnd",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/openiblnd/openiblnd_modparams.c trunk/lnet/klnds/openiblnd/openiblnd_modparams.c
+--- trunk~/lnet/klnds/openiblnd/openiblnd_modparams.c	2007-09-10 17:35:54.000000000 +0200
++++ trunk/lnet/klnds/openiblnd/openiblnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -83,9 +83,42 @@
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_KIBNAL      203
++enum {
++        KIBNAL_IPIF_BASENAME = 1,
++        KIBNAL_N_CONND,
++        KIBNAL_RECONNECT_MIN,
++        KIBNAL_RECONNECT_MAX,
++        KIBNAL_CONCURRENT_PEERS,
++        KIBNAL_CKSUM,
++        KIBNAL_TIMEOUT,
++        KIBNAL_NTX,
++        KIBNAL_CREDITS,
++        KIBNAL_PEER_CREDITS,
++        KIBNAL_KEEPALIVE
++};
++#else
++
++#define CTL_KIBNAL      CTL_UNNUMBERED
++
++#define KIBNAL_IPIF_BASENAME    CTL_UNNUMBERED
++#define KIBNAL_N_CONND          CTL_UNNUMBERED
++#define KIBNAL_RECONNECT_MIN    CTL_UNNUMBERED
++#define KIBNAL_RECONNECT_MAX    CTL_UNNUMBERED
++#define KIBNAL_CONCURRENT_PEERS CTL_UNNUMBERED
++#define KIBNAL_CKSUM            CTL_UNNUMBERED
++#define KIBNAL_TIMEOUT          CTL_UNNUMBERED
++#define kiBNAL_NTX              CTL_UNNUMBERED
++#define KIBNAL_CREDITS          CTL_UNNUMBERED
++#define KIBNAL_PEER_CREDITS     CTL_UNNUMBERED
++#define KIBNAL_KEEPALIVE        CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KIBNAL_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = &ipif_basename,
+                 .maxlen   = 1024,
+@@ -93,7 +126,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KIBNAL_N_CONND,
+                 .procname = "n_connd",
+                 .data     = &n_connd,
+                 .maxlen   = sizeof(int),
+@@ -101,7 +134,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KIBNAL_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -109,7 +142,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KIBNAL_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -117,7 +150,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KIBNAL_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -125,7 +158,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KIBNAL_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -133,7 +166,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KIBNAL_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -141,7 +174,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KIBNAL_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -149,7 +182,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KIBNAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -157,7 +190,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KIBNAL_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -165,7 +198,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = KIBNAL_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -177,7 +210,7 @@
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_KIBNAL,
+                 .procname = "openibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/ptllnd/ptllnd_modparams.c trunk/lnet/klnds/ptllnd/ptllnd_modparams.c
+--- trunk~/lnet/klnds/ptllnd/ptllnd_modparams.c	2007-09-27 04:30:24.000000000 +0200
++++ trunk/lnet/klnds/ptllnd/ptllnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -134,9 +134,54 @@
+ }
+ #endif
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_PTLLND       207
++
++enum {
++        KPTLLND_NTX     = 1,
++        KPTLLND_MAX_NODES,
++        KPTLLND_MAX_PROC_PER_NODE,
++        KPTLLND_CHECKSUM,
++        KPTLLND_TIMEOUT,
++        KPTLLND_PORTAL,
++        KPTLLND_PID,
++        KPTLLND_RXB_PAGES,
++        KPTLLND_CREDITS,
++        KPTLLND_PEERCREDITS,
++        KPTLLND_MAX_MSG_SIZE,
++        KPTLLND_PEER_HASH_SIZE,
++        KPTLLND_RESHEDULE_LOOPS,
++        KPTLLND_ACK_PUTS,
++        KPTLLND_TRACETIMEOUT,
++        KPTLLND_TRACEBASENAME,
++        KPTLLND_SIMULATION_BITMAP
++};
++#else
++#define CTL_PTLLND              CTL_UNNUMBERED
++
++#define KPTLLND_NTX             CTL_UNNUMBERED
++#define KPTLLND_MAX_NODES       CTL_UNNUMBERED
++#define KPTLLND_MAX_PROC_PER_NODE CTL_UNNUMBERED
++#define KPTLLND_CHECKSUM        CTL_UNNUMBERED
++#define KPTLLND_TIMEOUT         CTL_UNNUMBERED
++#define KPTLLND_PORTAL          CTL_UNNUMBERED
++#define KPTLLND_PID             CTL_UNNUMBERED
++#define KPTLLND_RXB_PAGES       CTL_UNNUMBERED
++#define KPTLLND_CREDITS         CTL_UNNUMBERED
++#define KPTLLND_PEERCREDITS     CTL_UNNUMBERED
++#define KPTLLND_MAX_MSG_SIZE    CTL_UNNUMBERED
++#define KPTLLND_PEER_HASH_SIZE  CTL_UNNUMBERED
++#define KPTLLND_RESHEDULE_LOOPS CTL_UNNUMBERED
++#define KPTLLND_ACK_PUTS        CTL_UNNUMBERED
++#define KPTLLND_TRACETIMEOUT    CTL_UNNUMBERED
++#define KPTLLND_TRACEBASENAME   CTL_UNNUMBERED
++#define KPTLLND_SIMULATION_BITMAP CTL_UNNUMBERED
++#endif
++
+ static cfs_sysctl_table_t kptllnd_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KPTLLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -144,15 +189,15 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KPTLLND_MAX_NODES,
+                 .procname = "max_nodes",
+                 .data     = &max_nodes,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++               
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KPTLLND_MAX_PROC_PER_NODE,
+                 .procname = "max_procs_per_node",
+                 .data     = &max_procs_per_node,
+                 .maxlen   = sizeof(int),
+@@ -160,7 +205,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KPTLLND_CHECKSUM,
+                 .procname = "checksum",
+                 .data     = &checksum,
+                 .maxlen   = sizeof(int),
+@@ -168,7 +213,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KPTLLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -176,7 +221,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KPTLLND_PORTAL,
+                 .procname = "portal",
+                 .data     = &portal,
+                 .maxlen   = sizeof(int),
+@@ -184,7 +229,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KPTLLND_PID,
+                 .procname = "pid",
+                 .data     = &pid,
+                 .maxlen   = sizeof(int),
+@@ -192,7 +237,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KPTLLND_RXB_PAGES,
+                 .procname = "rxb_npages",
+                 .data     = &rxb_npages,
+                 .maxlen   = sizeof(int),
+@@ -200,7 +245,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KPTLLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -208,7 +253,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KPTLLND_PEERCREDITS,
+                 .procname = "peercredits",
+                 .data     = &peercredits,
+                 .maxlen   = sizeof(int),
+@@ -216,7 +261,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = KPTLLND_MAX_MSG_SIZE,
+                 .procname = "max_msg_size",
+                 .data     = &max_msg_size,
+                 .maxlen   = sizeof(int),
+@@ -224,7 +269,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = KPTLLND_PEER_HASH_SIZE,
+                 .procname = "peer_hash_table_size",
+                 .data     = &peer_hash_table_size,
+                 .maxlen   = sizeof(int),
+@@ -232,7 +277,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = KPTLLND_RESHEDULE_LOOPS,
+                 .procname = "reschedule_loops",
+                 .data     = &reschedule_loops,
+                 .maxlen   = sizeof(int),
+@@ -240,7 +285,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = KPTLLND_ACK_PUTS,
+                 .procname = "ack_puts",
+                 .data     = &ack_puts,
+                 .maxlen   = sizeof(int),
+@@ -249,7 +294,7 @@
+         },
+ #ifdef CRAY_XT3
+         {
+-                .ctl_name = 15,
++                .ctl_name = KPTLLND_TRACETIMEOUT,
+                 .procname = "ptltrace_on_timeout",
+                 .data     = &ptltrace_on_timeout,
+                 .maxlen   = sizeof(int),
+@@ -257,7 +302,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 16,
++                .ctl_name = KPTLLND_TRACEBASENAME,
+                 .procname = "ptltrace_basename",
+                 .data     = ptltrace_basename_space,
+                 .maxlen   = sizeof(ptltrace_basename_space),
+@@ -268,7 +313,7 @@
+ #endif
+ #ifdef PJK_DEBUGGING
+         {
+-                .ctl_name = 17,
++                .ctl_name = KPTLLND_SIMULATION_BITMAP,
+                 .procname = "simulation_bitmap",
+                 .data     = &simulation_bitmap,
+                 .maxlen   = sizeof(int),
+@@ -282,7 +327,7 @@
+ 
+ static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_PTLLND,
+                 .procname = "ptllnd",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/qswlnd/qswlnd_modparams.c trunk/lnet/klnds/qswlnd/qswlnd_modparams.c
+--- trunk~/lnet/klnds/qswlnd/qswlnd_modparams.c	2007-09-10 17:35:55.000000000 +0200
++++ trunk/lnet/klnds/qswlnd/qswlnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -1,4 +1,7 @@
+ /*
++ * -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
++ * vim:expandtab:shiftwidth=8:tabstop=8:
++ *
+  * Copyright (C) 2002-2004 Cluster File Systems, Inc.
+  *   Author: Eric Barton <eric at bartonsoftware.com>
+  *
+@@ -84,9 +87,45 @@
+ };
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_KQSWNAL	207
++
++enum
++	KQSWNAL_TX_MAXCONTIG = 1,
++	KQSWNAL_NTXMSG,
++	KQSWNAL_CREDITS,
++	KQSWNAL_PEERCREDITS,
++	KQSWNAL_NRXMSGS_LARGE,
++	KQSWNAL_EP_ENVELOPES_LARGE,
++	KQSWNAL_NRXMSGS_SMALL,
++	KQSWNAL_EP_ENVELOPES_SMALL,
++	KQSWNAL_OPTIMIZED_PUTS,
++	KQSWNAL_OPTIMIZED_GETS,
++	KQSWNAL_INJECT_CSUM_ERROR
++};
++#else
++
++#define CTL_KQSWNAL             CTL_UNNUMBERED
++
++#define KQSWNAL_TX_MAXCONTIG    CTL_UNNUMBERED
++#define KQSWNAL_NTXMSG          CTL_UNNUMBERED
++#define KQSWNAL_CREDITS         CTL_UNNUMBERED
++#define KQSWNAL_PEERCREDITS     CTL_UNNUMBERED
++#define KQSWNAL_NRXMSGS_LARGE   CTL_UNNUMBERED
++#define KQSWNAL_EP_ENVELOPES_LARGE CTL_UNNUMBERED
++#define KQSWNAL_NRXMSGS_SMALL   CTL_UNNUMBERED
++#define KQSWNAL_EP_ENVELOPES_SMALL CTL_UNNUMBERED
++#define KQSWNAL_OPTIMIZED_PUTS  CTL_UNNUMBERED
++#define KQSWNAL_OPTIMIZED_GETS  CTL_UNNUMBERED
++#define KQSWNAL_INJECT_CSUM_ERROR CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kqswnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KQSWNAL_TX_MAXCONTIG,
+                 .procname = "tx_maxcontig",
+                 .data     = &tx_maxcontig,
+                 .maxlen   = sizeof (int),
+@@ -94,7 +133,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KQSWNAL_NTXMSG,
+                 .procname = "ntxmsgs",
+                 .data     = &ntxmsgs,
+                 .maxlen   = sizeof (int),
+@@ -102,7 +141,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KQSWNAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof (int),
+@@ -110,7 +149,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KQSWNAL_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof (int),
+@@ -118,7 +157,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KQSWNAL_NRXMSGS_LARGE,
+                 .procname = "nrxmsgs_large",
+                 .data     = &nrxmsgs_large,
+                 .maxlen   = sizeof (int),
+@@ -126,7 +165,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KQSWNAL_EP_ENVELOPES_LARGE,
+                 .procname = "ep_envelopes_large",
+                 .data     = &ep_envelopes_large,
+                 .maxlen   = sizeof (int),
+@@ -134,7 +173,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KQSWNAL_NRXMSGS_SMALL,
+                 .procname = "nrxmsgs_small",
+                 .data     = &nrxmsgs_small,
+                 .maxlen   = sizeof (int),
+@@ -142,7 +181,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KQSWNAL_EP_ENVELOPES_SMALL,
+                 .procname = "ep_envelopes_small",
+                 .data     = &ep_envelopes_small,
+                 .maxlen   = sizeof (int),
+@@ -150,7 +189,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KQSWNAL_OPTIMIZED_PUTS,
+                 .procname = "optimized_puts",
+                 .data     = &optimized_puts,
+                 .maxlen   = sizeof (int),
+@@ -158,7 +197,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KQSWNAL_OPTIMIZED_GETS,
+                 .procname = "optimized_gets",
+                 .data     = &optimized_gets,
+                 .maxlen   = sizeof (int),
+@@ -167,7 +206,7 @@
+         },
+ #if KQSW_CKSUM
+         {
+-                .ctl_name = 11,
++                .ctl_name = KQSWNAL_INJECT_CSUM_ERROR,
+                 .procname = "inject_csum_error",
+                 .data     = &inject_csum_error,
+                 .maxlen   = sizeof (int),
+@@ -180,7 +219,7 @@
+ 
+ static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 201,
++                .ctl_name = CTL_KQSWNAL,
+                 .procname = "qswnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/ralnd/ralnd_modparams.c trunk/lnet/klnds/ralnd/ralnd_modparams.c
+--- trunk~/lnet/klnds/ralnd/ralnd_modparams.c	2007-08-02 10:30:12.000000000 +0200
++++ trunk/lnet/klnds/ralnd/ralnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -72,9 +72,37 @@
+ };
+ 
+ #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_KRANAL      202
++enum {
++        KRANAL_N_CONND = 1,
++        KRANAL_RECONNECT_MIN,
++        KRANAL_RECONNECT_MAX,
++        KRANAL_NTX,
++        KRANAL_CREDITS,
++        KRANAL_PEERCREDITS,
++        KRANAL_FMA_CQ_SIZE,
++        KRANAL_TIMEOUT,
++        KRANAL_IMMEDIATE_MAX
++};
++#else
++#define CTL_KRANAL              CTL_UNNUMBERED
++
++#define KRANAL_N_CONND          CTL_UNNUMBERED
++#define KRANAL_RECONNECT_MIN    CTL_UNNUMBERED
++#define KRANAL_RECONNECT_MAX    CTL_UNNUMBERED
++#define KRANAL_NTX              CTL_UNNUMBERED
++#define KRANAL_CREDITS          CTL_UNNUMBERED
++#define KRANAL_PEERCREDITS      CTL_UNNUMBERED
++#define KRANAL_FMA_CQ_SIZE      CTL_UNNUMBERED
++#define KRANAL_TIMEOUT          CTL_UNNUMBERED
++#define KRANAL_IMMEDIATE_MAX    CTL_UNNUMBERED
++#endif
++
+ static cfs_sysctl_table_t kranal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KRANAL_N_CONND,
+                 .procname = "n_connd",
+                 .data     = &n_connd,
+                 .maxlen   = sizeof(int),
+@@ -82,7 +110,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KRANAL_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -90,7 +118,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KRANAL_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -98,7 +126,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KRANAL_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -106,7 +134,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KRANAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -114,7 +142,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KRANAL_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -122,7 +150,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KRANAL_FMA_CQ_SIZE,
+                 .procname = "fma_cq_size",
+                 .data     = &fma_cq_size,
+                 .maxlen   = sizeof(int),
+@@ -130,7 +158,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KRANAL_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -138,7 +166,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KRANAL_IMMEDIATE_MAX,
+                 .procname = "max_immediate",
+                 .data     = &max_immediate,
+                 .maxlen   = sizeof(int),
+@@ -150,7 +178,7 @@
+ 
+ static cfs_sysctl_table_t kranal_top_ctl_table[] = {
+         {
+-                .ctl_name = 202,
++                .ctl_name = CTL_KRANAL,
+                 .procname = "ranal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/klnds/socklnd/socklnd_lib-linux.c trunk/lnet/klnds/socklnd/socklnd_lib-linux.c
+--- trunk~/lnet/klnds/socklnd/socklnd_lib-linux.c	2007-09-11 21:39:20.000000000 +0200
++++ trunk/lnet/klnds/socklnd/socklnd_lib-linux.c	2008-09-18 23:45:47.000000000 +0200
+@@ -5,197 +5,244 @@
+ #include "socklnd.h"
+ 
+ # if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+-static cfs_sysctl_table_t ksocknal_ctl_table[21];
+ 
+-cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
+-        {
+-                .ctl_name = 200,
+-                .procname = "socknal",
+-                .data     = NULL,
+-                .maxlen   = 0,
+-                .mode     = 0555,
+-                .child    = ksocknal_ctl_table
+-        },
+-        { 0 }
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_SOCKLND     209
++
++enum {
++        SOCKLND_TIMEOUT = 1,
++        SOCKLND_CREDITS,
++        SOCKLND_PEER_CREDITS,
++        SOCKLND_NCONNDS,
++        SOCKLND_RECONNECTS_MIN,
++        SOCKLND_RECONNECTS_MAX,
++        SOCKLND_EAGER_ACK,
++        SOCKLND_ZERO_COPY,
++        SOCKLND_TYPED,
++        SOCKLND_BULK_MIN,
++        SOCKLND_RX_BUFFER_SIZE,
++        SOCKLND_TX_BUFFER_SIZE,
++        SOCKLND_NAGLE,
++        SOCKLND_IRQ_AFFINITY,
++        SOCKLND_KEEPALIVE_IDLE,
++        SOCKLND_KEEPALIVE_COUNT,
++        SOCKLND_KEEPALIVE_INTVL,
++        SOCKLND_BACKOFF_INIT,
++        SOCKLND_BACKOFF_MAX,
++        SOCKLND_PROTOCOL
+ };
++#else
++#define CTL_SOCKLND             CTL_UNNUMBERED
+ 
+-int
+-ksocknal_lib_tunables_init ()
+-{
+-        int    i = 0;
+-        int    j = 1;
++#define SOCKLND_TIMEOUT         CTL_UNNUMBERED
++#define SOCKLND_CREDITS         CTL_UNNUMBERED
++#define SOCKLND_PEER_CREDITS    CTL_UNNUMBERED
++#define SOCKLND_NCONNDS         CTL_UNNUMBERED
++#define SOCKLND_RECONNECTS_MIN  CTL_UNNUMBERED
++#define SOCKLND_RECONNECTS_MAX  CTL_UNNUMBERED
++#define SOCKLND_EAGER_ACK       CTL_UNNUMBERED
++#define SOCKLND_ZERO_COPY       CTL_UNNUMBERED
++#define SOCKLND_TYPED           CTL_UNNUMBERED
++#define SOCKLND_BULK_MIN        CTL_UNNUMBERED
++#define SOCKLND_RX_BUFFER_SIZE  CTL_UNNUMBERED
++#define SOCKLND_TX_BUFFER_SIZE  CTL_UNNUMBERED
++#define SOCKLND_NAGLE           CTL_UNNUMBERED
++#define SOCKLND_IRQ_AFFINITY    CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_IDLE  CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_COUNT CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_INTVL CTL_UNNUMBERED
++#define SOCKLND_BACKOFF_INIT    CTL_UNNUMBERED
++#define SOCKLND_BACKOFF_MAX     CTL_UNNUMBERED
++#define SOCKLND_PROTOCOL        CTL_UNNUMBERED
++#endif
+ 
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++static cfs_sysctl_table_t ksocknal_ctl_table[] = {
++        {
++                .ctl_name = SOCKLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = ksocknal_tunables.ksnd_timeout,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_CREDITS,
+                 .procname = "credits",
+                 .data     = ksocknal_tunables.ksnd_credits,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++         {
++                .ctl_name = SOCKLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = ksocknal_tunables.ksnd_peercredits,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_NCONNDS,
+                 .procname = "nconnds",
+                 .data     = ksocknal_tunables.ksnd_nconnds,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_RECONNECTS_MIN,
+                 .procname = "min_reconnectms",
+                 .data     = ksocknal_tunables.ksnd_min_reconnectms,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_RECONNECTS_MAX,
+                 .procname = "max_reconnectms",
+                 .data     = ksocknal_tunables.ksnd_max_reconnectms,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_EAGER_ACK,
+                 .procname = "eager_ack",
+                 .data     = ksocknal_tunables.ksnd_eager_ack,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_ZERO_COPY,
+                 .procname = "zero_copy",
+                 .data     = ksocknal_tunables.ksnd_zc_min_frag,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_TYPED,
+                 .procname = "typed",
+                 .data     = ksocknal_tunables.ksnd_typed_conns,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0444,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_BULK_MIN,
+                 .procname = "min_bulk",
+                 .data     = ksocknal_tunables.ksnd_min_bulk,
+                 .maxlen   = sizeof (int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_RX_BUFFER_SIZE,
+                 .procname = "rx_buffer_size",
+                 .data     = ksocknal_tunables.ksnd_rx_buffer_size,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_TX_BUFFER_SIZE,
+                 .procname = "tx_buffer_size",
+                 .data     = ksocknal_tunables.ksnd_tx_buffer_size,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_NAGLE,
+                 .procname = "nagle",
+                 .data     = ksocknal_tunables.ksnd_nagle,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
++        },
+ #ifdef CPU_AFFINITY
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        {
++                .ctl_name = SOCKLND_IRQ_AFFINITY,
+                 .procname = "irq_affinity",
+                 .data     = ksocknal_tunables.ksnd_irq_affinity,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
++        },
+ #endif
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_IDLE,
+                 .procname = "keepalive_idle",
+                 .data     = ksocknal_tunables.ksnd_keepalive_idle,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_COUNT,
+                 .procname = "keepalive_count",
+                 .data     = ksocknal_tunables.ksnd_keepalive_count,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_INTVL,
+                 .procname = "keepalive_intvl",
+                 .data     = ksocknal_tunables.ksnd_keepalive_intvl,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
++        },
+ #ifdef SOCKNAL_BACKOFF
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        {
++                .ctl_name = SOCKLND_BACKOFF_INIT,
+                 .procname = "backoff_init",
+                 .data     = ksocknal_tunables.ksnd_backoff_init,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        },
++        {
++                .ctl_name = SOCKLND_BACKOFF_MAX,
+                 .procname = "backoff_max",
+                 .data     = ksocknal_tunables.ksnd_backoff_max,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
++        }
+ #endif
+ #if SOCKNAL_VERSION_DEBUG
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
++        {
++                .ctl_name = SOCKLND_PROTOCOL,
+                 .procname = "protocol",
+                 .data     = ksocknal_tunables.ksnd_protocol,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dointvec
+-        };
++        },
+ #endif
+-        ksocknal_ctl_table[i++] =  (cfs_sysctl_table_t) { 0 };
++        {0}
++};
+ 
+-        LASSERT (j == i);
+-        LASSERT (i <= sizeof(ksocknal_ctl_table)/sizeof(ksocknal_ctl_table[0]));
+ 
++cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
++        {
++                .ctl_name = CTL_SOCKLND,
++                .procname = "socknal",
++                .data     = NULL,
++                .maxlen   = 0,
++                .mode     = 0555,
++                .child    = ksocknal_ctl_table
++        },
++        { 0 }
++};
++
++int
++ksocknal_lib_tunables_init ()
++{
+         ksocknal_tunables.ksnd_sysctl =
+                 cfs_register_sysctl_table(ksocknal_top_ctl_table, 0);
+ 
+diff -urNad trunk~/lnet/klnds/viblnd/viblnd_modparams.c trunk/lnet/klnds/viblnd/viblnd_modparams.c
+--- trunk~/lnet/klnds/viblnd/viblnd_modparams.c	2007-09-27 04:30:24.000000000 +0200
++++ trunk/lnet/klnds/viblnd/viblnd_modparams.c	2008-09-18 23:45:47.000000000 +0200
+@@ -125,6 +125,56 @@
+ #endif
+ };
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_VIBLND       209
++
++enum {
++        VIBLND_SERVICE = 1,
++        VIBLND_RECONNECT_MIN,
++        VIBLND_RECONNECT_MAX,
++        VIBLND_CONCURRENT_PEERS,
++        VIBLND_CHKSUM,
++        VIBLND_TIMEOUT,
++        VIBLND_NTX,
++        VIBLND_CREDITS,
++        VIBLND_PEER_CREDITS,
++        VIBLND_ARP_RETRIES,
++        VIBLND_HCA_BASENAME,
++        VIBLND_IPIF_BASENAME,
++        VIBLND_LOCAL_ACK_TIMEOUT,
++        VIBLND_RETRY_CNT
++        VIBLND_RNR_CNT,
++        VIBLND_RNR_NAK_TIMER,
++        VIBLND_KEEPALIVE,
++        VIBLND_CONCURRENT_SENDS,
++        VIBLND_FMR_REMAPS
++};        
++#else
++#define CTL_VIBLND              CTL_UNNUMBERED
++
++#define VIBLND_SERVICE          CTL_UNNUMBERED
++#define VIBLND_RECONNECT_MIN    CTL_UNNUMBERED
++#define VIBLND_RECONNECT_MAX    CTL_UNNUMBERED
++#define VIBLND_CONCURRENT_PEERS CTL_UNNUMBERED
++#define VIBLND_CHKSUM           CTL_UNNUMBERED
++#define VIBLND_TIMEOUT          CTL_UNNUMBERED
++#define VIBLND_NTX              CTL_UNNUMBERED
++#define VIBLND_CREDITS          CTL_UNNUMBERED
++#define VIBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define VIBLND_ARP_RETRIES      CTL_UNNUMBERED
++#define VIBLND_HCA_BASENAME     CTL_UNNUMBERED
++#define VIBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define VIBLND_LOCAL_ACK_TIMEOUT CTL_UNNUMBERED
++#define VIBLND_RETRY_CNT        CTL_UNNUMBERED
++#define VIBLND_RNR_CNT          CTL_UNNUMBERED
++#define VIBLND_RNR_NAK_TIMER    CTL_UNNUMBERED
++#define VIBLND_KEEPALIVE        CTL_UNNUMBERED
++#define VIBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++#define VIBLND_FMR_REMAPS       CTL_UNNUMBERED
++
++#endif
++
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+ 
+ static char hca_basename_space[32];
+@@ -132,7 +182,7 @@
+ 
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = VIBLND_SERVICE,
+                 .procname = "service_number",
+                 .data     = &service_number,
+                 .maxlen   = sizeof(int),
+@@ -140,7 +190,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = VIBLND_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -148,7 +198,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = VIBLND_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -156,7 +206,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = VIBLND_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -164,7 +214,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = VIBLND_CHKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -172,7 +222,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = VIBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -180,7 +230,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = VIBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -188,7 +238,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = VIBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -196,7 +246,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = VIBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -204,7 +254,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = VIBLND_ARP_RETRIES,
+                 .procname = "arp_retries",
+                 .data     = &arp_retries,
+                 .maxlen   = sizeof(int),
+@@ -212,7 +262,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = VIBLND_HCA_BASENAME,
+                 .procname = "hca_basename",
+                 .data     = hca_basename_space,
+                 .maxlen   = sizeof(hca_basename_space),
+@@ -220,7 +270,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = VIBLND_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = ipif_basename_space,
+                 .maxlen   = sizeof(ipif_basename_space),
+@@ -228,7 +278,7 @@
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = VIBLND_LOCAL_ACK_TIMEOUT,
+                 .procname = "local_ack_timeout",
+                 .data     = &local_ack_timeout,
+                 .maxlen   = sizeof(int),
+@@ -236,7 +286,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = VIBLND_RETRY_CNT,
+                 .procname = "retry_cnt",
+                 .data     = &retry_cnt,
+                 .maxlen   = sizeof(int),
+@@ -244,7 +294,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 15,
++                .ctl_name = VIBLND_RNR_CNT,
+                 .procname = "rnr_cnt",
+                 .data     = &rnr_cnt,
+                 .maxlen   = sizeof(int),
+@@ -252,7 +302,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 16,
++                .ctl_name = VIBLND_RNR_NAK_TIMER,
+                 .procname = "rnr_nak_timer",
+                 .data     = &rnr_nak_timer,
+                 .maxlen   = sizeof(int),
+@@ -260,7 +310,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 17,
++                .ctl_name = VIBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -268,7 +318,7 @@
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 18,
++                .ctl_name = VIBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -277,7 +327,7 @@
+         },
+ #if IBNAL_USE_FMR
+         {
+-                .ctl_name = 19,
++                .ctl_name = VIBLND_FMR_REMAPS,
+                 .procname = "fmr_remaps",
+                 .data     = &fmr_remaps,
+                 .maxlen   = sizeof(int),
+@@ -290,7 +340,7 @@
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_VIBLND,
+                 .procname = "vibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff -urNad trunk~/lnet/libcfs/linux/linux-curproc.c trunk/lnet/libcfs/linux/linux-curproc.c
+--- trunk~/lnet/libcfs/linux/linux-curproc.c	2007-02-10 01:04:59.000000000 +0100
++++ trunk/lnet/libcfs/linux/linux-curproc.c	2008-09-18 23:45:47.000000000 +0200
+@@ -109,6 +109,19 @@
+         current->cap_effective = cap;
+ }
+ 
++cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t cap)
++{
++#if _LINUX_CAPABILITY_VERSION_3 || _LINUX_CAPABILITY_VERSION == 0x20071026
++        /* XXX lost high byte */
++        return cap.cap[0];
++#elif _LINUX_CAPABILITY_VERSION == 0x19980330
++        return cap;
++#else
++        #error "need correct _LINUX_CAPABILITY_VERSION "
++#endif
++}
++
++
+ EXPORT_SYMBOL(cfs_curproc_uid);
+ EXPORT_SYMBOL(cfs_curproc_pid);
+ EXPORT_SYMBOL(cfs_curproc_gid);
+@@ -121,7 +134,7 @@
+ EXPORT_SYMBOL(cfs_curproc_is_in_groups);
+ EXPORT_SYMBOL(cfs_curproc_cap_get);
+ EXPORT_SYMBOL(cfs_curproc_cap_set);
+-
++EXPORT_SYMBOL(cfs_cap_convert_from_kernel);
+ /*
+  * Local variables:
+  * c-indentation-style: "K&R"
+diff -urNad trunk~/lnet/libcfs/linux/linux-proc.c trunk/lnet/libcfs/linux/linux-proc.c
+--- trunk~/lnet/libcfs/linux/linux-proc.c	2008-03-25 13:23:25.000000000 +0100
++++ trunk/lnet/libcfs/linux/linux-proc.c	2008-09-18 23:45:47.000000000 +0200
+@@ -61,7 +61,8 @@
+ static cfs_sysctl_table_header_t *lnet_table_header = NULL;
+ extern char lnet_upcall[1024];
+ 
+-#define PSDEV_LNET  (0x100)
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_LNET        (0x100)
+ enum {
+         PSDEV_DEBUG = 1,          /* control debugging */
+         PSDEV_SUBSYSTEM_DEBUG,    /* control debugging */
+@@ -80,8 +81,27 @@
+         PSDEV_LNET_DAEMON_FILE,   /* spool kernel debug buffer to file */
+         PSDEV_LNET_DEBUG_MB,      /* size of debug buffer */
+ };
++#else
++#define CTL_LNET                        CTL_UNNUMBERED
++#define PSDEV_DEBUG                     CTL_UNNUMBERED
++#define PSDEV_SUBSYSTEM_DEBUG           CTL_UNNUMBERED
++#define PSDEV_PRINTK                    CTL_UNNUMBERED
++#define PSDEV_CONSOLE_RATELIMIT         CTL_UNNUMBERED
++#define PSDEV_CONSOLE_MAX_DELAY_CS      CTL_UNNUMBERED
++#define PSDEV_CONSOLE_MIN_DELAY_CS      CTL_UNNUMBERED
++#define PSDEV_CONSOLE_BACKOFF           CTL_UNNUMBERED
++#define PSDEV_DEBUG_PATH                CTL_UNNUMBERED
++#define PSDEV_DEBUG_DUMP_PATH           CTL_UNNUMBERED
++#define PSDEV_LNET_UPCALL               CTL_UNNUMBERED
++#define PSDEV_LNET_MEMUSED              CTL_UNNUMBERED
++#define PSDEV_LNET_CATASTROPHE          CTL_UNNUMBERED
++#define PSDEV_LNET_PANIC_ON_LBUG        CTL_UNNUMBERED
++#define PSDEV_LNET_DUMP_KERNEL          CTL_UNNUMBERED
++#define PSDEV_LNET_DAEMON_FILE          CTL_UNNUMBERED
++#define PSDEV_LNET_DEBUG_MB             CTL_UNNUMBERED
++#endif
+ 
+-static int 
++int 
+ proc_call_handler(void *data, int write, 
+                   loff_t *ppos, void *buffer, size_t *lenp, 
+                   int (*handler)(void *data, int write,
+@@ -100,17 +120,7 @@
+         }
+         return 0;
+ }
+-
+-#define DECLARE_PROC_HANDLER(name)                      \
+-static int                                              \
+-LL_PROC_PROTO(name)                                     \
+-{                                                       \
+-        DECLARE_LL_PROC_PPOS_DECL;                      \
+-                                                        \
+-        return proc_call_handler(table->data, write,    \
+-                                 ppos, buffer, lenp,    \
+-                                 __##name);             \
+-}
++EXPORT_SYMBOL(proc_call_handler);
+ 
+ static int __proc_dobitmasks(void *data, int write, 
+                              loff_t pos, void *buffer, int nob)
+@@ -182,11 +192,12 @@
+ 
+ DECLARE_PROC_HANDLER(proc_daemon_file)
+ 
++char tmpstr[32];
++
+ static int __proc_debug_mb(void *data, int write,
+                            loff_t pos, void *buffer, int nob)
+ {
+         if (!write) {
+-                char tmpstr[32];
+                 int  len = snprintf(tmpstr, sizeof(tmpstr), "%d",
+                                     trace_get_debug_mb());
+ 
+@@ -301,7 +312,8 @@
+                 .data     = &libcfs_debug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_SUBSYSTEM_DEBUG,
+@@ -309,7 +321,8 @@
+                 .data     = &libcfs_subsystem_debug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_PRINTK,
+@@ -317,7 +330,8 @@
+                 .data     = &libcfs_printk,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_RATELIMIT,
+@@ -325,30 +339,36 @@
+                 .data     = &libcfs_console_ratelimit,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_MAX_DELAY_CS,
+                 .procname = "console_max_delay_centisecs",
++                .data     = &libcfs_console_max_delay,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_max_delay_cs
++                .proc_handler = &proc_console_max_delay_cs,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_MIN_DELAY_CS,
+                 .procname = "console_min_delay_centisecs",
+                 .maxlen   = sizeof(int),
++                .data     = &libcfs_console_min_delay,
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_min_delay_cs
++                .proc_handler = &proc_console_min_delay_cs,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_BACKOFF,
+                 .procname = "console_backoff",
+                 .maxlen   = sizeof(int),
++                .data     = &libcfs_console_backoff,
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_backoff
++                .proc_handler = &proc_console_backoff,
++                .strategy = &sysctl_intvec,
+         },
+-
+         {
+                 .ctl_name = PSDEV_DEBUG_PATH,
+                 .procname = "debug_path",
+@@ -356,8 +376,8 @@
+                 .maxlen   = sizeof(debug_file_path),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dostring,
++                .strategy = &sysctl_string,
+         },
+-
+         {
+                 .ctl_name = PSDEV_LNET_UPCALL,
+                 .procname = "upcall",
+@@ -365,6 +385,7 @@
+                 .maxlen   = sizeof(lnet_upcall),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dostring,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_MEMUSED,
+@@ -372,7 +393,8 @@
+                 .data     = (int *)&libcfs_kmemory.counter,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_CATASTROPHE,
+@@ -380,7 +402,8 @@
+                 .data     = &libcfs_catastrophe,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_PANIC_ON_LBUG,
+@@ -388,39 +411,52 @@
+                 .data     = &libcfs_panic_on_lbug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DUMP_KERNEL,
+                 .procname = "dump_kernel",
++                .data     = tmpstr,
++                .maxlen   = 256,
+                 .mode     = 0200,
+                 .proc_handler = &proc_dump_kernel,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DAEMON_FILE,
+                 .procname = "daemon_file",
++                .data     = tmpstr,
+                 .mode     = 0644,
++                .maxlen   = 256,
+                 .proc_handler = &proc_daemon_file,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DEBUG_MB,
+                 .procname = "debug_mb",
++                .data     = tmpstr,
++                .maxlen   = sizeof(tmpstr),
+                 .mode     = 0644,
+                 .proc_handler = &proc_debug_mb,
++                .strategy = &sysctl_string,
+         },
+         {0}
+ };
+ 
+-static cfs_sysctl_table_t top_table[2] = {
++static cfs_sysctl_table_t top_table[] = {
+         {
+-                .ctl_name = PSDEV_LNET,
++                .ctl_name = CTL_LNET,
+                 .procname = "lnet",
+-                .data     = NULL,
+-                .maxlen   = 0,
+                 .mode     = 0555,
+-                .child    = lnet_table
++                .child    = lnet_table,
++#ifdef HAVE_PARENT_IN_CTLTABLE 
++                .parent   = NULL,
++#endif
+         },
+-        {0}
++        {
++                .ctl_name = 0
++        }
+ };
+ 
+ int insert_proc(void)
+diff -urNad trunk~/lnet/libcfs/linux/linux-tcpip.c trunk/lnet/libcfs/linux/linux-tcpip.c
+--- trunk~/lnet/libcfs/linux/linux-tcpip.c	2007-09-06 07:23:17.000000000 +0200
++++ trunk/lnet/libcfs/linux/linux-tcpip.c	2008-09-18 23:45:47.000000000 +0200
+@@ -47,8 +47,11 @@
+                 CERROR ("Can't create socket: %d\n", rc);
+                 return rc;
+         }
+-
++#if HAVE_EXTRA_SOCKMAP_FD_FLAG
++        fd = sock_map_fd(sock, 0);
++#else
+         fd = sock_map_fd(sock);
++#endif
+         if (fd < 0) {
+                 rc = fd;
+                 sock_release(sock);
+diff -urNad trunk~/lnet/lnet/router_proc.c trunk/lnet/lnet/router_proc.c
+--- trunk~/lnet/lnet/router_proc.c	2007-11-29 14:35:39.000000000 +0100
++++ trunk/lnet/lnet/router_proc.c	2008-09-18 23:45:47.000000000 +0200
+@@ -32,12 +32,13 @@
+ 
+ /* this is really lnet_proc.c */
+ 
+-#define LNET_PROC_STATS   "sys/lnet/stats"
+-#define LNET_PROC_ROUTES  "sys/lnet/routes"
+-#define LNET_PROC_ROUTERS "sys/lnet/routers"
+-#define LNET_PROC_PEERS   "sys/lnet/peers"
+-#define LNET_PROC_BUFFERS "sys/lnet/buffers"
+-#define LNET_PROC_NIS     "sys/lnet/nis"
++#define LNET_PROC_ROOT    "sys/lnet"
++#define LNET_PROC_STATS   LNET_PROC_ROOT"/stats"
++#define LNET_PROC_ROUTES  LNET_PROC_ROOT"/routes"
++#define LNET_PROC_ROUTERS LNET_PROC_ROOT"/routers"
++#define LNET_PROC_PEERS   LNET_PROC_ROOT"/peers"
++#define LNET_PROC_BUFFERS LNET_PROC_ROOT"/buffers"
++#define LNET_PROC_NIS     LNET_PROC_ROOT"/nis"
+ 
+ static int
+ lnet_router_proc_stats_read (char *page, char **start, off_t off,
+@@ -1007,6 +1008,12 @@
+ {
+         struct proc_dir_entry *pde;
+ 
++        pde = proc_mkdir(LNET_PROC_ROOT, NULL);
++        if (pde == NULL) {
++                CERROR("couldn't create "LNET_PROC_ROOT"\n");
++                return; 
++        }
++
+         /* Initialize LNET_PROC_STATS */
+         pde = create_proc_entry (LNET_PROC_STATS, 0644, NULL);
+         if (pde == NULL) {
+@@ -1078,6 +1085,7 @@
+         remove_proc_entry(LNET_PROC_PEERS, 0);
+         remove_proc_entry(LNET_PROC_BUFFERS, 0);
+         remove_proc_entry(LNET_PROC_NIS, 0);
++        remove_proc_entry(LNET_PROC_ROOT, 0);
+ }
+ 
+ #else
+diff -urNad trunk~/lustre/autoconf/lustre-core.m4 trunk/lustre/autoconf/lustre-core.m4
+--- trunk~/lustre/autoconf/lustre-core.m4	2008-06-26 05:05:21.000000000 +0200
++++ trunk/lustre/autoconf/lustre-core.m4	2008-09-18 23:52:50.000000000 +0200
+@@ -1064,27 +1064,90 @@
+ ])
+ ])
+ 
++# Older kernels (2.6.18) doesn't know about .parent in 
++# ctl_table
++AC_DEFUN([CLT_TABLE_HAS_PARENT],
++[AC_MSG_CHECKING([sysctl has .parent])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/module.h>
++        #include <linux/sysctl.h>
++],[
++        struct ctl_table random_table[] = {
++        {
++                .ctl_name       = 1,
++                .procname       = "poolsize",
++                .data           = NULL,
++                .maxlen         = sizeof(int),
++                .parent         = NULL,
++        },
++        { .ctl_name = 0 }
++        };
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_PARENT_IN_CTLTABLE, 1,
++              [ctl_table knows .parent])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
++AC_DEFUN([IGET_CALL_IS_PRESENT],
++[AC_MSG_CHECKING([iget() call is available])
++LB_LINUX_TRY_COMPILE([
++      #include <linux/fs.h>
++],[
++      iget(NULL,0);
++],[
++      AC_MSG_RESULT(yes)
++      AC_DEFINE(HAVE_IGET_CALL, 1,
++        [iget call is available, which is removed in 2.6.26])
++],[
++      AC_MSG_RESULT(NO)
++])
++])
++
+ # RHEL5 PageChecked and SetPageChecked defined
+ AC_DEFUN([LC_PAGE_CHECKED],
+ [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
+ LB_LINUX_TRY_COMPILE([
+-        #include <linux/page-flags.h>
++       #include <linux/page-flags.h>
++       #include <linux/autoconf.h>
++       #include <linux/mm_types.h>
++],[
++       struct page *p;
++       
++       /* 2.6.26 use function instead of define for it */
++       SetPageChecked(p);
++       PageChecked(p);
+ ],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_PAGE_CHECKED, 1,
++          [does kernel have PageChecked and SetPageChecked])
++],[
++  AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked defined])
++  LB_LINUX_TRY_COMPILE([
++        #include <linux/page-flags.h>
++        #include <linux/autoconf.h>
++        #include <linux/mm.h>
++  ],[
+         #ifndef PageChecked
+         #error PageChecked not defined in kernel
+         #endif
+         #ifndef SetPageChecked
+         #error SetPageChecked not defined in kernel
+         #endif
+-],[
++  ],[
+         AC_MSG_RESULT(yes)
+         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
+                   [does kernel have PageChecked and SetPageChecked])
+-],[
++  ],[
+         AC_MSG_RESULT(NO)
++  ])
+ ])
+ ])
+ 
++
++
+ AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
+ [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
+ [mm/truncate.c],[
+@@ -1230,13 +1293,191 @@
+ 
+ # 2.6.23 extract nfs export related data into exportfs.h
+ AC_DEFUN([LC_HAVE_EXPORTFS_H],
+-[
+-tmpfl="$CFLAGS"
+-CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
+-AC_CHECK_HEADERS([linux/exportfs.h])
+-CFLAGS="$tmpfl"
++[LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
++        AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
++                [kernel has include/exportfs.h])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.23 have new page fault handling API
++AC_DEFUN([LC_VM_OP_FAULT],
++[AC_MSG_CHECKING([if kernel has .fault in vm_operation_struct])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/mm.h>
++],[
++        struct vm_operations_struct op;
++
++        op.fault = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_VM_OP_FAULT, 1,
++                [if kernel has .fault in vm_operation_struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++#2.6.23 has new shrinker API
++AC_DEFUN([LC_REGISTER_SHRINKER],
++[AC_MSG_CHECKING([if kernel has register_shrinker])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/mm.h>
++],[
++        register_shrinker(NULL);
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
++                [if kernel has register_shrinker])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 has bio_endio with 2 args
++AC_DEFUN([LC_BIO_ENDIO_2ARG],
++[AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/bio.h>
++],[
++        bio_endio(NULL, 0);
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
++                [if kernel has bio_endio with 2 args])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 has new members in exports struct.
++AC_DEFUN([LC_FH_TO_DENTRY],
++[AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
++LB_LINUX_TRY_COMPILE([
++#ifdef HAVE_LINUX_EXPORTFS_H
++        #include <linux/exportfs.h>
++#else
++        #include <linux/fs.h>
++#endif
++],[
++        struct export_operations exp;
++
++        exp.fh_to_dentry   = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
++                [kernel has .fh_to_dentry member in export_operations struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 remove long aged procfs entry -> deleted member
++AC_DEFUN([LC_PROCFS_DELETED],
++[AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
++LB_LINUX_TRY_COMPILE([
++	#include <linux/proc_fs.h>
++],[
++        struct proc_dir_entry pde;
++
++        pde.deleted   = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_PROCFS_DELETED, 1,
++                [kernel has deleted member in procfs entry struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
++AC_DEFUN([LC_FS_STRUCT_USE_PATH],
++[AC_MSG_CHECKING([fs_struct use path structure])
++LB_LINUX_TRY_COMPILE([
++        #include <asm/atomic.h>
++        #include <linux/spinlock.h>
++        #include <linux/fs_struct.h>
++],[
++        struct path path;
++        struct fs_struct fs;
++
++        fs.pwd = path;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
++                [fs_struct use path structure])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.26 drop list_for_each_safe_rcu
++AC_DEFUN([LC_RCU_LIST_SAFE],
++[AC_MSG_CHECKING([if list_for_each_safe_rcu exist])
++LB_LINUX_TRY_COMPILE([
++    #include <linux/list.h>
++],[
++    #ifndef list_for_each_safe_rcu
++    #error list_for_each_safe not exist
++    #endif
++],[
++    AC_DEFINE(HAVE_RCU_LIST_SAFE, 1, [list_for_each_safe_rcu exist])
++    AC_MSG_RESULT([yes])
++],[
++    AC_MSG_RESULT([no]) 
++])
++])
++
++# 2.6.26 remove path_release and use path_put instead
++AC_DEFUN([LC_PATH_RELEASE],
++[AC_MSG_CHECKING([if path_release exist])
++LB_LINUX_TRY_COMPILE([
++    #include <linux/dcache.h>
++    #include <linux/namei.h>
++],[
++    path_release(NULL);
++],[
++    AC_DEFINE(HAVE_PATH_RELEASE, 1, [path_release exist])
++    AC_MSG_RESULT([yes])
++],[
++    AC_MSG_RESULT([no]) 
++])
+ ])
+ 
++# asm/semaphore.h is deprecated on 2.6.27
++# include instead linux/semaphore.h
++AC_DEFUN([LC_ASM_SEMAPHORE_H],
++[AC_MSG_CHECKING([if asm/semaphore.h exists])
++LB_LINUX_TRY_COMPILE([
++    #include <asm/semaphore.h>
++],[
++   //do nothing here
++],[
++  AC_DEFINE(HAVE_ASM_SEMAPHORE_H, 1, [asm/semaphore.h exists])
++  AC_MSG_RESULT(yes)
++],[
++  AC_MSG_RESULT(NO)
++])
++])
++
++# request_queue_t is deleted in 2.6.27, use
++# instead the request_queue struct
++AC_DEFUN([LC_REQUEST_QUEUE_T],
++[AC_MSG_CHECKING([for request_queue_t])
++LB_LINUX_TRY_COMPILE([
++    #include <linux/blkdev.h>
++],[
++    request_queue_t *test;
++],[
++    AC_DEFINE([HAVE_REQUEST_QUEUE_T, 1, [request_queue_t is available])
++    AC_MSG_RESULT(yes)
++],[
++    AC_MSG_RESULT(NO)
++])
++])
++          
++
+ #
+ # LC_PROG_LINUX
+ #
+@@ -1327,10 +1568,28 @@
+ 	  
+ 	  # 2.6.22
+           LC_INVALIDATE_BDEV_2ARG
++
+           # 2.6.23
+           LC_UNREGISTER_BLKDEV_RETURN_INT
+           LC_KERNEL_SPLICE_READ
+           LC_HAVE_EXPORTFS_H
++          LC_VM_OP_FAULT
++          LC_REGISTER_SHRINKER
++	  
++	  # 2.6.24
++          LC_BIO_ENDIO_2ARG
++          LC_FH_TO_DENTRY
++	  LC_PROCFS_DELETED
++
++          # 2.6.26
++          LC_FS_STRUCT_USE_PATH
++          LC_RCU_LIST_SAFE
++	        LC_PATH_RELEASE
++          IGET_CALL_IS_PRESENT
++
++          #2.6.27
++          LC_ASM_SEMAPHORE_H
++          LC_REQUEST_QUEUE_T
+ ])
+ 
+ #
+@@ -1511,6 +1770,7 @@
+         ],[
+                 AC_MSG_RESULT([no]) 
+         ])
++
+ ],[
+         AC_MSG_RESULT([no])
+ ])
+diff -urNad trunk~/lustre/include/liblustre.h trunk/lustre/include/liblustre.h
+--- trunk~/lustre/include/liblustre.h	2008-04-24 09:07:44.000000000 +0200
++++ trunk/lustre/include/liblustre.h	2008-09-18 23:45:47.000000000 +0200
+@@ -718,11 +718,13 @@
+ struct _cap_struct;
+ typedef struct _cap_struct *cap_t;
+ typedef int cap_value_t;
++
+ typedef enum {
+     CAP_EFFECTIVE=0,
+     CAP_PERMITTED=1,
+     CAP_INHERITABLE=2
+ } cap_flag_t;
++
+ typedef enum {
+     CAP_CLEAR=0,
+     CAP_SET=1
+@@ -732,11 +734,33 @@
+ #define CAP_DAC_READ_SEARCH     2
+ #define CAP_FOWNER              3
+ #define CAP_FSETID              4
+-#define CAP_SYS_ADMIN          21
++#define CAP_SYS_ADMIN           21
++#define CAP_SYS_RESOURCE        24
++
++#define cap_raise(c, flag) do {} while(0)
++
+ 
+ cap_t   cap_get_proc(void);
+ int     cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
+ 
++/* XXX should be move into licfs */
++typedef __u32 cfs_cap_t;
++
++static inline cfs_kernel_cap_t cfs_curproc_cap_get(void)
++{
++        return current->cap_effective;
++}
++
++static inline void cfs_curproc_cap_set(cfs_kernel_cap_t cap)
++{
++        current->cap_effective = cap;
++}
++
++static inline cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t data)
++{
++        return (cfs_cap_t)data;
++}
++
+ static inline void libcfs_run_lbug_upcall(char *file, const char *fn,
+                                            const int l){}
+ 
+diff -urNad trunk~/lustre/include/linux/lustre_compat25.h trunk/lustre/include/linux/lustre_compat25.h
+--- trunk~/lustre/include/linux/lustre_compat25.h	2008-03-27 04:32:33.000000000 +0100
++++ trunk/lustre/include/linux/lustre_compat25.h	2008-09-18 23:45:47.000000000 +0200
+@@ -43,6 +43,28 @@
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) */
+ 
+ #ifndef HAVE_SET_FS_PWD
++
++#ifdef HAVE_FS_STRUCT_USE_PATH
++static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
++                struct dentry *dentry)
++{
++        struct path path;
++	struct path old_pwd;
++
++        path.mnt = mnt;
++        path.dentry = dentry;
++        write_lock(&fs->lock);
++        old_pwd = fs->pwd;
++        path_get(&path);
++        fs->pwd = path;
++        write_unlock(&fs->lock);
++
++	if (old_pwd.dentry)
++		path_put(&old_pwd);
++}
++
++#else
++
+ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
+                 struct dentry *dentry)
+ {
+@@ -61,6 +83,7 @@
+                 mntput(old_pwdmnt);
+         }
+ }
++#endif
+ #else
+ #define ll_set_fs_pwd set_fs_pwd
+ #endif /* HAVE_SET_FS_PWD */
+@@ -538,5 +561,56 @@
+ #define ll_invalidate_bdev(a,b)         invalidate_bdev((a))
+ #endif
+ 
++#ifdef HAVE_REGISTER_SHRINKER
++typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask);
++
++static inline
++struct shrinker *set_shrinker(int seek, shrinker_t func)
++{
++        struct shrinker *s;
++
++        s = kmalloc(sizeof(*s), GFP_KERNEL);
++        if (s == NULL)
++                return (NULL);
++
++        s->shrink = func;
++        s->seeks = seek;
++
++        register_shrinker(s);
++
++        return s;
++}
++
++static inline
++void remove_shrinker(struct shrinker *shrinker) 
++{
++        if (shrinker == NULL)
++                return;
++
++        unregister_shrinker(shrinker);
++        kfree(shrinker);
++}
++#endif
++
++#ifdef HAVE_BIO_ENDIO_2ARG
++#define cfs_bio_io_error(a,b)   bio_io_error((a))
++#define cfs_bio_endio(a,b,c)    bio_endio((a),(c))
++#else
++#define cfs_bio_io_error(a,b)   bio_io_error((a),(b))
++#define cfs_bio_endio(a,b,c)    bio_endio((a),(b),(c))
++#endif
++
++#ifdef HAVE_FS_STRUCT_USE_PATH
++#define cfs_fs_pwd(fs)       ((fs)->pwd.dentry)
++#define cfs_fs_mnt(fs)       ((fs)->pwd.mnt)
++#else
++#define cfs_fs_pwd(fs)       ((fs)->pwd)
++#define cfs_fs_mnt(fs)       ((fs)->pwdmnt)
++#endif
++
++#ifndef HAVE_RCU_LIST_SAFE
++#define list_for_each_safe_rcu(a,b,c) list_for_each_rcu(b, c)
++#endif
++
+ #endif /* __KERNEL__ */
+ #endif /* _COMPAT25_H */
+diff -urNad trunk~/lustre/include/linux/lustre_lib.h trunk/lustre/include/linux/lustre_lib.h
+--- trunk~/lustre/include/linux/lustre_lib.h	2007-09-13 04:24:44.000000000 +0200
++++ trunk/lustre/include/linux/lustre_lib.h	2008-09-18 23:45:47.000000000 +0200
+@@ -33,7 +33,11 @@
+ # include <string.h>
+ # include <sys/types.h>
+ #else
+-# include <asm/semaphore.h>
++# if HAVE_ASM_SEMAPHORE_H
++#  include <asm/semaphore.h>
++# else
++#  include <linux/semaphore.h>
++# endif
+ # include <linux/rwsem.h>
+ # include <linux/sched.h>
+ # include <linux/signal.h>
+diff -urNad trunk~/lustre/include/linux/lvfs.h trunk/lustre/include/linux/lvfs.h
+--- trunk~/lustre/include/linux/lvfs.h	2007-07-26 08:24:10.000000000 +0200
++++ trunk/lustre/include/linux/lvfs.h	2008-09-18 23:45:47.000000000 +0200
+@@ -47,7 +47,7 @@
+         struct upcall_cache_entry *luc_uce;
+         __u32 luc_fsuid;
+         __u32 luc_fsgid;
+-        __u32 luc_cap;
++        cfs_kernel_cap_t luc_cap;
+         __u32 luc_suppgid1;
+         __u32 luc_suppgid2;
+         __u32 luc_umask;
+diff -urNad trunk~/lustre/include/lprocfs_status.h trunk/lustre/include/lprocfs_status.h
+--- trunk~/lustre/include/lprocfs_status.h	2008-04-18 06:47:52.000000000 +0200
++++ trunk/lustre/include/lprocfs_status.h	2008-09-18 23:45:47.000000000 +0200
+@@ -481,6 +481,8 @@
+ #define LPROCFS_EXIT()            do {  \
+         up_read(&_lprocfs_lock);        \
+ } while(0)
++
++#ifdef HAVE_PROCFS_DELETED
+ #define LPROCFS_ENTRY_AND_CHECK(dp) do {        \
+         typecheck(struct proc_dir_entry *, dp); \
+         LPROCFS_ENTRY();                        \
+@@ -489,6 +491,13 @@
+                 return -ENODEV;                 \
+         }                                       \
+ } while(0)
++#define LPROCFS_CHECK_DELETED(dp) ((dp)->deleted)
++#else
++#define LPROCFS_ENTRY_AND_CHECK(dp) \
++        LPROCFS_ENTRY();
++#define LPROCFS_CHECK_DELETED(dp) (0)
++#endif
++
+ 
+ /* You must use these macros when you want to refer to 
+  * the import in a client obd_device for a lprocfs entry */
+diff -urNad trunk~/lustre/include/lustre_log.h trunk/lustre/include/lustre_log.h
+--- trunk~/lustre/include/lustre_log.h	2007-08-24 13:12:48.000000000 +0200
++++ trunk/lustre/include/lustre_log.h	2008-09-18 23:45:47.000000000 +0200
+@@ -218,14 +218,6 @@
+         void                    *llog_proc_cb;
+ };
+ 
+-#ifndef __KERNEL__
+-
+-#define cap_raise(c, flag) do {} while(0)
+-
+-#define CAP_SYS_RESOURCE 24
+-
+-#endif   /* !__KERNEL__ */
+-
+ static inline void llog_gen_init(struct llog_ctxt *ctxt)
+ {
+         struct obd_device *obd = ctxt->loc_exp->exp_obd;
+@@ -329,7 +321,7 @@
+                                  int numcookies, void *buf, int idx)
+ {
+         struct llog_operations *lop;
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc, buflen;
+         ENTRY;
+ 
+@@ -346,10 +338,10 @@
+                 buflen = rec->lrh_len;
+         LASSERT(size_round(buflen) == buflen);
+ 
+-        cap = current->cap_effective;             
+-        cap_raise(current->cap_effective, CAP_SYS_RESOURCE); 
++        cap = current->cap_effective;
++        cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ 
+@@ -445,7 +437,7 @@
+                               struct llog_logid *logid, char *name)
+ {
+         struct llog_operations *lop;
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc;
+         ENTRY;
+ 
+@@ -455,10 +447,10 @@
+         if (lop->lop_create == NULL)
+                 RETURN(-EOPNOTSUPP);
+ 
+-        cap = current->cap_effective;             
++        cap = current->cap_effective;
+         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = lop->lop_create(ctxt, res, logid, name);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ 
+diff -urNad trunk~/lustre/include/lustre_mds.h trunk/lustre/include/lustre_mds.h
+--- trunk~/lustre/include/lustre_mds.h	2008-04-24 06:41:00.000000000 +0200
++++ trunk/lustre/include/lustre_mds.h	2008-09-18 23:45:47.000000000 +0200
+@@ -177,7 +177,7 @@
+                  struct page *, struct ptlrpc_request **);
+ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
+                const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+-               __u32 cap_effective, __u64 rdev,struct ptlrpc_request **request);
++               cfs_kernel_cap_t cap_effective, __u64 rdev,struct ptlrpc_request **request);
+ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *data,
+                struct ptlrpc_request **request);
+ int mdc_link(struct obd_export *exp, struct mdc_op_data *data,
+diff -urNad trunk~/lustre/llite/file.c trunk/lustre/llite/file.c
+--- trunk~/lustre/llite/file.c	2008-09-18 23:45:46.000000000 +0200
++++ trunk/lustre/llite/file.c	2008-09-18 23:45:47.000000000 +0200
+@@ -1681,9 +1681,17 @@
+ /*
+  * Send file content (through pagecache) somewhere with helper
+  */
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+-static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
+-                                read_actor_t actor, void *target)
++/* change based on 
++ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f0930fffa99e7fe0a0c4b6c7d9a244dc88288c27
++ */
++#ifdef HAVE_KERNEL_SPLICE_READ
++static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
++                                   struct pipe_inode_info *pipe, size_t count,
++                                   unsigned int flags)
++#else
++static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,
++                                size_t count, read_actor_t actor, void *target)
++#endif
+ {
+         struct inode *inode = in_file->f_dentry->d_inode;
+         struct ll_inode_info *lli = ll_i2info(inode);
+@@ -1692,8 +1700,7 @@
+         struct ll_lock_tree_node *node;
+         struct ost_lvb lvb;
+         struct ll_ra_read bead;
+-        int rc;
+-        ssize_t retval;
++        ssize_t rc;
+         __u64 kms;
+         ENTRY;
+         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
+@@ -1709,8 +1716,14 @@
+         in_file->f_ra.ra_pages = 0;
+ 
+         /* File with no objects, nothing to lock */
+-        if (!lsm)
+-                RETURN(generic_file_sendfile(in_file, ppos, count, actor, target));
++        if (!lsm) {
++#ifdef HAVE_KERNEL_SPLICE_READ
++                rc = generic_file_splice_read(in_file, ppos, pipe, count, flags);
++#else
++                rc = generic_file_sendfile(in_file, ppos, count, actor, target);
++#endif
++                RETURN(rc);
++        }
+ 
+         node = ll_node_from_inode(inode, *ppos, *ppos + count - 1, LCK_PR);
+         if (IS_ERR(node))
+@@ -1750,8 +1763,8 @@
+                 /* A glimpse is necessary to determine whether we return a
+                  * short read (B) or some zeroes at the end of the buffer (C) */
+                 ll_inode_size_unlock(inode, 1);
+-                retval = ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
+-                if (retval)
++                rc = ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
++                if (rc)
+                         goto out;
+         } else {
+                 /* region is within kms and, hence, within real file size (A) */
+@@ -1767,14 +1780,17 @@
+         ll_ra_read_in(in_file, &bead);
+         /* BUG: 5972 */
+         file_accessed(in_file);
+-        retval = generic_file_sendfile(in_file, ppos, count, actor, target);
++#ifdef HAVE_KERNEL_SPLICE_READ
++        rc = generic_file_splice_read(in_file, ppos, pipe, count, flags);
++#else
++        rc = generic_file_sendfile(in_file, ppos, count, actor, target);
++#endif
+         ll_ra_read_ex(in_file, &bead);
+ 
+  out:
+         ll_tree_unlock(&tree);
+-        RETURN(retval);
++        RETURN(rc);
+ }
+-#endif
+ 
+ static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
+                                unsigned long arg)
+@@ -2916,7 +2932,9 @@
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+@@ -2932,7 +2950,7 @@
+         .write          = ll_file_write,
+ #ifdef HAVE_FILE_WRITEV
+         .writev         = ll_file_writev,
+-#else   
++#else
+         .aio_write      = ll_file_aio_write,
+ #endif
+         .ioctl          = ll_file_ioctl,
+@@ -2940,7 +2958,9 @@
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+@@ -2961,7 +2981,7 @@
+         .write          = ll_file_write,
+ #ifdef HAVE_FILE_WRITEV
+         .writev         = ll_file_writev,
+-#else   
++#else
+         .aio_write      = ll_file_aio_write,
+ #endif
+         .ioctl          = ll_file_ioctl,
+@@ -2969,7 +2989,9 @@
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+diff -urNad trunk~/lustre/llite/llite_internal.h trunk/lustre/llite/llite_internal.h
+--- trunk~/lustre/llite/llite_internal.h	2008-04-26 16:30:54.000000000 +0200
++++ trunk/lustre/llite/llite_internal.h	2008-09-18 23:45:47.000000000 +0200
+@@ -681,9 +681,6 @@
+ /* llite/llite_nfs.c */
+ extern struct export_operations lustre_export_operations;
+ __u32 get_uuid2int(const char *name, int len);
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+-                               int fhtype, int parent);
+-int ll_dentry_to_fh(struct dentry *, __u32 *datap, int *lenp, int need_parent);
+ 
+ /* llite/special.c */
+ extern struct inode_operations ll_special_inode_operations;
+diff -urNad trunk~/lustre/llite/llite_lib.c trunk/lustre/llite/llite_lib.c
+--- trunk~/lustre/llite/llite_lib.c	2008-05-28 21:15:40.000000000 +0200
++++ trunk/lustre/llite/llite_lib.c	2008-09-18 23:45:47.000000000 +0200
+@@ -1347,7 +1347,7 @@
+                 rc = vmtruncate(inode, new_size);
+                 clear_bit(LLI_F_SRVLOCK, &lli->lli_flags);
+                 if (rc != 0) {
+-                        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
++//                        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
+                         ll_inode_size_unlock(inode, 0);
+                 }
+         }
+diff -urNad trunk~/lustre/llite/llite_mmap.c trunk/lustre/llite/llite_mmap.c
+--- trunk~/lustre/llite/llite_mmap.c	2008-03-27 04:32:37.000000000 +0100
++++ trunk/lustre/llite/llite_mmap.c	2008-09-18 23:45:47.000000000 +0200
+@@ -38,9 +38,6 @@
+ #include <linux/mm.h>
+ #include <linux/pagemap.h>
+ #include <linux/smp_lock.h>
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-#include <linux/iobuf.h>
+-#endif
+ 
+ #define DEBUG_SUBSYSTEM S_LLITE
+ 
+@@ -66,18 +63,11 @@
+         struct inode           *lt_inode;
+ };
+ 
++static struct vm_operations_struct ll_file_vm_ops;
++
+ int lt_get_mmap_locks(struct ll_lock_tree *tree,
+                       unsigned long addr, size_t count);
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int *type);
+-#else
+-
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int unused);
+-#endif
+-
+ struct ll_lock_tree_node * ll_node_from_inode(struct inode *inode, __u64 start,
+                                               __u64 end, ldlm_mode_t mode)
+ {
+@@ -302,7 +292,7 @@
+         spin_lock(&mm->page_table_lock);
+         for(vma = find_vma(mm, addr);
+             vma != NULL && vma->vm_start < (addr + count); vma = vma->vm_next) {
+-                if (vma->vm_ops && vma->vm_ops->nopage == ll_nopage &&
++                if (vma->vm_ops && vma->vm_ops == &ll_file_vm_ops &&
+                     vma->vm_flags & VM_SHARED) {
+                         ret = vma;
+                         break;
+@@ -350,53 +340,28 @@
+         RETURN(0);
+ }
+ 
+-/* FIXME: there is a pagefault race goes as follow (only 2.4):
+- * 1. A user process on node A accesses a portion of a mapped file,
+- *    resulting in a page fault.  The pagefault handler invokes the
+- *    ll_nopage function, which reads the page into memory.
+- * 2. A user process on node B writes to the same portion of the file
+- *    (either via mmap or write()), that cause node A to cancel the
+- *    lock and truncate the page.
+- * 3. Node A then executes the rest of do_no_page(), entering the
+- *    now-invalid page into the PTEs.
+- *
+- * Make the whole do_no_page as a hook to cover both the page cache
+- * and page mapping installing with dlm lock would eliminate this race.
+- *
+- * In 2.6, the truncate_count of address_space can cover this race.
+- */
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int *type)
+-#else
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int type /* unused */)
+-#endif
++static int ll_get_extent_lock(struct vm_area_struct *vma, unsigned long pgoff,
++                             int *save_flags, struct lustre_handle *lockh)
+ {
+         struct file *filp = vma->vm_file;
+         struct ll_file_data *fd = LUSTRE_FPRIVATE(filp);
+         struct inode *inode = filp->f_dentry->d_inode;
+-        struct lustre_handle lockh = { 0 };
+         ldlm_policy_data_t policy;
+         ldlm_mode_t mode;
+-        struct page *page = NULL;
+         struct ll_inode_info *lli = ll_i2info(inode);
+-        struct lov_stripe_md *lsm;
+         struct ost_lvb lvb;
+         __u64 kms, old_mtime;
+-        unsigned long pgoff, size, rand_read, seq_read;
+-        int rc = 0;
+-        ENTRY;
++        unsigned long size;
++
+ 
+         if (lli->lli_smd == NULL) {
+                 CERROR("No lsm on fault?\n");
+-                RETURN(NULL);
++                RETURN(0);
+         }
+-
+         ll_clear_file_contended(inode);
+ 
+         /* start and end the lock on the first and last bytes in the page */
+-        policy_from_vma(&policy, vma, address, CFS_PAGE_SIZE);
++        policy_from_vma(&policy, vma, pgoff, CFS_PAGE_SIZE);
+ 
+         CDEBUG(D_MMAP, "nopage vma %p inode %lu, locking ["LPU64", "LPU64"]\n",
+                vma, inode->i_ino, policy.l_extent.start, policy.l_extent.end);
+@@ -404,26 +369,23 @@
+         mode = mode_from_vma(vma);
+         old_mtime = LTIME_S(inode->i_mtime);
+ 
+-        lsm = lli->lli_smd;
+-        rc = ll_extent_lock(fd, inode, lsm, mode, &policy,
+-                            &lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU);
+-        if (rc != 0)
+-                RETURN(NULL);
++        if(ll_extent_lock(fd, inode, lli->lli_smd, mode, &policy,
++                           lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU))
++                RETURN(0);
+ 
+         if (vma->vm_flags & VM_EXEC && LTIME_S(inode->i_mtime) != old_mtime)
+                 CWARN("binary changed. inode %lu\n", inode->i_ino);
+ 
+-        lov_stripe_lock(lsm);
++        lov_stripe_lock(lli->lli_smd);
+         inode_init_lvb(inode, &lvb);
+-        obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1);
++        obd_merge_lvb(ll_i2obdexp(inode), lli->lli_smd, &lvb, 1);
+         kms = lvb.lvb_size;
+ 
+-        pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
+         size = (kms + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;
+-
+         if (pgoff >= size) {
+-                lov_stripe_unlock(lsm);
++                lov_stripe_unlock(lli->lli_smd);
+                 ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
++                lov_stripe_lock(lli->lli_smd);
+         } else {
+                 /* XXX change inode size without ll_inode_size_lock() held!
+                  *     there is a race condition with truncate path. (see
+@@ -445,38 +407,85 @@
+                         CDEBUG(D_INODE, "ino=%lu, updating i_size %llu\n",
+                                inode->i_ino, i_size_read(inode));
+                 }
+-                lov_stripe_unlock(lsm);
+         }
+ 
+         /* If mapping is writeable, adjust kms to cover this page,
+          * but do not extend kms beyond actual file size.
+          * policy.l_extent.end is set to the end of the page by policy_from_vma
+          * bug 10919 */
+-        lov_stripe_lock(lsm);
+         if (mode == LCK_PW)
+-                obd_adjust_kms(ll_i2obdexp(inode), lsm,
++                obd_adjust_kms(ll_i2obdexp(inode), lli->lli_smd,
+                                min_t(loff_t, policy.l_extent.end + 1,
+                                i_size_read(inode)), 0);
+-        lov_stripe_unlock(lsm);
++        lov_stripe_unlock(lli->lli_smd);
+ 
+         /* disable VM_SEQ_READ and use VM_RAND_READ to make sure that
+          * the kernel will not read other pages not covered by ldlm in
+          * filemap_nopage. we do our readahead in ll_readpage.
+          */
+-        rand_read = vma->vm_flags & VM_RAND_READ;
+-        seq_read = vma->vm_flags & VM_SEQ_READ;
++       *save_flags = vma->vm_flags & (VM_RAND_READ | VM_SEQ_READ);
+         vma->vm_flags &= ~ VM_SEQ_READ;
+         vma->vm_flags |= VM_RAND_READ;
+ 
++        RETURN(1);
++}
++
++static void ll_put_extent_lock(struct vm_area_struct *vma, int save_flags,
++                             struct lustre_handle *lockh)
++{
++        struct file *filp = vma->vm_file;
++        struct ll_file_data *fd = LUSTRE_FPRIVATE(filp);
++        struct inode *inode = filp->f_dentry->d_inode;
++        ldlm_mode_t mode;
++
++        mode = mode_from_vma(vma);
++        vma->vm_flags &= ~(VM_RAND_READ | VM_SEQ_READ);
++        vma->vm_flags |= save_flags;
++
++        ll_extent_unlock(fd, inode, ll_i2info(inode)->lli_smd, mode, lockh);
++}
++
++#ifndef HAVE_VM_OP_FAULT
++struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
++                       int *type) {
++        struct lustre_handle lockh = { 0 };
++        int save_fags;
++        unsigned long pgoff;
++        struct page *page;
++        ENTRY;
++
++        pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
++        if(!ll_extent_tree_lock(vma, pgoff, &save_fags, &lockh))
++                RETURN(NOPAGE_SIGBUS);
++
+         page = filemap_nopage(vma, address, type);
+         LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
+                        (long)type);
+-        vma->vm_flags &= ~VM_RAND_READ;
+-        vma->vm_flags |= (rand_read | seq_read);
+ 
+-        ll_extent_unlock(fd, inode, ll_i2info(inode)->lli_smd, mode, &lockh);
++        ll_put_tree_lock(vma, save_fags, &lockh);
++
+         RETURN(page);
+ }
++#else
++/* New fault() API*/
++int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++{
++        struct lustre_handle lockh = { 0 };
++        int save_fags;
++        int rc;
++        ENTRY;
++
++        if(!ll_get_extent_lock(vma, vmf->pgoff, &save_fags, &lockh))
++               RETURN(VM_FAULT_SIGBUS);
++
++        rc = filemap_fault(vma, vmf);
++        LL_CDEBUG_PAGE(D_PAGE, vmf->page, "got addr %p type NOPAGE\n",
++                       vmf->virtual_address);
++        ll_put_extent_lock(vma, save_fags, &lockh);
++
++        RETURN(rc);
++}
++#endif
+ 
+ /* To avoid cancel the locks covering mmapped region for lock cache pressure,
+  * we track the mapped vma count by lli_mmap_cnt.
+@@ -542,9 +551,12 @@
+         }
+ }
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifndef HAVE_VM_OP_FAULT
+ #ifndef HAVE_FILEMAP_POPULATE
+-static int (*filemap_populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
++static int (*filemap_populate)(struct vm_area_struct * area, 
++                               unsigned long address, unsigned long len, 
++                               pgprot_t prot, unsigned long pgoff, 
++                               int nonblock);
+ #endif
+ static int ll_populate(struct vm_area_struct *area, unsigned long address,
+                        unsigned long len, pgprot_t prot, unsigned long pgoff,
+@@ -566,47 +578,6 @@
+ 
+ }
+ 
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-/* [first, last] are the byte offsets affected.
+- * vm_{start, end} are user addresses of the first byte of the mapping and
+- *      the next byte beyond it
+- * vm_pgoff is the page index of the first byte in the mapping */
+-static void teardown_vmas(struct vm_area_struct *vma, __u64 first,
+-                          __u64 last)
+-{
+-        unsigned long address, len;
+-        for (; vma ; vma = vma->vm_next_share) {
+-                if (last >> CFS_PAGE_SHIFT < vma->vm_pgoff)
+-                        continue;
+-                if (first >> CFS_PAGE_SHIFT >= (vma->vm_pgoff +
+-                    ((vma->vm_end - vma->vm_start) >> CFS_PAGE_SHIFT)))
+-                        continue;
+-
+-                /* XXX in case of unmap the cow pages of a running file,
+-                 * don't unmap these private writeable mapping here!
+-                 * though that will break private mappping a little.
+-                 *
+-                 * the clean way is to check the mapping of every page
+-                 * and just unmap the non-cow pages, just like
+-                 * unmap_mapping_range() with even_cow=0 in kernel 2.6.
+-                 */
+-                if (!(vma->vm_flags & VM_SHARED) &&
+-                    (vma->vm_flags & VM_WRITE))
+-                        continue;
+-
+-                address = max((unsigned long)vma->vm_start,
+-                              file_to_user(vma, first));
+-                len = min((unsigned long)vma->vm_end,
+-                          file_to_user(vma, last) + 1) - address;
+-
+-                VMA_DEBUG(vma, "zapping vma [first="LPU64" last="LPU64" "
+-                          "address=%ld len=%ld]\n", first, last, address, len);
+-                LASSERT(len > 0);
+-                ll_zap_page_range(vma, address, len);
+-        }
+-}
+-#endif
+-
+ /* XXX put nice comment here.  talk about __free_pte -> dirty pages and
+  * nopage's reference passing to the pte */
+ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last)
+@@ -615,32 +586,21 @@
+         ENTRY;
+ 
+         LASSERTF(last > first, "last "LPU64" first "LPU64"\n", last, first);
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+         if (mapping_mapped(mapping)) {
+                 rc = 0;
+                 unmap_mapping_range(mapping, first + CFS_PAGE_SIZE - 1,
+                                     last - first + 1, 0);
+         }
+-#else
+-        spin_lock(&mapping->i_shared_lock);
+-        if (mapping->i_mmap != NULL) {
+-                rc = 0;
+-                teardown_vmas(mapping->i_mmap, first, last);
+-        }
+-        if (mapping->i_mmap_shared != NULL) {
+-                rc = 0;
+-                teardown_vmas(mapping->i_mmap_shared, first, last);
+-        }
+-        spin_unlock(&mapping->i_shared_lock);
+-#endif
+         RETURN(rc);
+ }
+ 
+ static struct vm_operations_struct ll_file_vm_ops = {
+-        .nopage         = ll_nopage,
+         .open           = ll_vm_open,
+         .close          = ll_vm_close,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_VM_OP_FAULT
++        .fault          = ll_fault,
++#else
++        .nopage         = ll_nopage,
+         .populate       = ll_populate,
+ #endif
+ };
+@@ -653,8 +613,7 @@
+         ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), LPROC_LL_MAP, 1);
+         rc = generic_file_mmap(file, vma);
+         if (rc == 0) {
+-#if !defined(HAVE_FILEMAP_POPULATE) && \
+-    (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#if !defined(HAVE_FILEMAP_POPULATE) && !defined(HAVE_VM_OP_FAULT)
+                 if (!filemap_populate)
+                         filemap_populate = vma->vm_ops->populate;
+ #endif
+diff -urNad trunk~/lustre/llite/llite_nfs.c trunk/lustre/llite/llite_nfs.c
+--- trunk~/lustre/llite/llite_nfs.c	2008-04-24 06:41:05.000000000 +0200
++++ trunk/lustre/llite/llite_nfs.c	2008-09-18 23:45:47.000000000 +0200
+@@ -40,11 +40,7 @@
+         return (key0 << 1);
+ }
+ 
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-static int ll_nfs_test_inode(struct inode *inode, unsigned long ino, void *opaque)
+-#else
+ static int ll_nfs_test_inode(struct inode *inode, void *opaque)
+-#endif
+ {
+         struct ll_fid *iid = opaque;
+ 
+@@ -56,12 +52,10 @@
+ 
+ static struct inode * search_inode_for_lustre(struct super_block *sb,
+                                               unsigned long ino,
+-                                              unsigned long generation,
+-                                              int mode)
++                                              unsigned long generation)
+ {
+         struct ptlrpc_request *req = NULL;
+         struct ll_sb_info *sbi = ll_s2sbi(sb);
+-        struct ll_fid fid;
+         unsigned long valid = 0;
+         int eadatalen = 0, rc;
+         struct inode *inode = NULL;
+@@ -72,17 +66,15 @@
+ 
+         if (inode)
+                 RETURN(inode);
+-        if (S_ISREG(mode)) {
+-                rc = ll_get_max_mdsize(sbi, &eadatalen);
+-                if (rc) 
+-                        RETURN(ERR_PTR(rc));
+-                valid |= OBD_MD_FLEASIZE;
+-        }
+-        fid.id = (__u64)ino;
+-        fid.generation = generation;
+-        fid.f_type = mode;
+ 
+-        rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
++        rc = ll_get_max_mdsize(sbi, &eadatalen);
++        if (rc) 
++                RETURN(ERR_PTR(rc));
++
++        valid |= OBD_MD_FLEASIZE;
++
++        /* mds_fid2dentry ignore f_type */
++        rc = mdc_getattr(sbi->ll_mdc_exp, &iid, valid, eadatalen, &req);
+         if (rc) {
+                 CERROR("failure %d inode %lu\n", rc, ino);
+                 RETURN(ERR_PTR(rc));
+@@ -98,20 +90,23 @@
+         RETURN(inode);
+ }
+ 
+-static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
+-                                      __u32 generation, umode_t mode)
++extern struct dentry_operations ll_d_ops;
++
++#ifdef HAVE_FH_TO_DENTRY
++static struct inode *ll_iget_for_nfs(struct super_block *sb, __u64 ino,
++                                      __u32 generation)
++#else
++static struct inode *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
++                                      __u32 generation)
++#endif
+ {
+         struct inode *inode;
+-        struct dentry *result;
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-        struct list_head *lp;
+-#endif
+         ENTRY;
+ 
+         if (ino == 0)
+                 RETURN(ERR_PTR(-ESTALE));
+ 
+-        inode = search_inode_for_lustre(sb, ino, generation, mode);
++        inode = search_inode_for_lustre(sb, ino, generation);
+         if (IS_ERR(inode)) {
+                 RETURN(ERR_PTR(PTR_ERR(inode)));
+         }
+@@ -125,40 +120,24 @@
+                 iput(inode);
+                 RETURN(ERR_PTR(-ESTALE));
+         }
++        RETURN(inode);
++}
++
++static struct dentry *ll_nfs_get_dentry(struct super_block *sb, void *data)
++{
++        __u32 *inump = (__u32*)data;
++        struct inode *inode;
++        struct dentry *result;
++
++        inode = ll_iget_for_nfs(sb, inump[0], inump[1]);
++        if (IS_ERR(inode))
++                RETURN((struct dentry *)inode);
+ 
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+         result = d_alloc_anon(inode);
+         if (!result) {
+                 iput(inode);
+                 RETURN(ERR_PTR(-ENOMEM));
+         }
+-#else
+-        /* now to find a dentry.
+-         * If possible, get a well-connected one
+-         */
+-        spin_lock(&dcache_lock);
+-        for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
+-                result = list_entry(lp,struct dentry, d_alias);
+-                lock_dentry(result);
+-                if (!(result->d_flags & DCACHE_DISCONNECTED)) {
+-                        dget_locked(result);
+-                        ll_set_dflags(result, DCACHE_REFERENCED);
+-                        unlock_dentry(result);
+-                        spin_unlock(&dcache_lock);
+-                        iput(inode);
+-                        RETURN(result);
+-                }
+-                unlock_dentry(result);
+-        }
+-        spin_unlock(&dcache_lock);
+-        result = d_alloc_root(inode);
+-        if (result == NULL) {
+-                iput(inode);
+-                RETURN(ERR_PTR(-ENOMEM));
+-        }
+-        result->d_flags |= DCACHE_DISCONNECTED;
+-
+-#endif
+         ll_set_dd(result);
+ 
+         lock_dentry(result);
+@@ -173,80 +152,63 @@
+         }
+ 
+         RETURN(result);
++
+ }
+ 
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+-                               int fhtype, int parent)
++#ifdef HAVE_FH_TO_DENTRY
++
++static struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                int fh_len, int fh_type)
+ {
+-        switch (fhtype) {
+-                case 2:
+-                        if (len < 5)
+-                                break;
+-                        if (parent)
+-                                return ll_iget_for_nfs(sb, data[3], 0, data[4]);
+-                case 1:
+-                        if (len < 3)
+-                                break;
+-                        if (parent)
+-                                break;
+-                        return ll_iget_for_nfs(sb, data[0], data[1], data[2]);
+-                default: break;
++        struct dentry *result;
++        
++        result = generic_fh_to_dentry(sb, fid, fh_len, fh_type,
++                                      ll_iget_for_nfs);
++        if(!IS_ERR(result)) {
++                ll_set_dd(result);
++                result->d_op = &ll_d_ops;
+         }
+-        return ERR_PTR(-EINVAL);
++        RETURN(result);
+ }
+ 
+-int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
+-                    int need_parent)
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++                int fh_len, int fh_type)
+ {
+-        if (*lenp < 3)
+-                return 255;
+-        *datap++ = dentry->d_inode->i_ino;
+-        *datap++ = dentry->d_inode->i_generation;
+-        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
+-
+-        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
+-                *lenp = 3;
+-                return 1;
+-        }
+-        if (dentry->d_parent) {
+-                *datap++ = dentry->d_parent->d_inode->i_ino;
+-                *datap++ = (__u32)(S_IFMT & dentry->d_parent->d_inode->i_mode);
++        struct dentry *result;
+ 
+-                *lenp = 5;
+-                return 2;
++        result = generic_fh_to_parent(sb, fid, fh_len, fh_type,
++                                      ll_iget_for_nfs);
++        if(!IS_ERR(result)) {
++                ll_set_dd(result);
++                result->d_op = &ll_d_ops;
+         }
+-        *lenp = 3;
+-        return 1;
++        RETURN(result);
+ }
+-
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+-struct dentry *ll_get_dentry(struct super_block *sb, void *data)
++#else
++static struct dentry *ll_get_dentry(struct super_block *sb, void *data)
+ {
+-        __u32 *inump = (__u32*)data;
+-        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++        return ll_nfs_get_dentry(sb, data);
+ }
+ 
+-struct dentry *ll_get_parent(struct dentry *dchild)
++#endif
++
++static struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+         struct ptlrpc_request *req = NULL;
+         struct inode *dir = dchild->d_inode;
+-        struct ll_sb_info *sbi;
+         struct dentry *result = NULL;
+         struct ll_fid fid;
+         struct mds_body *body;
+         char dotdot[] = "..";
++        __u32 idata[2];
+         int  rc = 0;
+         ENTRY;
+         
+         LASSERT(dir && S_ISDIR(dir->i_mode));
+-        
+-        sbi = ll_s2sbi(dir->i_sb);       
+  
+         fid.id = (__u64)dir->i_ino;
+         fid.generation = dir->i_generation;
+-        fid.f_type = S_IFDIR;
+-
+-        rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, dotdot, strlen(dotdot) + 1,
++        rc = mdc_getattr_name(ll_s2sbi(dir->i_sb)->ll_mdc_exp, &fid, dotdot, sizeof(dotdot),
+                               0, 0, &req);
+         if (rc) {
+                 CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
+@@ -256,8 +218,9 @@
+        
+         LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & OBD_MD_FLID));
+         
+-        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, S_IFDIR);
+-
++        idata[0] = body->ino;
++        idata[1] = body->generation;
++        result = ll_nfs_get_dentry(dir->i_sb, &idata);
+         if (IS_ERR(result))
+                 rc = PTR_ERR(result);
+ 
+@@ -268,7 +231,11 @@
+ } 
+ 
+ struct export_operations lustre_export_operations = {
+-       .get_parent = ll_get_parent,
+-       .get_dentry = ll_get_dentry, 
+-};
++#ifdef HAVE_FH_TO_DENTRY
++        .fh_to_dentry   = ll_fh_to_dentry,
++        .fh_to_parent   = ll_fh_to_parent,
++#else
++        .get_dentry = ll_get_dentry,
+ #endif
++        .get_parent = ll_get_parent,
++};
+diff -urNad trunk~/lustre/llite/lloop.c trunk/lustre/llite/lloop.c
+--- trunk~/lustre/llite/lloop.c	2007-11-21 13:11:10.000000000 +0100
++++ trunk/lustre/llite/lloop.c	2008-09-18 23:53:22.000000000 +0200
+@@ -108,6 +108,10 @@
+ 
+ #define LLOOP_MAX_SEGMENTS        PTLRPC_MAX_BRW_PAGES
+ 
++#ifndef HAVE_REQUEST_QUEUE_T
++typedef struct request_queue request_queue_t
++#endif
++
+ /* Possible states of device */
+ enum {
+         LLOOP_UNBOUND,
+@@ -299,7 +303,7 @@
+         if (atomic_dec_and_test(&lo->lo_pending))
+                 up(&lo->lo_bh_mutex);
+ out:
+-        bio_io_error(old_bio, old_bio->bi_size);
++        cfs_bio_io_error(old_bio, old_bio->bi_size);
+         return 0;
+ inactive:
+         spin_unlock_irq(&lo->lo_lock);
+@@ -321,7 +325,7 @@
+ {
+         int ret;
+         ret = do_bio_filebacked(lo, bio);
+-        bio_endio(bio, bio->bi_size, ret);
++        cfs_bio_endio(bio, bio->bi_size, ret);
+ }
+ 
+ /*
+diff -urNad trunk~/lustre/llite/namei.c trunk/lustre/llite/namei.c
+--- trunk~/lustre/llite/namei.c	2008-04-24 06:41:06.000000000 +0200
++++ trunk/lustre/llite/namei.c	2008-09-18 23:45:47.000000000 +0200
+@@ -879,7 +879,7 @@
+ 
+         err = mdc_create(sbi->ll_mdc_exp, &op_data, tgt, tgt_len,
+                          mode, current->fsuid, current->fsgid,
+-                         current->cap_effective, rdev, &request);
++                         cfs_curproc_cap_get(), rdev, &request);
+         if (err)
+                 GOTO(err_exit, err);
+ 
+diff -urNad trunk~/lustre/llite/rw.c trunk/lustre/llite/rw.c
+--- trunk~/lustre/llite/rw.c	2008-04-03 05:23:43.000000000 +0200
++++ trunk/lustre/llite/rw.c	2008-09-18 23:45:47.000000000 +0200
+@@ -161,7 +161,7 @@
+                 GOTO(out_unlock, 0);
+         }
+ 
+-        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
++//        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
+ 
+         if (!srvlock) {
+                 struct ost_lvb lvb;
+diff -urNad trunk~/lustre/llite/symlink.c trunk/lustre/llite/symlink.c
+--- trunk~/lustre/llite/symlink.c	2007-10-25 04:14:35.000000000 +0200
++++ trunk/lustre/llite/symlink.c	2008-09-18 23:45:47.000000000 +0200
+@@ -156,8 +156,12 @@
+         rc = ll_readlink_internal(inode, &request, &symname);
+         up(&lli->lli_size_sem);
+         if (rc) {
++#ifdef HAVE_PATH_RELEASE
+                 path_release(nd); /* Kernel assumes that ->follow_link()
+                                      releases nameidata on error */
++#else
++                path_put(&nd->path);
++#endif
+                 GOTO(out, rc);
+         }
+ 
+diff -urNad trunk~/lustre/lvfs/lvfs_linux.c trunk/lustre/lvfs/lvfs_linux.c
+--- trunk~/lustre/lvfs/lvfs_linux.c	2007-10-30 06:25:57.000000000 +0100
++++ trunk/lustre/lvfs/lvfs_linux.c	2008-09-18 23:45:47.000000000 +0200
+@@ -133,10 +133,10 @@
+         */
+ 
+         save->fs = get_fs();
+-        LASSERT(atomic_read(&current->fs->pwd->d_count));
++        LASSERT(atomic_read(&cfs_fs_pwd(current->fs)->d_count));
+         LASSERT(atomic_read(&new_ctx->pwd->d_count));
+-        save->pwd = dget(current->fs->pwd);
+-        save->pwdmnt = mntget(current->fs->pwdmnt);
++        save->pwd = dget(cfs_fs_pwd(current->fs));
++        save->pwdmnt = mntget(cfs_fs_mnt(current->fs));
+         save->luc.luc_umask = current->fs->umask;
+ 
+         LASSERT(save->pwd);
+@@ -147,11 +147,11 @@
+         if (uc) {
+                 save->luc.luc_fsuid = current->fsuid;
+                 save->luc.luc_fsgid = current->fsgid;
+-                save->luc.luc_cap = current->cap_effective;
++                save->luc.luc_cap = cfs_curproc_cap_get();
+ 
+                 current->fsuid = uc->luc_fsuid;
+                 current->fsgid = uc->luc_fsgid;
+-                current->cap_effective = uc->luc_cap;
++                cfs_curproc_cap_set(uc->luc_cap);
+                 push_group_info(save, uc->luc_uce);
+         }
+         current->fs->umask = 0; /* umask already applied on client */
+@@ -190,10 +190,10 @@
+                atomic_read(&current->fs->pwdmnt->mnt_count));
+         */
+ 
+-        LASSERTF(current->fs->pwd == new_ctx->pwd, "%p != %p\n",
+-                 current->fs->pwd, new_ctx->pwd);
+-        LASSERTF(current->fs->pwdmnt == new_ctx->pwdmnt, "%p != %p\n",
+-                 current->fs->pwdmnt, new_ctx->pwdmnt);
++        LASSERTF(cfs_fs_pwd(current->fs) == new_ctx->pwd, "%p != %p\n",
++                 cfs_fs_pwd(current->fs), new_ctx->pwd);
++        LASSERTF(cfs_fs_mnt(current->fs) == new_ctx->pwdmnt, "%p != %p\n",
++                 cfs_fs_mnt(current->fs), new_ctx->pwdmnt);
+ 
+         set_fs(saved->fs);
+         ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
+@@ -204,7 +204,7 @@
+         if (uc) {
+                 current->fsuid = saved->luc.luc_fsuid;
+                 current->fsgid = saved->luc.luc_fsgid;
+-                current->cap_effective = saved->luc.luc_cap;
++                cfs_curproc_cap_set(saved->luc.luc_cap);
+                 pop_group_info(saved, uc->luc_uce);
+         }
+ 
+diff -urNad trunk~/lustre/mdc/mdc_internal.h trunk/lustre/mdc/mdc_internal.h
+--- trunk~/lustre/mdc/mdc_internal.h	2008-01-17 14:00:30.000000000 +0100
++++ trunk/lustre/mdc/mdc_internal.h	2008-09-18 23:45:47.000000000 +0200
+@@ -28,7 +28,7 @@
+                       void *ea2, int ea2len);
+ void mdc_create_pack(struct ptlrpc_request *req, int offset,
+                      struct mdc_op_data *op_data, const void *data, int datalen,
+-                     __u32 mode, __u32 uid, __u32 gid, __u32 cap_effective,
++                     __u32 mode, __u32 uid, __u32 gid, cfs_kernel_cap_t cap_effective,
+                      __u64 rdev);
+ void mdc_open_pack(struct ptlrpc_request *req, int offset,
+                    struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
+diff -urNad trunk~/lustre/mdc/mdc_lib.c trunk/lustre/mdc/mdc_lib.c
+--- trunk~/lustre/mdc/mdc_lib.c	2008-03-26 07:22:04.000000000 +0100
++++ trunk/lustre/mdc/mdc_lib.c	2008-09-18 23:45:47.000000000 +0200
+@@ -46,7 +46,7 @@
+         b = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*b));
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         b->fid1 = *fid;
+         b->size = pg_off;                       /* !! */
+         b->suppgid = -1;
+@@ -59,7 +59,7 @@
+ 
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+ }
+ 
+ void mdc_pack_req_body(struct ptlrpc_request *req, int offset,
+@@ -78,7 +78,7 @@
+ /* packing of MDS records */
+ void mdc_create_pack(struct ptlrpc_request *req, int offset,
+                      struct mdc_op_data *op_data, const void *data, int datalen,
+-                     __u32 mode, __u32 uid, __u32 gid, __u32 cap_effective,
++                     __u32 mode, __u32 uid, __u32 gid, cfs_kernel_cap_t cap_effective,
+                      __u64 rdev)
+ {
+         struct mds_rec_create *rec;
+@@ -88,7 +88,7 @@
+         rec->cr_opcode = REINT_CREATE;
+         rec->cr_fsuid = uid;
+         rec->cr_fsgid = gid;
+-        rec->cr_cap = cap_effective;
++        rec->cr_cap = cfs_cap_convert_from_kernel(cap_effective);
+         rec->cr_fid = op_data->fid1;
+         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+         rec->cr_mode = mode;
+@@ -156,7 +156,7 @@
+         rec->cr_opcode = REINT_OPEN;
+         rec->cr_fsuid = current->fsuid;
+         rec->cr_fsgid = current->fsgid;
+-        rec->cr_cap = current->cap_effective;
++        rec->cr_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->cr_fid = op_data->fid1;
+         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+         rec->cr_mode = mode;
+@@ -230,7 +230,7 @@
+         rec->sa_opcode = REINT_SETATTR;
+         rec->sa_fsuid = current->fsuid;
+         rec->sa_fsgid = current->fsgid;
+-        rec->sa_cap = current->cap_effective;
++        rec->sa_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->sa_fid = data->fid1;
+         rec->sa_suppgid = -1;
+ 
+@@ -274,7 +274,7 @@
+         rec->ul_opcode = REINT_UNLINK;
+         rec->ul_fsuid = current->fsuid;
+         rec->ul_fsgid = current->fsgid;
+-        rec->ul_cap = current->cap_effective;
++        rec->ul_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->ul_mode = data->create_mode;
+         rec->ul_suppgid = data->suppgids[0];
+         rec->ul_fid1 = data->fid1;
+@@ -297,7 +297,7 @@
+         rec->lk_opcode = REINT_LINK;
+         rec->lk_fsuid = current->fsuid;
+         rec->lk_fsgid = current->fsgid;
+-        rec->lk_cap = current->cap_effective;
++        rec->lk_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->lk_suppgid1 = data->suppgids[0];
+         rec->lk_suppgid2 = data->suppgids[1];
+         rec->lk_fid1 = data->fid1;
+@@ -321,7 +321,7 @@
+         rec->rn_opcode = REINT_RENAME;
+         rec->rn_fsuid = current->fsuid;
+         rec->rn_fsgid = current->fsgid;
+-        rec->rn_cap = current->cap_effective;
++        rec->rn_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->rn_suppgid1 = data->suppgids[0];
+         rec->rn_suppgid2 = data->suppgids[1];
+         rec->rn_fid1 = data->fid1;
+@@ -345,7 +345,7 @@
+ 
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         b->valid = valid;
+         b->flags = flags | MDS_BFLAG_EXT_FLAGS;
+         /* skip MDS_BFLAG_EXT_FLAGS to verify the "client < 1.4.7" case 
+diff -urNad trunk~/lustre/mdc/mdc_reint.c trunk/lustre/mdc/mdc_reint.c
+--- trunk~/lustre/mdc/mdc_reint.c	2008-02-18 13:43:18.000000000 +0100
++++ trunk/lustre/mdc/mdc_reint.c	2008-09-18 23:45:47.000000000 +0200
+@@ -164,7 +164,7 @@
+ 
+ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
+                const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+-               __u32 cap_effective, __u64 rdev, struct ptlrpc_request **request)
++               cfs_kernel_cap_t cap_effective, __u64 rdev, struct ptlrpc_request **request)
+ {
+         CFS_LIST_HEAD(cancels);
+         struct obd_device *obd = exp->exp_obd;
+diff -urNad trunk~/lustre/mgc/mgc_request.c trunk/lustre/mgc/mgc_request.c
+--- trunk~/lustre/mgc/mgc_request.c	2008-04-24 13:54:15.000000000 +0200
++++ trunk/lustre/mgc/mgc_request.c	2008-09-18 23:45:47.000000000 +0200
+@@ -395,7 +395,7 @@
+         obd->obd_lvfs_ctxt.fs = get_ds();
+ 
+         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+-        dentry = lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd,
++        dentry = lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
+                                 strlen(MOUNT_CONFIGS_DIR));
+         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+         if (IS_ERR(dentry)) {
+diff -urNad trunk~/lustre/obdclass/linux/linux-module.c trunk/lustre/obdclass/linux/linux-module.c
+--- trunk~/lustre/obdclass/linux/linux-module.c	2007-11-13 21:43:24.000000000 +0100
++++ trunk/lustre/obdclass/linux/linux-module.c	2008-09-18 23:45:47.000000000 +0200
+@@ -386,7 +386,7 @@
+         ENTRY;
+ 
+         obd_sysctl_init();
+-        proc_lustre_root = proc_mkdir("lustre", proc_root_fs);
++        proc_lustre_root = proc_mkdir("fs/lustre", NULL);
+         if (!proc_lustre_root) {
+                 printk(KERN_ERR
+                        "LustreError: error registering /proc/fs/lustre\n");
+diff -urNad trunk~/lustre/obdclass/linux/linux-sysctl.c trunk/lustre/obdclass/linux/linux-sysctl.c
+--- trunk~/lustre/obdclass/linux/linux-sysctl.c	2008-03-25 13:25:41.000000000 +0100
++++ trunk/lustre/obdclass/linux/linux-sysctl.c	2008-09-18 23:45:47.000000000 +0200
+@@ -48,7 +48,9 @@
+ 
+ cfs_sysctl_table_header_t *obd_table_header = NULL;
+ 
+-#define OBD_SYSCTL 300
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_LUSTRE      300
+ 
+ enum {
+         OBD_FAIL_LOC = 1,       /* control test failures instrumentation */
+@@ -65,6 +67,22 @@
+         OBD_DEBUG_PEER_ON_TIMEOUT, /* dump peer debug when RPC times out */
+         OBD_ALLOC_FAIL_RATE,    /* memory allocation random failure rate */
+ };
++#else
++#define CTL_LUSTRE              CTL_UNNUMBERED
++#define OBD_FAIL_LOC            CTL_UNNUMBERED
++#define OBD_FAIL_VAL            CTL_UNNUMBERED
++#define OBD_TIMEOUT             CTL_UNNUMBERED
++#define OBD_DUMP_ON_TIMEOUT     CTL_UNNUMBERED
++#define OBD_MEMUSED             CTL_UNNUMBERED
++#define OBD_PAGESUSED           CTL_UNNUMBERED
++#define OBD_MAXMEMUSED          CTL_UNNUMBERED
++#define OBD_MAXPAGESUSED        CTL_UNNUMBERED
++#define OBD_SYNCFILTER          CTL_UNNUMBERED
++#define OBD_LDLM_TIMEOUT        CTL_UNNUMBERED
++#define OBD_DUMP_ON_EVICTION    CTL_UNNUMBERED
++#define OBD_DEBUG_PEER_ON_TIMEOUT CTL_UNNUMBERED
++#define OBD_ALLOC_FAIL_RATE     CTL_UNNUMBERED
++#endif
+ 
+ int LL_PROC_PROTO(proc_fail_loc)
+ {
+@@ -98,11 +116,12 @@
+                 return 0;
+         }
+         if (write) {
+-                rc = lprocfs_write_frac_helper(buffer, *lenp, 
++                rc = lprocfs_write_frac_helper(buffer, *lenp,
+                                                (unsigned int*)table->data,
+                                                OBD_ALLOC_FAIL_MULT);
+         } else {
+-                char buf[21];
++                char buf[22];
++		struct ctl_table dummy;
+                 int  len;
+ 
+                 len = lprocfs_read_frac_helper(buf, sizeof(buf),
+@@ -111,7 +130,13 @@
+                 if (len > *lenp)
+                         len = *lenp;
+                 buf[len] = '\0';
+-                if (copy_to_user(buffer, buf, len))
++
++                dummy = *table;
++                dummy.data = buf;
++                dummy.maxlen = sizeof(buf);
++
++                rc = ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
++                if (rc)
+                         return -EFAULT;
+                 *lenp = len;
+         }
+@@ -122,100 +147,117 @@
+ 
+ int LL_PROC_PROTO(proc_memory_alloc)
+ {
+-        char buf[22];
+         int len;
++        char buf[22];
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write) 
+-                return -EINVAL;
+-        
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_sum());
++
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_memory_sum());
++
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_pages_alloc)
+ {
+-        char buf[22];
+         int len;
++	char buf[22];
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_sum());
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_pages_sum());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_mem_max)
+ {
+-        char buf[22];
+         int len;
++        char buf[22];
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_max());
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_memory_max());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_pages_max)
+ {
+-        char buf[22];
+         int len;
++        char buf[22];
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_pages_max());
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_max());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
++
+ static cfs_sysctl_table_t obd_table[] = {
+         {
+                 .ctl_name = OBD_FAIL_LOC,
+@@ -231,7 +273,8 @@
+                 .data     = &obd_fail_val,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = OBD_TIMEOUT,
+@@ -247,7 +290,7 @@
+                 .data     = &obd_debug_peer_on_timeout,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_DUMP_ON_TIMEOUT,
+@@ -255,7 +298,7 @@
+                 .data     = &obd_dump_on_timeout,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_DUMP_ON_EVICTION,
+@@ -263,7 +306,7 @@
+                 .data     = &obd_dump_on_eviction,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_MEMUSED,
+@@ -271,7 +314,8 @@
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_memory_alloc
++                .proc_handler = &proc_memory_alloc,
++//                .strategy  = &sysctl_memory_alloc,
+         },
+         {
+                 .ctl_name = OBD_PAGESUSED,
+@@ -279,7 +323,8 @@
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_pages_alloc
++                .proc_handler = &proc_pages_alloc,
++//                .strategy  = &sysctl_pages_alloc,
+         },
+         {
+                 .ctl_name = OBD_MAXMEMUSED,
+@@ -287,7 +332,8 @@
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_mem_max
++                .proc_handler = &proc_mem_max,
++//                .strategy  = &sysctl_mem_max,
+         },
+         {
+                 .ctl_name = OBD_MAXPAGESUSED,
+@@ -295,7 +341,8 @@
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_pages_max
++                .proc_handler = &proc_pages_max,
++//                .strategy  = &sysctl_pages_max,
+         },
+         {
+                 .ctl_name = OBD_LDLM_TIMEOUT,
+@@ -319,15 +366,13 @@
+ };
+ 
+ static cfs_sysctl_table_t parent_table[] = {
+-       {
+-               .ctl_name = OBD_SYSCTL,
+-               .procname = "lustre",
+-               .data     = NULL,
+-               .maxlen   = 0,
+-               .mode     = 0555,
+-               .child    = obd_table
+-       },
+-       {0}
++        {
++                .ctl_name = CTL_LUSTRE,
++                .procname = "lustre",
++                .mode     = 0555,
++                .child    = obd_table
++        },
++        { 0 }
+ };
+ 
+ void obd_sysctl_init (void)
+diff -urNad trunk~/lustre/obdclass/llog_obd.c trunk/lustre/obdclass/llog_obd.c
+--- trunk~/lustre/obdclass/llog_obd.c	2007-12-24 21:15:32.000000000 +0100
++++ trunk/lustre/obdclass/llog_obd.c	2008-09-18 23:45:47.000000000 +0200
+@@ -178,7 +178,7 @@
+                 struct lov_stripe_md *lsm, struct llog_cookie *logcookies,
+                 int numcookies)
+ {
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc;
+         ENTRY;
+ 
+@@ -188,10 +188,10 @@
+         }
+         
+         CTXT_CHECK_OP(ctxt, add, -EOPNOTSUPP);
+-        cap = current->cap_effective;             
++        cap = current->cap_effective;
+         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = CTXTP(ctxt, add)(ctxt, rec, lsm, logcookies, numcookies);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ EXPORT_SYMBOL(llog_add);
+diff -urNad trunk~/lustre/obdclass/lprocfs_status.c trunk/lustre/obdclass/lprocfs_status.c
+--- trunk~/lustre/obdclass/lprocfs_status.c	2008-05-20 04:03:20.000000000 +0200
++++ trunk/lustre/obdclass/lprocfs_status.c	2008-09-18 23:45:47.000000000 +0200
+@@ -117,6 +117,8 @@
+         proc->read_proc = read_proc;
+         proc->write_proc = write_proc;
+         proc->data = data;
++        proc->owner = THIS_MODULE;
++
+         return 0;
+ }
+ 
+@@ -136,7 +138,7 @@
+ 
+         LPROCFS_ENTRY();
+         OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10);
+-        if (!dp->deleted && dp->read_proc)
++        if (!LPROCFS_CHECK_DELETED(dp) && dp->read_proc)
+                 rc = dp->read_proc(page, &start, *ppos, PAGE_SIZE, 
+                         &eof, dp->data);
+         LPROCFS_EXIT();
+@@ -175,7 +177,7 @@
+         int rc = -EIO;
+ 
+         LPROCFS_ENTRY();
+-        if (!dp->deleted && dp->write_proc)
++        if (!LPROCFS_CHECK_DELETED(dp) && dp->write_proc)
+                 rc = dp->write_proc(f, buf, size, dp->data);
+         LPROCFS_EXIT();
+         return rc;
+diff -urNad trunk~/lustre/ptlrpc/service.c trunk/lustre/ptlrpc/service.c
+--- trunk~/lustre/ptlrpc/service.c	2008-05-13 07:10:50.000000000 +0200
++++ trunk/lustre/ptlrpc/service.c	2008-09-18 23:45:47.000000000 +0200
+@@ -1244,7 +1244,7 @@
+         cfs_daemonize(name);
+         exit_fs(cfs_current());
+         current->fs = fs;
+-        ll_set_fs_pwd(current->fs, init_task.fs->pwdmnt, init_task.fs->pwd);
++        ll_set_fs_pwd(current->fs, cfs_fs_mnt(init_task.fs), cfs_fs_pwd(init_task.fs));
+ }
+ 
+ static void
+diff -urNad trunk~/lustre/quota/quotacheck_test.c trunk/lustre/quota/quotacheck_test.c
+--- trunk~/lustre/quota/quotacheck_test.c	2008-01-03 07:31:16.000000000 +0100
++++ trunk/lustre/quota/quotacheck_test.c	2008-09-18 23:45:47.000000000 +0200
+@@ -70,7 +70,14 @@
+         if (ext3_test_bit(index, bitmap_bh->b_data)) {
+                 CERROR("i: %d, ino: %lu\n", index, ino);
+                 ll_sleep(1);
++#if HAVE_IGET_CALL
+                 inode = iget(sb, ino);
++#else
++                inode = iget_locked(sb, ino);
++                if (inode && (inode->i_state & I_NEW)) {
++                  unlock_new_inode(inode);
++                }
++#endif
+         }
+ 
+         return inode;

Propchange: trunk/debian/patches/patchless_support_2.6.26.dpatch
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-lustre-svn-commit mailing list