+++ /dev/null
-From c49bafa3842751b8955a962859f42d307673d75d Mon Sep 17 00:00:00 2001
-From: Dan Carpenter <error27@gmail.com>
-Date: Sat, 30 Jul 2011 12:58:41 -0400
-Subject: ext4: add missing kfree() on error return path in add_new_gdb()
-Git-commit: c49bafa3
-Patch-mainline: v3.1-rc1
-
-We added some more error handling in b40971426a "ext4: add error
-checking to calls to ext4_handle_dirty_metadata()". But we need to
-call kfree() as well to avoid a memory leak.
-
-Upstream-Signed-off-by: Dan Carpenter <error27@gmail.com>
-Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/resize.c | 1 +
- 1 files changed, 1 insertions(+), 0 deletions(-)
-
-diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
-index 6e3327d..71085df 100644
---- a/fs/ext4/resize.c
-+++ b/fs/ext4/resize.c
-@@ -517,6 +517,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
- return err;
-
- exit_inode:
-+ kfree(n_group_desc);
- /* ext4_handle_release_buffer(handle, iloc.bh); */
- brelse(iloc.bh);
- exit_dindj:
-
+++ /dev/null
-From dcf2d804ed6ffe5e942b909ed5e5b74628be6ee4 Mon Sep 17 00:00:00 2001
-From: Tao Ma <boyu.mt@taobao.com>
-Date: Thu, 6 Oct 2011 12:10:11 -0400
-Subject: ext4: Free resources in some error path in ext4_fill_super
-Git-commit: dcf2d804
-Patch-mainline: v3.2-rc1
-
-Some of the error path in ext4_fill_super don't release the
-resouces properly. So this patch just try to release them
-in the right way.
-
-Upstream-Signed-off-by: Tao Ma <boyu.mt@taobao.com>
-Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/super.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
-diff --git a/fs/ext4/super.c b/fs/ext4/super.c
-index 07f3de3..db2cd3f 100644
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -3785,22 +3785,19 @@ no_journal:
- if (err) {
- ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)",
- err);
-- goto failed_mount4;
-+ goto failed_mount5;
- }
-
- err = ext4_register_li_request(sb, first_not_zeroed);
- if (err)
-- goto failed_mount4;
-+ goto failed_mount6;
-
- sbi->s_kobj.kset = ext4_kset;
- init_completion(&sbi->s_kobj_unregister);
- err = kobject_init_and_add(&sbi->s_kobj, &ext4_ktype, NULL,
- "%s", sb->s_id);
-- if (err) {
-- ext4_mb_release(sb);
-- ext4_ext_release(sb);
-- goto failed_mount4;
-- };
-+ if (err)
-+ goto failed_mount7;
-
- EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
- ext4_orphan_cleanup(sb, es);
-@@ -3834,13 +3831,19 @@ cantfind_ext4:
- ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
- goto failed_mount;
-
-+failed_mount7:
-+ ext4_unregister_li_request(sb);
-+failed_mount6:
-+ ext4_ext_release(sb);
-+failed_mount5:
-+ ext4_mb_release(sb);
-+ ext4_release_system_zone(sb);
- failed_mount4:
- iput(root);
- sb->s_root = NULL;
- ext4_msg(sb, KERN_ERR, "mount failed");
- destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
- failed_mount_wq:
-- ext4_release_system_zone(sb);
- if (sbi->s_journal) {
- jbd2_journal_destroy(sbi->s_journal);
- sbi->s_journal = NULL;
-
+++ /dev/null
-This patch is no longer needed for Lustre. It is only included
-for testing and ease of using the same kernel with older Lustre
-versions. This testing functionality was replaced in Linux 3.0
-by the dm-flakey driver.
-
-This functionality is mainly used during testing, in order to
-simulate a server crash for ldiskfs by discarding all of the
-writes to the filesystem. For recovery testing we could simulate
-this by using a special loopback or DM device that also discards
-writes to the device.
-
-This functionality is also used by target "failback" in order
-to speed up service shutdown and takeover by the other node
-during controlled operation. However, it would also be possible
-to do this by simply allowing all of the in-flight requests to
-complete and then waiting for the service to stop. This will
-also be needed by the DMU-OSD, because discarding of writes on
-a DMU-based target is not safe as it could trigger a storage
-failure if the data is ever read from disk again and the
-checksum does not match that expected by the block pointer.
-
-Index: linux-3.0/block/blk-core.c
-===================================================================
---- linux-3.0.orig/block/blk-core.c 2013-01-25 11:25:32.000000000 -0500
-+++ linux-3.0/block/blk-core.c 2013-01-25 11:31:53.000000000 -0500
-@@ -1390,6 +1390,8 @@
-
- #endif /* CONFIG_FAIL_MAKE_REQUEST */
-
-+int dev_check_rdonly(struct block_device *bdev);
-+
- /*
- * Check whether this bio extends beyond the end of the device.
- */
-@@ -1491,6 +1493,12 @@
- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
- goto end_io;
-
-+ /* this is cfs's dev_rdonly check */
-+ if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
-+ err = 0;
-+ goto end_io;
-+ }
-+
- if (should_fail_request(bio))
- goto end_io;
-
-@@ -2796,6 +2804,99 @@
- }
- EXPORT_SYMBOL(blk_finish_plug);
-
-+/*
-+ * 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(devlock);
-+
-+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);
-+
- int __init blk_dev_init(void)
- {
- BUILD_BUG_ON(__REQ_NR_BITS > 8 *
-Index: linux-2.6.32-131.0.15.el6.x86_64/fs/block_dev.c
-===================================================================
---- linux-2.6.32-131.0.15.el6.x86_64.orig/fs/block_dev.c 2011-05-10 21:38:29.000000000 +0300
-+++ linux-2.6.32-131.0.15.el6.x86_64/fs/block_dev.c 2011-05-19 21:01:04.000000000 +0300
-@@ -1389,6 +1389,7 @@ static int __blkdev_put(struct block_dev
- if (bdev != bdev->bd_contains)
- victim = bdev->bd_contains;
- bdev->bd_contains = NULL;
-+ dev_clear_rdonly(bdev);
-
- put_disk(disk);
- module_put(owner);
-Index: linux-2.6.32-131.0.15.el6.x86_64/include/linux/fs.h
-===================================================================
---- linux-2.6.32-131.0.15.el6.x86_64.orig/include/linux/fs.h 2011-05-10 21:38:29.000000000 +0300
-+++ linux-2.6.32-131.0.15.el6.x86_64/include/linux/fs.h 2011-05-19 21:01:04.000000000 +0300
-@@ -2244,6 +2244,10 @@ struct bio;
- extern void submit_bio(int, struct bio *);
- extern int bdev_read_only(struct block_device *);
- #endif
-+#define HAVE_CLEAR_RDONLY_ON_PUT
-+extern void dev_set_rdonly(struct block_device *bdev);
-+extern int dev_check_rdonly(struct block_device *bdev);
-+extern 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);