Release bh_check in case of error.
patch added for following kernel
RHEL7.2 3.10.0-327.3.1.el7
SLES11SP3 3.0.101-0.47.55
SLES12 - since the code is fairly same across RHEL7 versions
adding the patch from RHEL7 to the SLES12 patch series.
Seagate-bug-id: MRP-2337
Signed-off-by: Jadhav Vikram <jadhav.vikram@seagate.com>
Change-Id: Ib3712abcc3e754077882f9302b6065e38e1f014c
Reviewed-on: http://review.whamcloud.com/17841
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
===================================================================
--- /dev/null
+++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,356 @@
+@@ -0,0 +1,357 @@
+#include <linux/fs.h>
+#include <linux/random.h>
+#include <linux/buffer_head.h>
+ mmp = (struct mmp_struct *)((*bh)->b_data);
+ if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
+ brelse(*bh);
++ *bh = NULL;
+ return -EINVAL;
+ }
+
===================================================================
--- /dev/null
+++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,356 @@
+@@ -0,0 +1,357 @@
+#include <linux/fs.h>
+#include <linux/random.h>
+#include <linux/buffer_head.h>
+ mmp = (struct mmp_struct *)((*bh)->b_data);
+ if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
+ brelse(*bh);
++ *bh = NULL;
+ return -EINVAL;
+ }
+
--- /dev/null
+--- linux-stage.orig/fs/ext4/mmp.c 2015-10-06 08:21:12.013939184 +0530
++++ linux-stage/fs/ext4/mmp.c 2015-10-06 08:20:35.242939292 +0530
+@@ -99,8 +99,11 @@ static int read_mmp_block(struct super_b
+
+ mmp = (struct mmp_struct *)((*bh)->b_data);
+ if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC ||
+- !ext4_mmp_csum_verify(sb, mmp))
++ !ext4_mmp_csum_verify(sb, mmp)) {
++ brelse(*bh);
++ *bh = NULL;
+ return -EINVAL;
++ }
+
+ return 0;
+ }
+@@ -219,6 +221,7 @@ static int kmmpd(void *data)
+ "The filesystem seems to have been"
+ " multiply mounted.");
+ ext4_error(sb, "abort");
++ put_bh(bh_check);
+ goto failed;
+ }
+ put_bh(bh_check);
--- /dev/null
+--- linux-stage.orig/fs/ext4/mmp.c 2015-11-01 15:42:38.069175571 +0530
++++ linux-stage/fs/ext4/mmp.c 2015-11-01 15:46:53.840174791 +0530
+@@ -59,8 +59,11 @@
+ }
+
+ mmp = (struct mmp_struct *)((*bh)->b_data);
+- if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC)
++ if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
++ brelse(*bh);
++ *bh = NULL;
+ return -EINVAL;
++ }
+
+ return 0;
+ }
+@@ -178,6 +180,7 @@
+ "The filesystem seems to have been"
+ " multiply mounted.");
+ ext4_error(sb, "abort");
++ put_bh(bh_check);
+ goto failed;
+ }
+ put_bh(bh_check);
sles11sp2/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
rhel6.3/ext4-notalloc_under_idatasem.patch
rhel6.5/ext4-give-warning-with-dir-htree-growing.patch
+sles11sp3/ext4-mmp-brelse.patch
rhel7/ext4-max-dir-size.patch
rhel7/ext4-remove-truncate-warning.patch
rhel7/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
+rhel7/ext4-mmp-brelse.patch
rhel7/ext4-remove-truncate-warning.patch
rhel7/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
rhel7/ext4-give-warning-with-dir-htree-growing.patch
+rhel7/ext4-mmp-brelse.patch
rhel7/ext4-max-dir-size.patch
rhel7/ext4-remove-truncate-warning.patch
sles12/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
+rhel7/ext4-mmp-brelse.patch