linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: gmail <yngsion@gmail.com>
To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: tytso@mit.edu, jack@suse.cz
Subject: [PATCH] ext4: release bh in make_indexed_dir
Date: Fri, 30 Sep 2016 01:36:30 +0800	[thread overview]
Message-ID: <1475170590.1830.13.camel@gmail.com> (raw)

The commit 6050d47adcad
("ext4: bail out from make_indexed_dir() on first error")
miss to release bh in make_indexed_dir.

Signed-off-by: yangsheng <yngsion@gmail.com>
---
 fs/ext4/namei.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 38ca0fe..465f960 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2058,19 +2058,18 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
 		retval = PTR_ERR(de);
 		goto out_frames;
 	}
-	dx_release(frames);
 
 	retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh);
-	brelse(bh);
-	return retval;
 out_frames:
 	/*
 	 * Even if the block split failed, we have to properly write
 	 * out all the changes we did so far. Otherwise we can end up
 	 * with corrupted filesystem.
 	 */
-	ext4_mark_inode_dirty(handle, dir);
+	if (retval)
+		ext4_mark_inode_dirty(handle, dir);
 	dx_release(frames);
+	brelse(bh);
 	return retval;
 }
 



             reply	other threads:[~2016-09-29 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 17:36 gmail [this message]
2016-09-30  1:45 ` [PATCH] ext4: release bh in make_indexed_dir Theodore Ts'o
2016-09-30  5:34 ` Theodore 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=1475170590.1830.13.camel@gmail.com \
    --to=yngsion@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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).