Re: Update of file offset on write() etc. is non-atomic with I/O

From: Linus Torvalds
Date: Mon Mar 03 2014 - 17:20:42 EST


On Mon, Mar 3, 2014 at 2:09 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Yes, but in that case fdget() has grabbed a reference to that sucker,
> so the only way to end with refcount 1 is to have the damn thing gone
> from descriptor table in between. And AFAICS in that case we are just
> fine without f_pos_lock.

Ahh. Yes, you're right, just checking the file_count() is sufficient,
because as you say, the threaded case will have incremented it for the
case we care about./

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/