All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	TR Reardon <thomas_reardon@hotmail.com>,
	Theodore Tso <tytso@mit.edu>
Subject: [PATCH 3.16 101/125] jbd2: fix descriptor block size handling errors with journal_csum
Date: Wed,  3 Sep 2014 15:07:38 -0700	[thread overview]
Message-ID: <20140903220626.730386519@linuxfoundation.org> (raw)
In-Reply-To: <20140903220623.649748296@linuxfoundation.org>

3.16-stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Darrick J. Wong" <darrick.wong@oracle.com>

commit db9ee220361de03ee86388f9ea5e529eaad5323c upstream.

It turns out that there are some serious problems with the on-disk
format of journal checksum v2.  The foremost is that the function to
calculate descriptor tag size returns sizes that are too big.  This
causes alignment issues on some architectures and is compounded by the
fact that some parts of jbd2 use the structure size (incorrectly) to
determine the presence of a 64bit journal instead of checking the
feature flags.

Therefore, introduce journal checksum v3, which enlarges the
descriptor block tag format to allow for full 32-bit checksums of
journal blocks, fix the journal tag function to return the correct
sizes, and fix the jbd2 recovery code to use feature flags to
determine 64bitness.

Add a few function helpers so we don't have to open-code quite so
many pieces.

Switching to a 16-byte block size was found to increase journal size
overhead by a maximum of 0.1%, to convert a 32-bit journal with no
checksumming to a 32-bit journal with checksum v3 enabled.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/super.c      |    5 ++--
 fs/jbd2/commit.c     |   21 ++++++++++---------
 fs/jbd2/journal.c    |   56 +++++++++++++++++++++++++++++++++------------------
 fs/jbd2/recovery.c   |   26 +++++++++++++----------
 fs/jbd2/revoke.c     |    6 ++---
 include/linux/jbd2.h |   30 ++++++++++++++++++++++-----
 6 files changed, 95 insertions(+), 49 deletions(-)

--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3185,9 +3185,9 @@ static int set_journal_csum_feature_set(
 
 	if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
 				       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
-		/* journal checksum v2 */
+		/* journal checksum v3 */
 		compat = 0;
-		incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2;
+		incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3;
 	} else {
 		/* journal checksum v1 */
 		compat = JBD2_FEATURE_COMPAT_CHECKSUM;
@@ -3209,6 +3209,7 @@ static int set_journal_csum_feature_set(
 		jbd2_journal_clear_features(sbi->s_journal,
 				JBD2_FEATURE_COMPAT_CHECKSUM, 0,
 				JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT |
+				JBD2_FEATURE_INCOMPAT_CSUM_V3 |
 				JBD2_FEATURE_INCOMPAT_CSUM_V2);
 	}
 
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -97,7 +97,7 @@ static void jbd2_commit_block_csum_set(j
 	struct commit_header *h;
 	__u32 csum;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	h = (struct commit_header *)(bh->b_data);
@@ -313,11 +313,11 @@ static __u32 jbd2_checksum_data(__u32 cr
 	return checksum;
 }
 
-static void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
+static void write_tag_block(journal_t *j, journal_block_tag_t *tag,
 				   unsigned long long block)
 {
 	tag->t_blocknr = cpu_to_be32(block & (u32)~0);
-	if (tag_bytes > JBD2_TAG_SIZE32)
+	if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_64BIT))
 		tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1);
 }
 
@@ -327,7 +327,7 @@ static void jbd2_descr_block_csum_set(jo
 	struct jbd2_journal_block_tail *tail;
 	__u32 csum;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
@@ -340,12 +340,13 @@ static void jbd2_descr_block_csum_set(jo
 static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
 				    struct buffer_head *bh, __u32 sequence)
 {
+	journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
 	struct page *page = bh->b_page;
 	__u8 *addr;
 	__u32 csum32;
 	__be32 seq;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	seq = cpu_to_be32(sequence);
@@ -355,8 +356,10 @@ static void jbd2_block_tag_csum_set(jour
 			     bh->b_size);
 	kunmap_atomic(addr);
 
-	/* We only have space to store the lower 16 bits of the crc32c. */
-	tag->t_checksum = cpu_to_be16(csum32);
+	if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3))
+		tag3->t_checksum = cpu_to_be32(csum32);
+	else
+		tag->t_checksum = cpu_to_be16(csum32);
 }
 /*
  * jbd2_journal_commit_transaction
@@ -396,7 +399,7 @@ void jbd2_journal_commit_transaction(jou
 	LIST_HEAD(io_bufs);
 	LIST_HEAD(log_bufs);
 
-	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (jbd2_journal_has_csum_v2or3(journal))
 		csum_size = sizeof(struct jbd2_journal_block_tail);
 
 	/*
@@ -690,7 +693,7 @@ void jbd2_journal_commit_transaction(jou
 			tag_flag |= JBD2_FLAG_SAME_UUID;
 
 		tag = (journal_block_tag_t *) tagp;
-		write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr);
+		write_tag_block(journal, tag, jh2bh(jh)->b_blocknr);
 		tag->t_flags = cpu_to_be16(tag_flag);
 		jbd2_block_tag_csum_set(journal, tag, wbuf[bufs],
 					commit_transaction->t_tid);
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(__jbd2_debug);
 /* Checksumming functions */
 static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb)
 {
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	return sb->s_checksum_type == JBD2_CRC32C_CHKSUM;
@@ -145,7 +145,7 @@ static __be32 jbd2_superblock_csum(journ
 
 static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb)
 {
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	return sb->s_checksum == jbd2_superblock_csum(j, sb);
@@ -153,7 +153,7 @@ static int jbd2_superblock_csum_verify(j
 
 static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb)
 {
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	sb->s_checksum = jbd2_superblock_csum(j, sb);
@@ -1522,21 +1522,29 @@ static int journal_get_superblock(journa
 		goto out;
 	}
 
-	if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) &&
-	    JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
+	if (jbd2_journal_has_csum_v2or3(journal) &&
+	    JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) {
 		/* Can't have checksum v1 and v2 on at the same time! */
 		printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 "
 		       "at the same time!\n");
 		goto out;
 	}
 
+	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) &&
+	    JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
+		/* Can't have checksum v2 and v3 at the same time! */
+		printk(KERN_ERR "JBD2: Can't enable checksumming v2 and v3 "
+		       "at the same time!\n");
+		goto out;
+	}
+
 	if (!jbd2_verify_csum_type(journal, sb)) {
 		printk(KERN_ERR "JBD2: Unknown checksum type\n");
 		goto out;
 	}
 
 	/* Load the checksum driver */
-	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
+	if (jbd2_journal_has_csum_v2or3(journal)) {
 		journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
 		if (IS_ERR(journal->j_chksum_driver)) {
 			printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
@@ -1553,7 +1561,7 @@ static int journal_get_superblock(journa
 	}
 
 	/* Precompute checksum seed for all metadata */
-	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (jbd2_journal_has_csum_v2or3(journal))
 		journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid,
 						   sizeof(sb->s_uuid));
 
@@ -1813,8 +1821,14 @@ int jbd2_journal_set_features (journal_t
 	if (!jbd2_journal_check_available_features(journal, compat, ro, incompat))
 		return 0;
 
-	/* Asking for checksumming v2 and v1?  Only give them v2. */
-	if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2 &&
+	/* If enabling v2 checksums, turn on v3 instead */
+	if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2) {
+		incompat &= ~JBD2_FEATURE_INCOMPAT_CSUM_V2;
+		incompat |= JBD2_FEATURE_INCOMPAT_CSUM_V3;
+	}
+
+	/* Asking for checksumming v3 and v1?  Only give them v3. */
+	if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V3 &&
 	    compat & JBD2_FEATURE_COMPAT_CHECKSUM)
 		compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM;
 
@@ -1823,8 +1837,8 @@ int jbd2_journal_set_features (journal_t
 
 	sb = journal->j_superblock;
 
-	/* If enabling v2 checksums, update superblock */
-	if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
+	/* If enabling v3 checksums, update superblock */
+	if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
 		sb->s_checksum_type = JBD2_CRC32C_CHKSUM;
 		sb->s_feature_compat &=
 			~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM);
@@ -1842,8 +1856,7 @@ int jbd2_journal_set_features (journal_t
 		}
 
 		/* Precompute checksum seed for all metadata */
-		if (JBD2_HAS_INCOMPAT_FEATURE(journal,
-					      JBD2_FEATURE_INCOMPAT_CSUM_V2))
+		if (jbd2_journal_has_csum_v2or3(journal))
 			journal->j_csum_seed = jbd2_chksum(journal, ~0,
 							   sb->s_uuid,
 							   sizeof(sb->s_uuid));
@@ -1852,7 +1865,8 @@ int jbd2_journal_set_features (journal_t
 	/* If enabling v1 checksums, downgrade superblock */
 	if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM))
 		sb->s_feature_incompat &=
-			~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2);
+			~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2 |
+				     JBD2_FEATURE_INCOMPAT_CSUM_V3);
 
 	sb->s_feature_compat    |= cpu_to_be32(compat);
 	sb->s_feature_ro_compat |= cpu_to_be32(ro);
@@ -2165,16 +2179,20 @@ int jbd2_journal_blocks_per_page(struct
  */
 size_t journal_tag_bytes(journal_t *journal)
 {
-	journal_block_tag_t tag;
-	size_t x = 0;
+	size_t sz;
+
+	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
+		return sizeof(journal_block_tag3_t);
+
+	sz = sizeof(journal_block_tag_t);
 
 	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
-		x += sizeof(tag.t_checksum);
+		sz += sizeof(__u16);
 
 	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
-		return x + JBD2_TAG_SIZE64;
+		return sz;
 	else
-		return x + JBD2_TAG_SIZE32;
+		return sz - sizeof(__u32);
 }
 
 /*
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -181,7 +181,7 @@ static int jbd2_descr_block_csum_verify(
 	__be32 provided;
 	__u32 calculated;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize -
@@ -205,7 +205,7 @@ static int count_tags(journal_t *journal
 	int			nr = 0, size = journal->j_blocksize;
 	int			tag_bytes = journal_tag_bytes(journal);
 
-	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (jbd2_journal_has_csum_v2or3(journal))
 		size -= sizeof(struct jbd2_journal_block_tail);
 
 	tagp = &bh->b_data[sizeof(journal_header_t)];
@@ -338,10 +338,11 @@ int jbd2_journal_skip_recovery(journal_t
 	return err;
 }
 
-static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag)
+static inline unsigned long long read_tag_block(journal_t *journal,
+						journal_block_tag_t *tag)
 {
 	unsigned long long block = be32_to_cpu(tag->t_blocknr);
-	if (tag_bytes > JBD2_TAG_SIZE32)
+	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
 		block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32;
 	return block;
 }
@@ -384,7 +385,7 @@ static int jbd2_commit_block_csum_verify
 	__be32 provided;
 	__u32 calculated;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	h = buf;
@@ -399,17 +400,21 @@ static int jbd2_commit_block_csum_verify
 static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
 				      void *buf, __u32 sequence)
 {
+	journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
 	__u32 csum32;
 	__be32 seq;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	seq = cpu_to_be32(sequence);
 	csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
 	csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);
 
-	return tag->t_checksum == cpu_to_be16(csum32);
+	if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3))
+		return tag3->t_checksum == cpu_to_be32(csum32);
+	else
+		return tag->t_checksum == cpu_to_be16(csum32);
 }
 
 static int do_one_pass(journal_t *journal,
@@ -513,8 +518,7 @@ static int do_one_pass(journal_t *journa
 		switch(blocktype) {
 		case JBD2_DESCRIPTOR_BLOCK:
 			/* Verify checksum first */
-			if (JBD2_HAS_INCOMPAT_FEATURE(journal,
-					JBD2_FEATURE_INCOMPAT_CSUM_V2))
+			if (jbd2_journal_has_csum_v2or3(journal))
 				descr_csum_size =
 					sizeof(struct jbd2_journal_block_tail);
 			if (descr_csum_size > 0 &&
@@ -575,7 +579,7 @@ static int do_one_pass(journal_t *journa
 					unsigned long long blocknr;
 
 					J_ASSERT(obh != NULL);
-					blocknr = read_tag_block(tag_bytes,
+					blocknr = read_tag_block(journal,
 								 tag);
 
 					/* If the block has been
@@ -814,7 +818,7 @@ static int jbd2_revoke_block_csum_verify
 	__be32 provided;
 	__u32 calculated;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize -
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -91,8 +91,8 @@
 #include <linux/list.h>
 #include <linux/init.h>
 #include <linux/bio.h>
-#endif
 #include <linux/log2.h>
+#endif
 
 static struct kmem_cache *jbd2_revoke_record_cache;
 static struct kmem_cache *jbd2_revoke_table_cache;
@@ -597,7 +597,7 @@ static void write_one_revoke_record(jour
 	offset = *offsetp;
 
 	/* Do we need to leave space at the end for a checksum? */
-	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (jbd2_journal_has_csum_v2or3(journal))
 		csum_size = sizeof(struct jbd2_journal_revoke_tail);
 
 	/* Make sure we have a descriptor with space left for the record */
@@ -644,7 +644,7 @@ static void jbd2_revoke_csum_set(journal
 	struct jbd2_journal_revoke_tail *tail;
 	__u32 csum;
 
-	if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize -
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -159,7 +159,11 @@ typedef struct journal_header_s
  * journal_block_tag (in the descriptor).  The other h_chksum* fields are
  * not used.
  *
- * Checksum v1 and v2 are mutually exclusive features.
+ * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses
+ * journal_block_tag3_t to store a full 32-bit checksum.  Everything else
+ * is the same as v2.
+ *
+ * Checksum v1, v2, and v3 are mutually exclusive features.
  */
 struct commit_header {
 	__be32		h_magic;
@@ -179,6 +183,14 @@ struct commit_header {
  * raw struct shouldn't be used for pointer math or sizeof() - use
  * journal_tag_bytes(journal) instead to compute this.
  */
+typedef struct journal_block_tag3_s
+{
+	__be32		t_blocknr;	/* The on-disk block number */
+	__be32		t_flags;	/* See below */
+	__be32		t_blocknr_high; /* most-significant high 32bits. */
+	__be32		t_checksum;	/* crc32c(uuid+seq+block) */
+} journal_block_tag3_t;
+
 typedef struct journal_block_tag_s
 {
 	__be32		t_blocknr;	/* The on-disk block number */
@@ -187,9 +199,6 @@ typedef struct journal_block_tag_s
 	__be32		t_blocknr_high; /* most-significant high 32bits. */
 } journal_block_tag_t;
 
-#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
-#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
-
 /* Tail of descriptor block, for checksumming */
 struct jbd2_journal_block_tail {
 	__be32		t_checksum;	/* crc32c(uuid+descr_block) */
@@ -284,6 +293,7 @@ typedef struct journal_superblock_s
 #define JBD2_FEATURE_INCOMPAT_64BIT		0x00000002
 #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT	0x00000004
 #define JBD2_FEATURE_INCOMPAT_CSUM_V2		0x00000008
+#define JBD2_FEATURE_INCOMPAT_CSUM_V3		0x00000010
 
 /* Features known to this kernel version: */
 #define JBD2_KNOWN_COMPAT_FEATURES	JBD2_FEATURE_COMPAT_CHECKSUM
@@ -291,7 +301,8 @@ typedef struct journal_superblock_s
 #define JBD2_KNOWN_INCOMPAT_FEATURES	(JBD2_FEATURE_INCOMPAT_REVOKE | \
 					JBD2_FEATURE_INCOMPAT_64BIT | \
 					JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \
-					JBD2_FEATURE_INCOMPAT_CSUM_V2)
+					JBD2_FEATURE_INCOMPAT_CSUM_V2 | \
+					JBD2_FEATURE_INCOMPAT_CSUM_V3)
 
 #ifdef __KERNEL__
 
@@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t
 extern int jbd2_journal_blocks_per_page(struct inode *inode);
 extern size_t journal_tag_bytes(journal_t *journal);
 
+static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
+{
+	if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) ||
+	    JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
+		return 1;
+
+	return 0;
+}
+
 /*
  * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
  * transaction control blocks.



  parent reply	other threads:[~2014-09-03 22:20 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 22:05 [PATCH 3.16 000/125] 3.16.2-stable review Greg Kroah-Hartman
2014-09-03 22:05 ` [PATCH 3.16 001/125] stable_kernel_rules: Add pointer to netdev-FAQ for network patches Greg Kroah-Hartman
2014-09-03 22:05 ` [PATCH 3.16 002/125] MIPS: math-emu: Fix instruction decoding Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 003/125] HID: logitech: fix bounds checking on LED report size Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 004/125] HID: logitech: perform bounds checking on device_id early enough Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 005/125] HID: fix a couple of off-by-ones Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 006/125] isofs: Fix unbounded recursion when processing relocated directories Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 007/125] uas: Limit qdepth to 32 when connected over usb-2 Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 008/125] USB: OHCI: fix bugs in debug routines Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 009/125] USB: OHCI: dont lose track of EDs when a controller dies Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 010/125] usbcore: dont log on consecutive debounce failures of the same port Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 011/125] USB: devio: fix issue with log flooding Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 012/125] USB: serial: ftdi_sio: Annotate the current Xsens PID assignments Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 013/125] USB: serial: ftdi_sio: Add support for new Xsens devices Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 014/125] USB: ehci-pci: USB host controller support for Intel Quark X1000 Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 015/125] USB: Fix persist resume of some SS USB devices Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 016/125] ALSA: hda - fix an external mic jack problem on a HP machine Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 017/125] ALSA: usb-audio: Adjust Gamecom 780 volume level Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 018/125] ALSA: virtuoso: add Xonar Essence STX II support Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 019/125] ALSA: hda/ca0132 - Dont try loading firmware at resume when already failed Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 020/125] ALSA: usb-audio: fix BOSS ME-25 MIDI regression Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 021/125] ALSA: hda - Add mute LED pin quirk for HP 15 touchsmart Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 022/125] ALSA: hda - restore the gpio led after resume Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 023/125] ALSA: hda/realtek - Avoid setting wrong COEF on ALC269 & co Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 024/125] mei: reset client connection state on timeout Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 025/125] mei: start disconnect request timer consistently Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 026/125] mei: dont schedule suspend in pm idle Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 027/125] mei: fix return value on disconnect timeout Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 028/125] xhci: Blacklist using streams on the Etron EJ168 controller Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 029/125] sched: Fix sched_setparam() policy == -1 logic Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 030/125] arm64: Fix barriers used for page table modifications Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 031/125] arm64: dont call break hooks for BRK exceptions from EL0 Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 032/125] efi/arm64: Store Runtime Services revision Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 033/125] ARM: dts: AM4372: Correct mailbox node data Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 034/125] ARM: 8097/1: unistd.h: relocate comments back to place Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 036/125] drm: omapdrm: fix compiler errors Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 037/125] mmc: mmci: Remove redundant check of status for DATA irq Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 038/125] mmc: mmci: Move all CMD irq handling to mmci_cmd_irq() Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 039/125] hwmon: (sis5595) Prevent overflow problem when writing large limits Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 040/125] hwmon: (amc6821) Fix possible race condition bug Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 041/125] hwmon: (lm78) Fix overflow problems seen when writing large temperature limits Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 042/125] hwmon: (gpio-fan) Prevent overflow problem when writing large limits Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 043/125] hwmon: (ads1015) Fix off-by-one for valid channel index checking Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 044/125] hwmon: (lm85) Fix various errors on attribute writes Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 045/125] hwmon: (ads1015) Fix out-of-bounds array access Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 046/125] hwmon: (dme1737) Prevent overflow problem when writing large limits Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 047/125] hwmon: (lm92) " Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 048/125] tpm: Add missing tpm_do_selftest to ST33 I2C driver Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 049/125] drivers/i2c/busses: use correct type for dma_map/unmap Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 050/125] i2c: rk3x: fix interrupt handling issue Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 051/125] ext4: fix punch hole on files with indirect mapping Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 052/125] ext4: fix ext4_discard_allocated_blocks() if we cant allocate the pa struct Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 053/125] serial: core: Preserve termios c_cflag for console resume Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 054/125] crypto: ux500 - make interrupt mode plausible Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 055/125] debugfs: Fix corrupted loop in debugfs_remove_recursive Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 056/125] KVM: x86: Inter-privilege level ret emulation is not implemeneted Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 057/125] KVM: x86: always exit on EOIs for interrupts listed in the IOAPIC redir table Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 058/125] KVM: s390/mm: Fix page table locking vs. split pmd lock Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 059/125] KVM: PPC: Book3S: Fix LPCR one_reg interface Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 060/125] KVM: nVMX: fix "acknowledge interrupt on exit" when APICv is in use Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 061/125] Revert "KVM: x86: Increase the number of fixed MTRR regs to 10" Greg Kroah-Hartman
2014-09-03 22:06 ` [PATCH 3.16 062/125] kvm: iommu: fix the third parameter of kvm_iommu_put_pages (CVE-2014-3601) Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 063/125] ext4: fix BUG_ON in mb_free_blocks() Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 064/125] drm/radeon: add new KV pci id Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 065/125] drm/radeon: add new bonaire pci ids Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 066/125] drm/radeon: add additional SI " Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 067/125] PCI: Configure ASPM when enabling device Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 068/125] PCI: Keep original resource if we fail to expand it Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 069/125] PCI: pciehp: Clear Data Link Layer State Changed during init Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 070/125] ACPI / PCI: Fix sysfs acpi_index and label errors Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 071/125] x86: dont exclude low BIOS area when allocating address space for non-PCI cards Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 072/125] powerpc/eeh: Wrong place to call pci_get_slot() Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 073/125] powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 074/125] powerpc/powernv: Update dev->dma_mask in pci_set_dma_mask() path Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 075/125] x86_64/vsyscall: Fix warn_bad_vsyscall log output Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 076/125] hpsa: fix non-x86 builds Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 077/125] x86: MCE: Add raw_lock conversion again Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 078/125] xen/events/fifo: ensure all bitops are properly aligned even on x86 Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 080/125] x86/xen: use vmap() to map grant table pages in PVH guests Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 081/125] x86/xen: resume timer irqs early Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 082/125] x86,mm: fix pte_special versus pte_numa Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 083/125] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 084/125] Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 085/125] Btrfs: fix csum tree corruption, duplicate and outdated checksums Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 086/125] Btrfs: read lock extent buffer while walking backrefs Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 087/125] Btrfs: fix compressed write corruption on enospc Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 088/125] btrfs: disable strict file flushes for renames and truncates Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 089/125] Btrfs: fix crash on endio of reading corrupted block Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 090/125] Btrfs: fix filemap_flush call in btrfs_file_release Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 091/125] Btrfs: fix task hang under heavy compressed write Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 092/125] mei: reset client state on queued connect request Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 093/125] mei: nfc: fix memory leak in error path Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 094/125] ext4: propagate errors up to ext4_find_entry()s callers Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 095/125] ext4: move i_size,i_disksize update routines to helper function Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 096/125] ext4: fix incorect journal credits reservation in ext4_zero_range Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 097/125] ext4: fix transaction issues for ext4_fallocate and ext_zero_range Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 098/125] ext4: update i_disksize coherently with block allocation on error path Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 099/125] ext4: fix same-dir rename when inline data directory overflows Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 100/125] jbd2: fix infinite loop when recovering corrupt journal blocks Greg Kroah-Hartman
2014-09-03 22:07 ` Greg Kroah-Hartman [this message]
2014-09-03 22:07 ` [PATCH 3.16 102/125] staging: lustre: Remove circular dependency on header Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 103/125] staging: et131x: Fix errors caused by phydev->addr accesses before initialisation Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 104/125] staging/rtl8188eu: add 0df6:0076 Sitecom Europe B.V Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 105/125] staging: r8188eu: Add new USB ID Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 106/125] xhci: Treat not finding the event_seg on COMP_STOP the same as COMP_STOP_INVAL Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 107/125] usb: xhci: amd chipset also needs short TX quirk Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 108/125] xhci: rework cycle bit checking for new dequeue pointers Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 109/125] xhci: Disable streams on Via XHCI with device-id 0x3432 Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 110/125] ARM: OMAP2+: hwmod: Rearm wake-up interrupts for DT when MUSB is idled Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 111/125] USB: ftdi_sio: add Basic Micro ATOM Nano USB2Serial PID Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 113/125] USB: whiteheat: Added bounds checking for bulk command response Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 114/125] usb: ehci: using wIndex + 1 for hub port Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 115/125] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1 Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 116/125] usbcore: Fix wrong device in an error message in hub_port_connect() Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 117/125] NFSD: Decrease nfsd_users in nfsd_startup_generic fail Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 118/125] NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 119/125] nfs3_list_one_acl(): check get_acl() result with IS_ERR_OR_NULL Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 120/125] nfs: reject changes to resvport and sharecache during remount Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 121/125] svcrdma: Select NFSv4.1 backchannel transport based on forward channel Greg Kroah-Hartman
2014-09-03 22:07 ` [PATCH 3.16 122/125] NFSv3: Fix another acl regression Greg Kroah-Hartman
2014-09-03 22:08 ` [PATCH 3.16 123/125] NFSv4: Dont clear the open state when we just did an OPEN_DOWNGRADE Greg Kroah-Hartman
2014-09-03 22:08 ` [PATCH 3.16 124/125] NFSv4: Fix problems with close in the presence of a delegation Greg Kroah-Hartman
2014-09-03 22:08 ` [PATCH 3.16 125/125] vm_is_stack: use for_each_thread() rather then buggy while_each_thread() Greg Kroah-Hartman
2014-09-03 23:44 ` [PATCH 3.16 000/125] 3.16.2-stable review Greg Kroah-Hartman
2014-09-04  4:52   ` Guenter Roeck
2014-09-04 13:40 ` Shuah Khan
2014-09-04 14:00   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140903220626.730386519@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas_reardon@hotmail.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.