Messages in this thread | | | Date | Wed, 7 Mar 2007 18:12:40 -0800 | From | "Michael K. Edwards" <> | Subject | Re: f_owner.lock and file->pos updates |
| |
I wrote: > I didn't see any clean way to intersperse overwrites and appends to a > record-structured file without using vfs_llseek, which steps on f_pos.
The context, of course, is an attempt to fix -ENOPATCH with regard to the netlink-based AIO submission scheme I outlined a couple of days ago. :-)
Maybe f_pos should be advanced atomically by the number of bytes expected to be read/written, before entering the vfs_(read|write)(|v) call? And then if the read/write doesn't complete normally, f_pos should be decremented by the number of bytes we failed to read/write? Or do we have to make absolutely, positively sure that sampling f_pos from another thread never returns any value outside (before)..(before + bytes read/written)? If so, the only way to cure the worst symptom of the append race appears to be to hold a per-fd lock for the duration of the sys_(read|write).
Cheers, - Michael - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |