Message ID | 20210219210333.1439525-1-harshads@google.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/4] e2fsck: don't ignore return values in e2fsck_rewrite_extent_tree | expand |
Hello Harshad, ext2fs_iblk_set in the same e2fsck_rewrite_extent_tee returns a return code, but code is ignored. Could you also add check there? Best regards, Artem Blagodarenko > On 20 Feb 2021, at 00:03, Harshad Shirwadkar <harshadshirwadkar@gmail.com> wrote: > > From: Harshad Shirwadkar <harshadshirwadkar@gmail.com> > > Don't ignore return values of ext2fs_read/write_inode_full() in > e2fsck_rewrite_extent_tree. > > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> > --- > e2fsck/extents.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/e2fsck/extents.c b/e2fsck/extents.c > index 600dbc97..f48f14ff 100644 > --- a/e2fsck/extents.c > +++ b/e2fsck/extents.c > @@ -290,8 +290,10 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) > errcode_t err; > > memset(&inode, 0, sizeof(inode)); > - ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > - sizeof(inode)); > + err = ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > + sizeof(inode)); > + if (err) > + return err; > > /* Skip deleted inodes and inline data files */ > if (inode.i_flags & EXT4_INLINE_DATA_FL) > @@ -306,10 +308,8 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) > if (err) > return err; > ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count); > - ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > - sizeof(inode)); > - > - return 0; > + return ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > + sizeof(inode)); > } > > errcode_t e2fsck_read_extents(e2fsck_t ctx, struct extent_list *extents) > -- > 2.30.0.617.g56c4b15f3c-goog >
Thanks Artem, will fix this in V2. - Harshad On Sat, Feb 20, 2021 at 12:58 AM Благодаренко Артём <artem.blagodarenko@gmail.com> wrote: > > Hello Harshad, > > ext2fs_iblk_set in the same e2fsck_rewrite_extent_tee returns a return code, but code is ignored. > Could you also add check there? > > Best regards, > Artem Blagodarenko > > > On 20 Feb 2021, at 00:03, Harshad Shirwadkar <harshadshirwadkar@gmail.com> wrote: > > > > From: Harshad Shirwadkar <harshadshirwadkar@gmail.com> > > > > Don't ignore return values of ext2fs_read/write_inode_full() in > > e2fsck_rewrite_extent_tree. > > > > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> > > --- > > e2fsck/extents.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/e2fsck/extents.c b/e2fsck/extents.c > > index 600dbc97..f48f14ff 100644 > > --- a/e2fsck/extents.c > > +++ b/e2fsck/extents.c > > @@ -290,8 +290,10 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) > > errcode_t err; > > > > memset(&inode, 0, sizeof(inode)); > > - ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > > - sizeof(inode)); > > + err = ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > > + sizeof(inode)); > > + if (err) > > + return err; > > > > /* Skip deleted inodes and inline data files */ > > if (inode.i_flags & EXT4_INLINE_DATA_FL) > > @@ -306,10 +308,8 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) > > if (err) > > return err; > > ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count); > > - ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > > - sizeof(inode)); > > - > > - return 0; > > + return ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), > > + sizeof(inode)); > > } > > > > errcode_t e2fsck_read_extents(e2fsck_t ctx, struct extent_list *extents) > > -- > > 2.30.0.617.g56c4b15f3c-goog > > >
diff --git a/e2fsck/extents.c b/e2fsck/extents.c index 600dbc97..f48f14ff 100644 --- a/e2fsck/extents.c +++ b/e2fsck/extents.c @@ -290,8 +290,10 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) errcode_t err; memset(&inode, 0, sizeof(inode)); - ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), - sizeof(inode)); + err = ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), + sizeof(inode)); + if (err) + return err; /* Skip deleted inodes and inline data files */ if (inode.i_flags & EXT4_INLINE_DATA_FL) @@ -306,10 +308,8 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) if (err) return err; ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count); - ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), - sizeof(inode)); - - return 0; + return ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), + sizeof(inode)); } errcode_t e2fsck_read_extents(e2fsck_t ctx, struct extent_list *extents)