Skip to content

nfs: deny any concurrent access to a file opened for write - #8255

Merged
chubnastia merged 1 commit into
12.0from
deny-io-on-write-12.0
Oct 16, 2026
Merged

chubnastia merged 1 commit into
12.0from
deny-io-on-write-12.0

Conversation

@kofemann

Copy link
Copy Markdown
Member

Motivation:
dCache design flow allows concurrent writes for a file as long as it in create-only mode. Such a flow typically ends with a two replicas of a file with a same pnfsid, but different contents:

$ python
>>> f1 = open("file.txt", "w")
>>> f2 = open("file.txt", "w")
>>> f1.write("aaaa")
4
>>> f2.write("bbb")
3
>>> f1.close()
>>> f2.close()

Modification:
Enforce share-deny for files opened for write.

Result:

$ python
>>> f1 = open("file.txt", "w")
>>> f2 = open("file.txt", "w")
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    f2 = open("file.txt", "w")
PermissionError: [Errno 13] Permission denied: 'file.txt'

>>> f2 = open("file.txt", "r")
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    f2 = open("file.txt", "r")
PermissionError: [Errno 13] Permission denied: 'file.txt'

Acked-by: Marina Sahakyan
Target: master, 12.0, 11.2
Require-book: no
Require-notes: yes
(cherry picked from commit 5bd6b33)

Motivation:
dCache design flow allows concurrent writes for a file as long as it
in `create-only` mode. Such a flow typically ends with a two replicas of
a file with a same pnfsid, but different contents:

```
$ python
>>> f1 = open("file.txt", "w")
>>> f2 = open("file.txt", "w")
>>> f1.write("aaaa")
4
>>> f2.write("bbb")
3
>>> f1.close()
>>> f2.close()
```

Modification:
Enforce share-deny for files opened for write.

Result:

```
$ python
>>> f1 = open("file.txt", "w")
>>> f2 = open("file.txt", "w")
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    f2 = open("file.txt", "w")
PermissionError: [Errno 13] Permission denied: 'file.txt'

>>> f2 = open("file.txt", "r")
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    f2 = open("file.txt", "r")
PermissionError: [Errno 13] Permission denied: 'file.txt'
```

Acked-by: Marina Sahakyan
Target: master, 12.0, 11.2
Require-book: no
Require-notes: yes
(cherry picked from commit 5bd6b33)
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
@chubnastia
chubnastia merged commit 5c702de into 12.0 Oct 16, 2026
3 checks passed
@chubnastia
chubnastia deleted the deny-io-on-write-12.0 branch October 16, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants