[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1267739098.4204.12.camel@michlmayr>
Date: Thu, 04 Mar 2010 22:44:58 +0100
From: Leonard Michlmayr <leonard.michlmayr@...il.com>
To: Akira Fujita <a-fujita@...jp.nec.com>, tytso@....edu
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 11/28] ext4: correctly calculate number of blocks for
fiemap
Akira Fujita:
> <kernel-space>
> fs/ioctl.c ioctl_fimap():
>
> filemap_check_ranges():
> len(~0ULL)
> new_len(4398046511103 = s_maxbytes) <--- Because 'len > s_maxbytes'
>
> fs/ext4/extents.c ext4_fiemap():
> last_blk = start(0) + len(4398046511103) - 1 >> s_blocksize_bits(11)
> = 4294967295 (0xFFFFFFFF)
> len_blks = 4294967295 + 1 (0xFFFFFFFF + 0x00000001)
> = 4294967296 (0x100000000) <--- _OVERFLOW!!_
>
> ext4_ext_walk_space():
> num = 0
>
> This overflow leads to incorrect output like the below,
> even though 2 extents exist.
>
Thank you for pointing this out. I had not checked s_maxbytes.
Appearently s_maxbytes can be 1<<(32 + s_blocksize_bits) - 1. Therefore
the number of blocks in a file cannot be stored in a 32bit integer.
I have a patch that should fix it for fiemap. I have just compiled it
and I will do some testing and double checking tomorrow. I will send a
separate email with the patch.
regards
Leonard
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists