X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fkernel_patches%2Fpatches%2Fdev_read_only-2.6-lnxi.patch;h=ba8472e957343d4cefb7cfd2776bae75da8e24a2;hb=e2ad25be95e01aa6532275e3df5b1a3390d411c3;hp=75062eacd1d51c803d1ec633df0868303835c210;hpb=fdfefb0534a6eb4f9eebcfbebabefef0f0af5117;p=fs%2Flustre-release.git diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch b/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch index 75062ea..ba8472e 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch @@ -1,5 +1,5 @@ ---- linux-2.6.5.orig/drivers/block/ll_rw_blk.c 2005-03-16 10:09:28.000000000 -0800 -+++ linux-2.6.5/drivers/block/ll_rw_blk.c 2005-03-16 10:57:38.197357003 -0800 +--- linux-2.6.5-suse.orig/drivers/block/ll_rw_blk.c 2004-11-11 07:28:51.000000000 -0800 ++++ linux-2.6.5/drivers/block/ll_rw_blk.c 2005-03-16 10:57:38.000000000 -0800 @@ -2458,7 +2458,7 @@ static inline void blk_partition_remap(s } } @@ -9,19 +9,15 @@ /** * generic_make_request: hand a buffer to its device driver for I/O -@@ -2550,9 +2550,9 @@ end_io: +@@ -2550,7 +2550,7 @@ end_io: /* this is cfs's dev_rdonly check */ if (bio->bi_rw == WRITE && - dev_check_rdonly(bio->bi_bdev->bd_dev)) { -- bio_endio(bio, bio->bi_size, 0); -- break; + dev_check_rdonly(bio->bi_bdev)) { -+ bio_endio(bio, bio->bi_size, 0); -+ break; + bio_endio(bio, bio->bi_size, 0); + break; } - - /* @@ -3086,53 +3086,85 @@ void swap_io_context(struct io_context * *ioc2 = temp; } @@ -35,51 +31,20 @@ * silently). This is for filesystem crash/recovery testing. */ -void dev_set_rdonly(struct block_device *bdev, int no_write) --{ -- if (no_write >= MAX_RDONLY_DEVS) { -- printk(KERN_ALERT "%s:%d illegal arg %d (max %d)\n", -- __FILE__, __LINE__, no_write, MAX_RDONLY_DEVS); -- return; -- } -- -- if (bdev) { -- printk(KERN_WARNING "Turning device %s read-only at %d\n", -- bdev->bd_disk ? bdev->bd_disk->disk_name : "?", -- no_write); -- rdonly_devs[no_write] = bdev->bd_dev; -- } --} +struct deventry { + dev_t dev; + struct deventry *next; +}; - --void dev_clear_rdonly(int no_write) --{ -- if (no_write >= MAX_RDONLY_DEVS) { -- printk(KERN_ALERT "%s:%d illegal arg %d (max %d)\n", -- __FILE__, __LINE__, no_write, MAX_RDONLY_DEVS); -- return; -- } ++ +static struct deventry *devlist = NULL; +static spinlock_t devlock = SPIN_LOCK_UNLOCKED; - -- if (rdonly_devs[no_write] == 0) -- return; -- -- printk(KERN_WARNING "Clearing read-only at %d\n", no_write); -- rdonly_devs[no_write] = 0; --} -- --int dev_check_rdonly(dev_t dev) ++ +int dev_check_rdonly(struct block_device *bdev) { -- int i; -- -- for (i = 0; i < MAX_RDONLY_DEVS; i++) -- if (rdonly_devs[i] == dev) -- return 1; -- return 0; +- if (no_write >= MAX_RDONLY_DEVS) { +- printk(KERN_ALERT "%s:%d illegal arg %d (max %d)\n", +- __FILE__, __LINE__, no_write, MAX_RDONLY_DEVS); +- return; + struct deventry *cur; + if (!bdev) return 0; + spin_lock(&devlock); @@ -88,23 +53,38 @@ + if (bdev->bd_dev == cur->dev) { + spin_unlock(&devlock); + return 1; -+ } + } +- +- if (bdev) { +- printk(KERN_WARNING "Turning device %s read-only at %d\n", +- bdev->bd_disk ? bdev->bd_disk->disk_name : "?", +- no_write); +- rdonly_devs[no_write] = bdev->bd_dev; + cur = cur->next; -+ } + } + spin_unlock(&devlock); + return 0; -+} -+ + } + +-void dev_clear_rdonly(int no_write) +void dev_set_rdonly(struct block_device *bdev) -+{ + { +- if (no_write >= MAX_RDONLY_DEVS) { +- printk(KERN_ALERT "%s:%d illegal arg %d (max %d)\n", +- __FILE__, __LINE__, no_write, MAX_RDONLY_DEVS); +- return; +- } + struct deventry *newdev, *cur; -+ + +- if (rdonly_devs[no_write] == 0) + if (!bdev) + return; + newdev = kmalloc(sizeof(struct deventry), GFP_KERNEL); + if (!newdev) -+ return; -+ + return; + +- printk(KERN_WARNING "Clearing read-only at %d\n", no_write); +- rdonly_devs[no_write] = 0; + spin_lock(&devlock); + cur = devlist; + while(cur) { @@ -112,7 +92,16 @@ + spin_unlock(&devlock); + kfree(newdev); + return; -+ } + } +- +-int dev_check_rdonly(dev_t dev) +-{ +- int i; +- +- for (i = 0; i < MAX_RDONLY_DEVS; i++) +- if (rdonly_devs[i] == dev) +- return 1; +- return 0; + cur = cur->next; + } + newdev->dev = bdev->bd_dev; @@ -148,3 +137,26 @@ } EXPORT_SYMBOL(dev_set_rdonly); +--- linux-2.6.5-suse.orig/include/linux/fs.h 2004-11-11 07:28:45.000000000 -0800 ++++ linux-2.6.5/include/linux/fs.h 2005-04-07 18:12:42.772181591 -0700 +@@ -1385,6 +1385,10 @@ extern void file_kill(struct file *f); + struct bio; + extern int submit_bio(int, struct bio *); + extern int bdev_read_only(struct block_device *); ++#define HAVE_CLEAR_RDONLY_ON_PUT ++void dev_set_rdonly(kdev_t dev); ++int dev_check_rdonly(kdev_t dev); ++void dev_clear_rdonly(kdev_t dev); + 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); +--- linux-2.6.5-suse.orig/fs/block_dev.c 2004-11-11 07:28:30.000000000 -0800 ++++ linux-2.6.5/fs/block_dev.c 2005-04-07 18:14:27.948304347 -0700 +@@ -739,6 +739,7 @@ int blkdev_put(struct block_device *bdev + } + unlock_kernel(); + up(&bdev->bd_sem); ++ dev_clear_rdonly(to_kdev_t(bdev->bd_dev)); + bdput(bdev); + return ret; + }