linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@us.ibm.com>
To: Tao Ma <tm@tao.ma>, Theodore Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/5] ext4: ext4_rename should dirty dir_bh with the correct directory
Date: Fri, 21 Oct 2011 14:18:06 -0700	[thread overview]
Message-ID: <20111021211806.10784.76743.stgit@elm3c44.beaverton.ibm.com> (raw)
In-Reply-To: <20111021211759.10784.17257.stgit@elm3c44.beaverton.ibm.com>

When ext4_rename performs a directory rename (move), dir_bh is a buffer that is
modified to update the '..' link in the directory being moved (old_inode).
However, ext4_handle_dirty_metadata is called with the old parent directory
inode (old_dir) and dir_bh, which is incorrect because dir_bh does not belong
to the parent inode.  Fix this error.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---
 fs/ext4/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 310b356..6d3fab4 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2530,7 +2530,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 		PARENT_INO(dir_bh->b_data, new_dir->i_sb->s_blocksize) =
 						cpu_to_le32(new_dir->i_ino);
 		BUFFER_TRACE(dir_bh, "call ext4_handle_dirty_metadata");
-		retval = ext4_handle_dirty_metadata(handle, old_dir, dir_bh);
+		retval = ext4_handle_dirty_metadata(handle, old_inode, dir_bh);
 		if (retval) {
 			ext4_std_error(old_dir->i_sb, retval);
 			goto end_rename;

  reply	other threads:[~2011-10-21 21:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 21:17 [PATCH 1/5] ext4: ext4_dx_add_entry should dirty directory metadata with the directory inode Darrick J. Wong
2011-10-21 21:18 ` Darrick J. Wong [this message]
2011-10-25 13:08   ` [PATCH 2/5] ext4: ext4_rename should dirty dir_bh with the correct directory Ted Ts'o
2011-10-21 21:18 ` [PATCH 3/5] ext4: ext4_mkdir should dirty dir_block with the parent inode Darrick J. Wong
2011-10-25 13:09   ` Ted Ts'o
2011-10-21 21:18 ` [PATCH 4/5] ext4: Prevent stack overrun in ext4_file_open when recording last known mountpoint Darrick J. Wong
2011-10-25 13:22   ` Ted Ts'o
2011-10-21 21:18 ` [PATCH 5/5] ext4: Fix endian problem in MMP initialization Darrick J. Wong
2011-10-22 17:25   ` Andreas Dilger
2011-10-25 13:35   ` Ted Ts'o
2011-10-25 13:13 ` [PATCH 1/5] ext4: ext4_dx_add_entry should dirty directory metadata with the directory inode Ted Ts'o

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=20111021211806.10784.76743.stgit@elm3c44.beaverton.ibm.com \
    --to=djwong@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tm@tao.ma \
    --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 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).