* [PATCH] ext4: release bh in make_indexed_dir
@ 2016-09-29 17:36 gmail
2016-09-30 1:45 ` Theodore Ts'o
2016-09-30 5:34 ` Theodore Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: gmail @ 2016-09-29 17:36 UTC (permalink / raw)
To: linux-ext4, linux-fsdevel; +Cc: tytso, jack
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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: release bh in make_indexed_dir
2016-09-29 17:36 [PATCH] ext4: release bh in make_indexed_dir gmail
@ 2016-09-30 1:45 ` Theodore Ts'o
2016-09-30 5:34 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2016-09-30 1:45 UTC (permalink / raw)
To: gmail; +Cc: linux-ext4, linux-fsdevel, jack
On Fri, Sep 30, 2016 at 01:36:30AM +0800, gmail wrote:
> 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>
There's no missing brelse() as far as I can see. bh is assigned to
frame->bh, and the call to dx_release(frames) will release bh.
- Ted
> ---
> 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;
> }
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: release bh in make_indexed_dir
2016-09-29 17:36 [PATCH] ext4: release bh in make_indexed_dir gmail
2016-09-30 1:45 ` Theodore Ts'o
@ 2016-09-30 5:34 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2016-09-30 5:34 UTC (permalink / raw)
To: gmail; +Cc: linux-ext4, linux-fsdevel, jack
On Fri, Sep 30, 2016 at 01:36:30AM +0800, gmail wrote:
> 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>
Thanks, applied. I rewrote the commit description and also took out
the confusing "bh = bh2" and then used bh2 where we were using bh
before, which makes the code much easier to understand.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-30 5:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 17:36 [PATCH] ext4: release bh in make_indexed_dir gmail
2016-09-30 1:45 ` Theodore Ts'o
2016-09-30 5:34 ` Theodore Ts'o
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).