Skip to contentSkip to conversation

xfs_end_io_direct() with negative size?

DISCUSSION Zach Brown 2 participants 2 messages Aug 11, 2006 – Aug 14, 2006

lore
Share & tools
lore

Zach Brown

author
#0 lore raw

So, I was lost in fs/direct-io.c chasing yet another bug when I noticed that a recent unrelated change might have changed the semantics of the end_io() call.

http://www.kernel.org/hg/linux-2.6/?cs=34c151cf341f

Notice how that changes the aio path to set 'transferred' to -EIO based on dio->io_error before calling dio_complete() instead of after, like the sync path does with its possibly negative 'ret'.

So it looks like xfs_end_io_direct() can now get a -ve size if, say, someone unplugs a drive part-way through a dio+aio write. There's an ASSERT() in there that makes me wonder if this is something we should be worrying about.

- z

#1 lore raw
Quoted 7 lines · Zach Brown

So, I was lost in fs/direct-io.c chasing yet another bug when I noticed that a recent unrelated change might have changed the semantics of the end_io() call.

   http://www.kernel.org/hg/linux-2.6/?cs=34c151cf341f
Quoted 8 lines

Notice how that changes the aio path to set 'transferred' to -EIO based on dio->io_error before calling dio_complete() instead of after, like the sync path does with its possibly negative 'ret'.

So it looks like xfs_end_io_direct() can now get a -ve size if, say, someone unplugs a drive part-way through a dio+aio write. There's an ASSERT() in there that makes me wonder if this is something we should be worrying about.

Its harmless. It was written when there was no way a negative byte count would be coming back at us from the dio code. We should simply remove the assert.

cheers.

Signature · 1 line
Nathan