Bug 53647
| Summary: | Asynchronous reading/writing of files on an SMP system | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Need Real Name <system.redhat> | ||||||
| Component: | kernel | Assignee: | Arjan van de Ven <arjanv> | ||||||
| Status: | CLOSED NOTABUG | QA Contact: | Brock Organ <borgan> | ||||||
| Severity: | high | Docs Contact: | |||||||
| Priority: | medium | ||||||||
| Version: | 7.1 | CC: | jakub, sct | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | i686 | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2003-06-07 17:40:43 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
|
Description
Need Real Name
2001-09-13 19:58:04 UTC
Created attachment 31776 [details]
reader program (self explanatory)
Created attachment 31777 [details]
writer program (self explanatory)
I hope you still have warranty on the big program; read() and write() are ALWAYS allowed to make partial progress. and always have been. (posix specification) Jakub: just to make sure, could you check the program as well ? The program doesn't check read bytes so that looks buggy to me. The behaviour on SMP _is_ the same as on UP. Neither UP nor SMP makes the gaurantee that writes are atomic with respect to reads. If you are running on an otherwise quiescent system so that the write system call happens to be able to proceed without having to do any IO or hitting a kernel lock which is already taken, then on UP you'll be lucky and finish the write before the read syscall can be scheduled. However, on a busy system, even UP will show non-atomic writes. This is correct behaviour: neither POSIX nor the SingleUnix specification require writes to be atomic, except for the special case of small writes to pipes. Mandatory locking will not fix your problem. Taking a mandatory lock in the write path won't necessarily wait for an already-running read to complete: it only prevents new reads from beginning. You'd need cooperative locking between both processes to make the required atomicity guarantees. If you have no access to the source for the reading application, then the only solution I can think of is to write a small library stub wrapper around the read syscall and LD_PRELOAD that. |