Bug#463769: Fails on files (ie disk images)

Wakko Warner wakko at animx.eu.org
Sat Apr 12 13:02:23 UTC 2008

martin f krafft wrote:
> also sprach Wakko Warner <wakko at animx.eu.org> [2008.04.11.2318 +0200]:
> > Querying is the only thing I was after.  The patch I made makes querying
> > work.
> Wakko, is this querying-specific, and does the patch have no other
> effects?

I don't think it's query specific due to the way mdadm was written.

What it does is this:
in Query.c:Query:
2 places where an open is performed, I added O_LARGEFILE to the flags. 
Without this, obviously, files larger than 2gb will not open.

in mdadm.h:
I added a define for _FILE_OFFSET_BITS 64
It's been a while, I don't remember exactly why, but I think that caused
O_LARGEFILE to be included from one of the system libraries.

in util.c:dev_open:
I add O_LARGEFILE to the flags which is used later in an open statement.

in util.c:get_dev_size:
I add an fstat to get the size of the "file" if it is a regular file.  That
function only used ioctls to get the size.

Those modifications allowed querying with -E work on regular files. 

> Neil, can we integrate this upstream? The patch makes mdadm -E/D
> work on files, not only block devices.

This does not work with -D.  -D requires an active MD device to query.

 Lab tests show that use of micro$oft causes cancer in lab animals
 Got Gas???

More information about the pkg-mdadm-devel mailing list