Subject: Re: PS3 Storage Driver O_DIRECT issue

From: Jens Axboe <[email-masked]>
Date: Wed, 18 Jul 2007 19:57:56 +0200

On Wed, Jul 18 2007, Geert Uytterhoeven wrote:
> On Fri, 13 Jul 2007, Olaf Hering wrote:
> > This driver (or the generic PS3 code) has appearently problems with
> > O_DIRECT. 
> > glibc aborts parted because the malloc metadata get corrupted. While it
> > is reproducible, the place where it crashes changes with every version
> > of the debug attempt.
> > I dont have a handle right now, all I know is that the metadata after a
> > malloc area get overwritten with zeros.
> > 
> > 
> > Can you have a look at this? 
> > parted /dev/ps3da
> > print (a few times)
> 
> I could reproduce it with parted 1.8.0 and later.
> 
> The patch below fixes it (tested with 1.8.0, 1.8.2 (FC6), 1.9.0 (git)).
> 
> Apparently sometimes bio_cur_sectors(bio)*KERNEL_SECTOR_SIZE != bvec->bv_len
> when using O_DIRECT. Is that true (or a bug?)?
> 
> If it's OK, I'll fold this patch into the main ps3disk patch.

The bug is in your code - you iterate the bio segments, but always
reference the current one. Which of course makes no sense, you may as
well just kill the loop in that case, the code would be the same.

-- 
Jens Axboe