Lustre package maintainers,

The attached patch allows building the kernel for the server side, but I
don't have an accompanying patch for building the modules.

I know 1.6.4.3-1 is in testing, but perhaps this patch will still be
useful as a start.

Cheers, -Brian

-- 
Brian Elliott Finley
Linux Strategist
Argonne National Lab, CIS
Office: 630.252.4742
Mobile: 630.631.6621
diff -urN kernel-patches.orig/lustre/patches/dev_read_only-2.6.24-vanilla.patch kernel-patches/lustre/patches/dev_read_only-2.6.24-vanilla.patch
--- kernel-patches.orig/lustre/patches/dev_read_only-2.6.24-vanilla.patch	1969-12-31 18:00:00.000000000 -0600
+++ kernel-patches/lustre/patches/dev_read_only-2.6.24-vanilla.patch	2008-03-29 14:18:23.000000000 -0500
@@ -0,0 +1,150 @@
+Index: linux-source-2.6.24/block/ll_rw_blk.c
+===================================================================
+--- linux-source-2.6.24.orig/block/ll_rw_blk.c	2008-02-10 23:51:11.000000000 -0600
++++ linux-source-2.6.24/block/ll_rw_blk.c	2008-03-29 14:07:49.000000000 -0500
+@@ -3184,6 +3184,8 @@
+ 	return 0;
+ }
+ 
++int dev_check_rdonly(struct block_device *bdev);
++
+ /**
+  * generic_make_request: hand a buffer to its device driver for I/O
+  * @bio:  The bio describing the location in memory and on the device.
+@@ -3256,6 +3258,17 @@
+ 
+ 		if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
+ 			goto end_io;
++		/* this is cfs's dev_rdonly check */
++		if (bio->bi_rw == WRITE &&
++				dev_check_rdonly(bio->bi_bdev)) {
++			/* 
++			 * Using too many arguments.  I think we want bio->bi_size
++			 * as second argument. -BEF-
++			 *    Orig:  bio_endio(bio, bio->bi_size, 0);
++			 */
++			bio_endio(bio, bio->bi_size);
++			break;
++		}
+ 
+ 		if (should_fail_request(bio))
+ 			goto end_io;
+@@ -3955,6 +3968,91 @@
+ 	*ioc2 = temp;
+ }
+ EXPORT_SYMBOL(swap_io_context);
++ /*
++ * Debug code for turning block devices "read-only" (will discard writes
++ * silently).  This is for filesystem crash/recovery testing.
++ */
++struct deventry {
++	dev_t dev;
++	struct deventry *next;
++};
++
++static struct deventry *devlist = NULL;
++static spinlock_t devlock = SPIN_LOCK_UNLOCKED; 
++
++int dev_check_rdonly(struct block_device *bdev) 
++{
++	struct deventry *cur;
++	if (!bdev) return 0;
++	spin_lock(&devlock);
++	cur = devlist;
++	while(cur) {
++		if (bdev->bd_dev == cur->dev) {
++			spin_unlock(&devlock);
++			return 1;
++	}
++		cur = cur->next;
++	}
++	spin_unlock(&devlock);
++	return 0;
++}
++
++void dev_set_rdonly(struct block_device *bdev)
++{
++	struct deventry *newdev, *cur;
++
++	if (!bdev) 
++		return;
++	newdev = kmalloc(sizeof(struct deventry), GFP_KERNEL);
++	if (!newdev) 
++		return;
++	
++	spin_lock(&devlock);
++	cur = devlist;
++	while(cur) {
++		if (bdev->bd_dev == cur->dev) {
++			spin_unlock(&devlock);
++			kfree(newdev);
++			return;
++		}
++		cur = cur->next;
++	}
++	newdev->dev = bdev->bd_dev;
++	newdev->next = devlist;
++	devlist = newdev;
++	spin_unlock(&devlock);
++	printk(KERN_WARNING "Turning device %s (%#x) read-only\n",
++	       bdev->bd_disk ? bdev->bd_disk->disk_name : "", bdev->bd_dev);
++}
++
++void dev_clear_rdonly(struct block_device *bdev) 
++{
++	struct deventry *cur, *last = NULL;
++	if (!bdev) return;
++	spin_lock(&devlock);
++	cur = devlist;
++	while(cur) {
++		if (bdev->bd_dev == cur->dev) {
++			if (last) 
++				last->next = cur->next;
++			else
++				devlist = cur->next;
++			spin_unlock(&devlock);
++			kfree(cur);
++			printk(KERN_WARNING "Removing read-only on %s (%#x)\n",
++			       bdev->bd_disk ? bdev->bd_disk->disk_name :
++					       "unknown block", bdev->bd_dev);
++			return;
++		}
++		last = cur;
++		cur = cur->next;
++	}
++	spin_unlock(&devlock);
++}
++
++EXPORT_SYMBOL(dev_set_rdonly);
++EXPORT_SYMBOL(dev_clear_rdonly);
++EXPORT_SYMBOL(dev_check_rdonly);
+ 
+ /*
+  * sysfs parts below
+Index: linux-2.6.20.3/fs/block_dev.c
+===================================================================
+--- linux-2.6.20.3.orig/fs/block_dev.c	2007-03-13 19:27:08.000000000 +0100
++++ linux-2.6.20.3/fs/block_dev.c	2007-08-14 18:43:14.000000000 +0200
+@@ -60,6 +60,7 @@
+ {
+ 	invalidate_bdev(bdev, 1);
+ 	truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
++	dev_clear_rdonly(bdev);
+ }	
+ 
+ int set_blocksize(struct block_device *bdev, int size)
+Index: linux-2.6.20.3/include/linux/fs.h
+===================================================================
+--- linux-2.6.20.3.orig/include/linux/fs.h	2007-08-14 18:38:38.000000000 +0200
++++ linux-2.6.20.3/include/linux/fs.h	2007-08-14 18:51:18.000000000 +0200
+@@ -1698,6 +1698,10 @@
+ extern void submit_bio(int, struct bio *);
+ extern int bdev_read_only(struct block_device *);
+ #endif
++#define HAVE_CLEAR_RDONLY_ON_PUT
++void dev_set_rdonly(struct block_device *bdev);
++int dev_check_rdonly(struct block_device *bdev);
++void dev_clear_rdonly(struct block_device *bdev);
+ extern int set_blocksize(struct block_device *, int);
+ extern int sb_set_blocksize(struct super_block *, int);
+ extern int sb_min_blocksize(struct super_block *, int);
diff -urN kernel-patches.orig/lustre/series/2.6.24-vanilla.series kernel-patches/lustre/series/2.6.24-vanilla.series
--- kernel-patches.orig/lustre/series/2.6.24-vanilla.series	1969-12-31 18:00:00.000000000 -0600
+++ kernel-patches/lustre/series/2.6.24-vanilla.series	2008-03-29 13:23:36.000000000 -0500
@@ -0,0 +1,12 @@
+lustre_version.patch
+vfs_races-2.6.20-vanilla.patch
+i_filter_data.patch
+jbd-jcberr-2.6.18-vanilla.patch
+iopen-misc-2.6.20-vanilla.patch
+export-truncate-2.6.18-vanilla.patch
+export_symbols-2.6.20-vanilla.patch
+dev_read_only-2.6.24-vanilla.patch
+export-2.6.18-vanilla.patch
+export-show_task-2.6.18-vanilla.patch
+sd_iostats-2.6.22.patch
+LDISKFS_SUPER_MAGIC-2.6.20.patch
_______________________________________________
Pkg-lustre-maintainers mailing list
Pkg-lustre-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-lustre-maintainers

Reply via email to