Re: crash while reading win2k ntfs partition

From: Steve Dodd (steved@loth.demon.co.uk)
Date: Sun Apr 30 2000 - 05:18:08 EST


On Sat, Apr 29, 2000 at 08:07:12PM +0100, Anton Altaparmakov wrote:

> This crash is not exactly a bug in the driver (um, well, I guess it is a
> bug of sorts) but more of a "feature_not_implemented" type of problem. -
> just to quote from the source:
>
> -----
> /* It's fscking broken. */
>
> static int ntfs_get_block(struct inode *inode, long block, struct
> buffer_head *bh, int create)
> {
> BUG();
> return -1;
> }
> -----

Aha, I sense the "hand of Viro" in that comment.

> Also looking at the implementation of block_read_full_page in fs/buffer.c
> (starts on line 1535, linux-2.3.99-pre7-1) the call to the file system
> supplied get_block function is not checked for its return value so it
> wouldn't trap that ntfs_get_block wouldn't be "successful".

If the call isn't successful, the bh just won't be marked as mapped, so
block_read_full_page should just map an empty page.

> If anyone has any suggestions of how to handle this situation more
> elegantly please let me know... - NB. I am not looking for the suggestion
> "implement ntfs_get_block" unless you want to do it and send me a patch...

Well, in theory it should just be a question of using the code in the
(apparently dead) ntfs_bmap function to get the block number, and modifying
the bh appropriately. It won't work for resident data attributes, but then
you shouldn't have been able to mmap such a file to start with. In practice,
I suspect there was a good reason why Al marked it as broken... Maybe because
the rest of the driver doesn't use the pagecache, which would create a
wonderful mess if you tried to e.g. write() to an already mmap()d part of
a file.

> Also would people consider it a Good Thing (TM) if the driver checks for
> the NTFS version during mount time and for example refuses to enable write
> access if Win2k has upgraded the NTFS partition to the win2k version of
> NTFS? IMHO this would be a good idea but I would like to hear what others
> think first, before doing it.

TBH, I think the write code in the current driver should be nuked anyway.
Last time I checked it (e.g.) mangled directories quite nicely, and trying
to pick your way through the magic number-riddled code is an exercise in...
something nasty.

I've not investigated what Win2k does to NTFS filesystems, but I would have
thought that the NTFS design would allow for adding new features in a
backwardly compatible manner. That doesn't mean MSFT did things that way,
though :-/ Of course, I'm sure that in the light of the recent court ruling,
the OS division of MS will be happy to open up the NTFS specs without
requiring an NDA.

Seriously, in a few days time I hope to be able to start some "serious cleanup"
on the driver, but I can't do it right now..

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:18 EST