Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4021)

Issue 7235066: code review 7235066: net, os, syscall: don't hold ForkLock during blocked op... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by akumar
Modified:
11 years, 2 months ago
Reviewers:
CC:
rsc, ality, golang-dev
Visibility:
Public.

Description

os: don't hold ForkLock across opens on Plan 9 If os.OpenFile holds ForkLock on files that block opens, then threads that simultaneously try to do fork-exec will get hung up (until the open succeeds). Blocked opens are common enough on Plan 9 that protecting against fd leaks into fork-execs means not being able to do fork-execs properly in the general case. Thus, we forgo taking the lock.

Patch Set 1 #

Patch Set 2 : diff -r f6172d444cc0 https://code.google.com/p/go #

Patch Set 3 : diff -r f6172d444cc0 https://code.google.com/p/go #

Total comments: 1

Patch Set 4 : diff -r f6172d444cc0 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+0 lines, -2 lines) Patch
M src/pkg/os/file_plan9.go View 1 2 3 2 chunks +0 lines, -2 lines 0 comments Download

Messages

Total messages: 6
akumar
Hello rsc@golang.org, ality@pbrane.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
11 years, 2 months ago (2013-01-30 13:11:15 UTC) #1
rsc
https://codereview.appspot.com/7235066/diff/3/src/pkg/net/ipsock_plan9.go File src/pkg/net/ipsock_plan9.go (right): https://codereview.appspot.com/7235066/diff/3/src/pkg/net/ipsock_plan9.go#newcode154 src/pkg/net/ipsock_plan9.go:154: f, err := os.OpenFile(l.dir+"/listen", os.O_RDONLY|syscall.O_CANBLOCK, 0) This is hardly ...
11 years, 2 months ago (2013-01-30 16:14:00 UTC) #2
akumar
Yeah, it can happen from user code as well, and the trade-off is between leaking ...
11 years, 2 months ago (2013-01-30 16:21:46 UTC) #3
akumar
PTAL. Also updated the description.
11 years, 2 months ago (2013-01-30 16:44:56 UTC) #4
rsc
LGTM
11 years, 2 months ago (2013-01-30 17:38:55 UTC) #5
rsc
11 years, 2 months ago (2013-01-30 17:41:21 UTC) #6
*** Submitted as https://code.google.com/p/go/source/detail?r=0e84a5cf4e81 ***

os: don't hold ForkLock across opens on Plan 9

If os.OpenFile holds ForkLock on files that block opens,
then threads that simultaneously try to do fork-exec will
get hung up (until the open succeeds). Blocked opens are
common enough on Plan 9 that protecting against fd leaks
into fork-execs means not being able to do fork-execs
properly in the general case. Thus, we forgo taking the
lock.

R=rsc, ality
CC=golang-dev
https://codereview.appspot.com/7235066

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b