ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
Subsystems (2)
PATCH 1/1 ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
From: Changwei Ge <[email protected]>
Somehow, file system metadata was corrupted, which causes ocfs2_check_dir_entry() to fail in function ocfs2_dir_foreach_blk_el().
According to the original design intention, if above happens we should skip the problematic block and continue to retrieve dir entry. But there is obviouse misuse of brelse around related code.
After failure of ocfs2_check_dir_entry(), currunt code just moves to next position and uses the problematic buffer head again and again during which the problematic buffer head is released for multiple times. I suppose, this a serious issue which is long-lived in ocfs2. This may cause other file systems which is also used in a the same host insane.
So we should also consider about bakcporting this patch into linux -stable.
--- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/dir.c +1 -2
@@ -1897,8 +1897,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,/* On error, skip the f_pos to the next block. */ ctx->pos = (ctx->pos | (sb->s_blocksize -1 )) +1 ; -brelse (bh); -continue ; +break ; }if (le64_to_cpu (de->inode)) {unsigned char d_type =DT_UNKNOWN ;
Signature · 1 line
2.7.4
Greg KH
maintainerPATCH 1/1 ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
Quoted 15 lines · Changwei Ge
From: Changwei Ge <[email protected]>
Somehow, file system metadata was corrupted, which causes
ocfs2_check_dir_entry()to fail in functionocfs2_dir_foreach_blk_el().According to the original design intention, if above happens we should skip the problematic block and continue to retrieve dir entry. But there is obviouse misuse of brelse around related code.
After failure of
ocfs2_check_dir_entry(), currunt code just moves to next position and uses the problematic buffer head again and again during which the problematic buffer head is released for multiple times. I suppose, this a serious issue which is long-lived in ocfs2. This may cause other file systems which is also used in a the same host insane.
Quoted 8 lines
So we should also consider about bakcporting this patch into linux -stable.
Suggested-by Changkuo Shi <[email protected]>Signed-off-by Changwei Ge <[email protected]>--- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.kernel.org_doc_html_latest_process_stable-2Dkernel-2Drules.html&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=C7gAd4uDxlAvTdc0vmU6X8CMk6L2iDY8-HD0qT6Fo7Y&m=ZFGNdxMGJOFwcOvw1WPDqEeWXHqRt00lPWocekbXDwg&s=bqQ638ETryFkKttOq4dXSro7DV0OgJy7WTajPiK6fxw&e=
for how to do this properly.
</formletter>