X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=e2fsck%2Fquota.c;h=f9b68c9d9cb9387ecb1f3d77c651fea3e51392b1;hb=8676d7e0c0c8830e1d911693586fa1463c43050f;hp=b0f9af6373d694b39043ab9368e11366f79e2e22;hpb=d202f46d81c6ca8a0dbce2053cf8114bd68a3ddc;p=tools%2Fe2fsprogs.git diff --git a/e2fsck/quota.c b/e2fsck/quota.c index b0f9af6..f9b68c9 100644 --- a/e2fsck/quota.c +++ b/e2fsck/quota.c @@ -16,22 +16,26 @@ #include "e2fsck.h" #include "problem.h" -static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, - ext2_ino_t to_ino, enum quota_type qtype) +static errcode_t move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, + ext2_ino_t to_ino, enum quota_type qtype) { struct ext2_inode inode; errcode_t retval; char qf_name[QUOTA_NAME_LEN]; /* We need the inode bitmap to be loaded */ - if (ext2fs_read_bitmaps(fs)) - return; + retval = ext2fs_read_bitmaps(fs); + if (retval) { + com_err("ext2fs_read_bitmaps", retval, "%s", + _("in move_quota_inode")); + return retval; + } retval = ext2fs_read_inode(fs, from_ino, &inode); if (retval) { com_err("ext2fs_read_inode", retval, "%s", _("in move_quota_inode")); - return; + return retval; } inode.i_links_count = 1; @@ -44,16 +48,22 @@ static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, if (retval) { com_err("ext2fs_write_new_inode", retval, "%s", _("in move_quota_inode")); - return; + return retval; } /* unlink the old inode */ quota_get_qf_name(qtype, QFMT_VFS_V1, qf_name); - ext2fs_unlink(fs, EXT2_ROOT_INO, qf_name, from_ino, 0); + retval = ext2fs_unlink(fs, EXT2_ROOT_INO, qf_name, from_ino, 0); + if (retval) { + com_err("ext2fs_unlink", retval, "%s", + _("in move_quota_inode")); + return retval; + } ext2fs_inode_alloc_stats(fs, from_ino, -1); /* Clear out the original inode in the inode-table block. */ memset(&inode, 0, sizeof(struct ext2_inode)); ext2fs_write_inode(fs, from_ino, &inode); + return 0; } void e2fsck_hide_quota(e2fsck_t ctx) @@ -77,7 +87,8 @@ void e2fsck_hide_quota(e2fsck_t ctx) quota_ino = quota_type2inum(qtype, fs->super); if (pctx.ino && (pctx.ino != quota_ino) && fix_problem(ctx, PR_0_HIDE_QUOTA, &pctx)) { - move_quota_inode(fs, pctx.ino, quota_ino, qtype); + if (move_quota_inode(fs, pctx.ino, quota_ino, qtype)) + continue; *quota_sb_inump(sb, qtype) = quota_ino; ext2fs_mark_super_dirty(fs); } @@ -92,7 +103,6 @@ void e2fsck_validate_quota_inodes(e2fsck_t ctx) struct problem_context pctx; ext2_filsys fs = ctx->fs; enum quota_type qtype; - ext2_ino_t quota_ino; clear_problem_context(&pctx);