linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Kit Westneat <kwestneat@ddn.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
	"Dilger, Andreas" <andreas.dilger@intel.com>
Subject: Re: [PATCH] e2fsck: blk64_t to blk_t truncation
Date: Mon, 2 Dec 2013 13:48:56 -0800	[thread overview]
Message-ID: <20131202214856.GB9535@birch.djwong.org> (raw)
In-Reply-To: <529CF1E8.3010003@ddn.com>

On Mon, Dec 02, 2013 at 03:47:36PM -0500, Kit Westneat wrote:
> Hello,
> 
> We recently ran into an issue where e2fsck was claiming to clear
> deleted/unused inodes, but was not actually doing it. We tracked it
> down to a bad blk64_t to blk_t conversion in pass2 where
> ext2fs_write_dir_block is being called instead of
> ext2fs_write_dir_block3. There is another similar call in
> allocate_dir_block. These appear to be fixed in master as part of
> the move to adding checksums to the end of directory leaf nodes, but
> it's still an issue on maint.
> 
> I ran gcc with -Wconversion and found a number of other places that
> have blk64_t to blk_t truncations, but I'm not sure how many of them
> are actually problems. For example in block_iterate_ind, block_nr is
> blk_t but it seems to be a specific choice, since there is also the
> blk64 variable. Another instance is with the EA refcounting, which
> is all 32-bit. In expand_dir_proc in pass3.c, it uses the 32-bit
> ext2fs_write_dir_block. Against 1.42.7, gcc reports 103 blk64_t to
> blk_t conversions, so this is just a small sample.
> 
> I'm sure most of these are not problems, but I thought I'd raise the
> issue since we did run into problems with deleted/unused inodes.
> 
> Signed-off-by: Kit Westneat <kwestneat@ddn.com>

Looks fine to me, so you can add
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

I wonder how many more of these kinds of errors I inadvertently fixed
and neglected to patch maint... :/

--D
> 
> 
> diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
> index 78740c0..e8d0b47 100644
> --- a/e2fsck/pass2.c
> +++ b/e2fsck/pass2.c
> @@ -1216,7 +1216,7 @@ out_htree:
>  		}
>  	}
>  	if (dir_modified) {
> -		cd->pctx.errcode = ext2fs_write_dir_block(fs, block_nr, buf);
> +		cd->pctx.errcode = ext2fs_write_dir_block3(fs, block_nr, buf, 0);
>  		if (cd->pctx.errcode) {
>  			if (!fix_problem(ctx, PR_2_WRITE_DIRBLOCK,
>  					 &cd->pctx))
> @@ -1595,7 +1595,7 @@ static int allocate_dir_block(e2fsck_t ctx,
>  		return 1;
>  	}
> 
> -	pctx->errcode = ext2fs_write_dir_block(fs, blk, block);
> +	pctx->errcode = ext2fs_write_dir_block3(fs, blk, block, 0);
>  	ext2fs_free_mem(&block);
>  	if (pctx->errcode) {
>  		pctx->str = "ext2fs_write_dir_block";
> 
> ---
> Kit Westneat
> L3 Lustre Support, DDN
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-12-02 21:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <529CF0D2.2010707@ddn.com>
2013-12-02 20:47 ` [PATCH] e2fsck: blk64_t to blk_t truncation Kit Westneat
2013-12-02 21:48   ` Darrick J. Wong [this message]
2013-12-03  0:25   ` Theodore Ts'o
2013-12-03  5:10     ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
2013-12-03  5:10       ` [PATCH 01/10] e2fsck: use problem_t to suppress some -Wconversion warnings Theodore Ts'o
2013-12-03  5:10       ` [PATCH 02/10] e2fsck: use errcode_t " Theodore Ts'o
2013-12-03  5:10       ` [PATCH 03/10] e2fsck: use blk_t instead of blk64_t in check_resize_inode() Theodore Ts'o
2013-12-03  5:10       ` [PATCH 04/10] dumpe2fs: fix printing of block offsets for 64-bit file systems Theodore Ts'o
2013-12-03  5:10       ` [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h Theodore Ts'o
2013-12-03 19:16         ` Darrick J. Wong
2013-12-03 19:52           ` Theodore Ts'o
2013-12-03 20:13             ` Darrick J. Wong
2013-12-03  5:10       ` [PATCH 06/10] libext2fs: add explicit casts to bitops.h Theodore Ts'o
2013-12-03  5:10       ` [PATCH 07/10] e2fsck: fix j_maxlen if the file system is exactly 1 << 32 blocks Theodore Ts'o
2013-12-03  5:10       ` [PATCH 08/10] e2fsck: add support for 64-bit extended attribute block refcounting Theodore Ts'o
2013-12-03  5:10       ` [PATCH 09/10] e2fsck: use dgrp_t for block group numbers Theodore Ts'o
2013-12-03  5:10       ` [PATCH 10/10] libext2fs: fix printf conversion spec in tst_iscan.c Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131202214856.GB9535@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=andreas.dilger@intel.com \
    --cc=kwestneat@ddn.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).