ocfs2: add missing return value and check for sb_getblk
PATCH 1/1 ocfs2: add missing return value and check for sb_getblk
- Fix the return err in serval places missed in
(ocfs2: return ENOMEM while sb_getblk failing).
- Add the missing check for new_bh in ocfs2_create_xattr_block.
Signed-off-by Joseph Qi <[email protected]>
Signed-off-by Rui Xiang <[email protected]>
--- fs/ocfs2/aops.c | 1 + fs/ocfs2/buffer_head_io.c | 4 ++-- fs/ocfs2/xattr.c | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-)
fs/ocfs2/aops.c +1 -0
@@ -92,6 +92,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock, iblock; buffer_cache_bh =sb_getblk (osb->sb, blkno);if (!buffer_cache_bh) { + err = -ENOMEM ;mlog (ML_ERROR ,"couldn't getblock for symlink!\n" ); goto bail; }
fs/ocfs2/buffer_head_io.c +2 -2
@@ -115,7 +115,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,if (bhs[i] ==NULL ) { bhs[i] =sb_getblk (osb->sb, block++);if (bhs[i] ==NULL ) { - status = -EIO ; + status = -ENOMEM ;mlog_errno (status); goto bail; }
@@ -214,7 +214,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, bhs[i] =sb_getblk (sb, block++);if (bhs[i] ==NULL ) {ocfs2_metadata_cache_io_unlock (ci); - status = -EIO ; + status = -ENOMEM ;mlog_errno (status); goto bail; }
fs/ocfs2/xattr.c +5 -0
@@ -2865,6 +2865,11 @@ static int ocfs2_create_xattr_block(struct inode *inode, } new_bh =sb_getblk (inode->i_sb, first_blkno); +if (!new_bh) { + ret = -ENOMEM ; +mlog_errno (ret); + goto end; + }ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); ret = ocfs2_journal_access_xb(ctxt->handle, INODE_CACHE(inode),
Signature · 1 line
1.8.2.2
PATCH 1/1 ocfs2: add missing return value and check for sb_getblk
Quoted 7 lines · Rui Xiang
- Fix the return err in serval places missed in
(ocfs2: return ENOMEM whilesb_getblkfailing).- Add the missing check for
new_bhinocfs2_create_xattr_block.Signed-off-by Joseph Qi <[email protected]>Signed-off-by Rui Xiang <[email protected]>
Looks good, thanks.
Reviewed-by Jie Liu <[email protected]>
Quoted 56 lines
--- fs/ocfs2/aops.c | 1 + fs/ocfs2/buffer_head_io.c | 4 ++-- fs/ocfs2/xattr.c | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-)fs/ocfs2/aops.c +1
-0@@ -92,6 +92,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock, iblock; buffer_cache_bh =sb_getblk (osb->sb, blkno);if (!buffer_cache_bh) { + err = -ENOMEM ;mlog (ML_ERROR ,"couldn't getblock for symlink!\n" ); goto bail; }fs/ocfs2/buffer_head_io.c +2
-2@@ -115,7 +115,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,if (bhs[i] ==NULL ) { bhs[i] =sb_getblk (osb->sb, block++);if (bhs[i] ==NULL ) { - status = -EIO ; + status = -ENOMEM ;mlog_errno (status); goto bail; }@@ -214,7 +214,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, bhs[i] =sb_getblk (sb, block++);if (bhs[i] ==NULL ) {ocfs2_metadata_cache_io_unlock (ci); - status = -EIO ; + status = -ENOMEM ;mlog_errno (status); goto bail; }fs/ocfs2/xattr.c +5
-0@@ -2865,6 +2865,11 @@ static int ocfs2_create_xattr_block(struct inode *inode, } new_bh =sb_getblk (inode->i_sb, first_blkno); +if (!new_bh) { + ret = -ENOMEM ; +mlog_errno (ret); + goto end; + }ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); ret = ocfs2_journal_access_xb(ctxt->handle, INODE_CACHE(inode),