Re: [RFC] should read(2) update the position if it returns an error?

From: Linus Torvalds
Date: Fri Jun 14 2013 - 11:38:25 EST


On Fri, Jun 14, 2013 at 1:05 AM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Comments? I'd obviously prefer to solve it that way (i.e. leave
> ->f_pos untouched if vfs_read() returns an error), but I might be missing
> some case where we want position updated even though read() returns an
> error. I can't come up with one, but then I hadn't RTFS through every
> ->read() instance in drivers in search of weird cases like that - we've
> too many instances ;-/

Not updating f_pos on errors sounds like the right thing to do to me,
and if it also ends up fixing some nasty issues with hpfs and
potentially other cases, I'd say "go for it".

Not for 3.10, though. It's not like this is a new - or acute - problem.

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