linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: stable@vger.kernel.org
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Curt Wohlgemuth <curtw@google.com>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH 2.6.33.y 02/40] ext4: Fix BUG_ON at fs/buffer.c:652 in no journal mode
Date: Tue,  1 Jun 2010 08:02:49 -0400	[thread overview]
Message-ID: <1275393807-14369-2-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1275393807-14369-1-git-send-email-tytso@mit.edu>

From: Curt Wohlgemuth <curtw@google.com>

commit 73b50c1c92666d326b5fa2c945d46509f2f6d91f upstream (as of v2.6.33-git11)

Calls to ext4_handle_dirty_metadata should only pass in an inode
pointer for inode-specific metadata, and not for shared metadata
blocks such as inode table blocks, block group descriptors, the
superblock, etc.

The BUG_ON can get tripped when updating a special device (such as a
block device) that is opened (so that i_mapping is set in
fs/block_dev.c) and the file system is mounted in no journal mode.

Addresses-Google-Bug: #2404870

Signed-off-by: Curt Wohlgemuth <curtw@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/ext4_jbd2.c |    2 +-
 fs/ext4/ialloc.c    |    2 +-
 fs/ext4/inode.c     |    6 +++---
 fs/ext4/namei.c     |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index b57e5c7..98033d9 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -125,7 +125,7 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
 			ext4_journal_abort_handle(where, __func__, bh,
 						  handle, err);
 	} else {
-		if (inode && bh)
+		if (inode)
 			mark_buffer_dirty_inode(bh, inode);
 		else
 			mark_buffer_dirty(bh);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 2fab5ad..179e45c 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -904,7 +904,7 @@ repeat_in_this_group:
 				BUFFER_TRACE(inode_bitmap_bh,
 					"call ext4_handle_dirty_metadata");
 				err = ext4_handle_dirty_metadata(handle,
-								 inode,
+								 NULL,
 							inode_bitmap_bh);
 				if (err)
 					goto fail;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6a7694e..7128506 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5102,7 +5102,7 @@ static int ext4_do_update_inode(handle_t *handle,
 					EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
 			sb->s_dirt = 1;
 			ext4_handle_sync(handle);
-			err = ext4_handle_dirty_metadata(handle, inode,
+			err = ext4_handle_dirty_metadata(handle, NULL,
 					EXT4_SB(sb)->s_sbh);
 		}
 	}
@@ -5131,7 +5131,7 @@ static int ext4_do_update_inode(handle_t *handle,
 	}
 
 	BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
-	rc = ext4_handle_dirty_metadata(handle, inode, bh);
+	rc = ext4_handle_dirty_metadata(handle, NULL, bh);
 	if (!err)
 		err = rc;
 	ext4_clear_inode_state(inode, EXT4_STATE_NEW);
@@ -5685,7 +5685,7 @@ static int ext4_pin_inode(handle_t *handle, struct inode *inode)
 			err = jbd2_journal_get_write_access(handle, iloc.bh);
 			if (!err)
 				err = ext4_handle_dirty_metadata(handle,
-								 inode,
+								 NULL,
 								 iloc.bh);
 			brelse(iloc.bh);
 		}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 17a17e1..8bd1e20 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2024,7 +2024,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
 	/* Insert this inode at the head of the on-disk orphan list... */
 	NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
 	EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
-	err = ext4_handle_dirty_metadata(handle, inode, EXT4_SB(sb)->s_sbh);
+	err = ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
 	rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
 	if (!err)
 		err = rc;
@@ -2096,7 +2096,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
 		if (err)
 			goto out_brelse;
 		sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
-		err = ext4_handle_dirty_metadata(handle, inode, sbi->s_sbh);
+		err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
 	} else {
 		struct ext4_iloc iloc2;
 		struct inode *i_prev =
-- 
1.6.6.1.1.g974db.dirty


  reply	other threads:[~2010-06-01 12:03 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 12:02 [PATCH 2.6.33.y 01/40] ext4: Use bitops to read/modify EXT4_I(inode)->i_state Theodore Ts'o
2010-06-01 12:02 ` Theodore Ts'o [this message]
2010-06-01 12:02 ` [PATCH 2.6.33.y 03/40] ext4: Add flag to files with blocks intentionally past EOF Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 04/40] ext4: Fix fencepost error in chosing choosing group vs file preallocation Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 05/40] ext4: fix error handling in migrate Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 06/40] ext4: explicitly remove inode from orphan list after failed direct io Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 07/40] ext4: Handle non empty on-disk orphan link Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 08/40] ext4: make "offset" consistent in ext4_check_dir_entry() Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 09/40] ext4: Fix insertion point of extent in mext_insert_across_blocks() Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 10/40] ext4: Fix the NULL reference in double_down_write_data_sem() Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 11/40] ext4: Code cleanup for EXT4_IOC_MOVE_EXT ioctl Theodore Ts'o
2010-06-01 12:02 ` [PATCH 2.6.33.y 12/40] ext4: Fix estimate of # of blocks needed to write indirect-mapped files Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 13/40] ext4: Fixed inode allocator to correctly track a flex_bg's used_dirs Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 14/40] ext4: Fix possible lost inode write in no journal mode Theodore Ts'o
2012-09-28  3:08   ` Yongqiang Yang
2012-09-28  3:21     ` Yongqiang Yang
2010-06-01 12:03 ` [PATCH 2.6.33.y 15/40] ext4: Fix buffer head leaks after calls to ext4_get_inode_loc() Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 16/40] ext4: Issue the discard operation *before* releasing the blocks to be reused Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 17/40] ext4: check missed return value in ext4_sync_file() Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 18/40] ext4: fix memory leaks in error path handling of ext4_ext_zeroout() Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 19/40] ext4: Remove unnecessary call to ext4_get_group_desc() in mballoc Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 20/40] ext4: rename ext4_mb_release_desc() to ext4_mb_unload_buddy() Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 21/40] ext4: allow defrag (EXT4_IOC_MOVE_EXT) in 32bit compat mode Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 22/40] ext4: fix quota accounting in case of fallocate Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 23/40] ext4: check s_log_groups_per_flex in online resize code Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 24/40] ext4: don't return to userspace after freezing the fs with a mutex held Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 25/40] ext4: stop issuing discards if not supported by device Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 26/40] ext4: don't scan/accumulate more pages than mballoc will allocate Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 27/40] ext4: Do not zero out uninitialized extents beyond i_size Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 28/40] ext4: clean up inode bitmaps manipulation in ext4_free_inode Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 29/40] ext4: init statistics after journal recovery Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 30/40] ext4: Remove extraneous newlines in ext4_msg() calls Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 31/40] ext4: Prevent creation of files larger than RLIMIT_FSIZE using fallocate Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 32/40] ext4: check for a good block group before loading buddy pages Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 33/40] ext4: Show journal_checksum option Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 34/40] ext4: Use bitops to read/modify i_flags in struct ext4_inode_info Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 35/40] ext4: Avoid crashing on NULL ptr dereference on a filesystem error Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 36/40] ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 37/40] ext4: restart ext4_ext_remove_space() after transaction restart Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 38/40] ext4: Conditionally define compat ioctl numbers Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 39/40] ext4: Fix compat EXT4_IOC_ADD_GROUP Theodore Ts'o
2010-06-01 12:03 ` [PATCH 2.6.33.y 40/40] ext4: Make fsync sync new parent directories in no-journal mode Theodore Ts'o
2010-07-28 23:29 ` [stable] [PATCH 2.6.33.y 01/40] ext4: Use bitops to read/modify EXT4_I(inode)->i_state Greg KH

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=1275393807-14369-2-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=curtw@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).