Skip to content

Commit 50afaf3

Browse files
committed
man: document io-wq handling of file system managed locks
The kernel side no longer fails lock requests on files with their own ->flock()/->lock() handling (NFS, FUSE, etc) with -EOPNOTSUPP, instead they are handled via the io_uring async worker pool. Update the io_uring_prep_flock and io_uring_prep_ofd_lock man pages accordingly: document the worker occupancy caveat for contended waits, replace the -EOPNOTSUPP error with -EINTR for signal-interrupted waits, and scope the "no deadlock detection" statement to generic VFS locks, as a file system may implement its own. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent cba634e commit 50afaf3

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

man/io_uring_prep_flock.3

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ of the same file does not), and the lock is released on
7171
or once every file descriptor referring to the open file description has
7272
been closed.
7373
.PP
74-
Only locks managed by the generic VFS locking code are supported. If the
75-
file resides on a file system that implements its own flock handling, such
76-
as NFS, the request fails with
77-
.BR -EOPNOTSUPP .
74+
If the file resides on a file system that implements its own flock
75+
handling, such as NFS or FUSE, the request is handled by the io_uring
76+
async worker pool instead, as even a non-blocking attempt may have to
77+
communicate with a lock server. Such requests behave identically, with
78+
the caveat that each pending request occupies a worker thread for as long
79+
as it waits for a contended lock. If the wait is interrupted by a signal,
80+
the request completes with
81+
.BR -EINTR .
7882
.PP
7983
Available since kernel 7.3.
8084

@@ -108,16 +112,15 @@ not opened for reading or writing.
108112
.B -ECANCELED
109113
The request was cancelled before the lock was acquired.
110114
.TP
115+
.B -EINTR
116+
The wait for a file system managed lock was interrupted by a signal.
117+
.TP
111118
.B -EINVAL
112119
.I flock_op
113120
is not valid, or stray submission queue entry fields were set.
114121
.TP
115122
.B -ENOLCK
116123
The kernel ran out of memory for allocating lock records.
117-
.TP
118-
.B -EOPNOTSUPP
119-
The file has a file system specific flock implementation, which is not
120-
supported.
121124
.SH NOTES
122125
io_uring does not support passing in a timeout for the request. Instead,
123126
applications are encouraged to use a linked timeout to abort the lock

man/io_uring_prep_ofd_lock.3

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,21 @@ and negative lengths are not supported.
100100
.PP
101101
As with
102102
.BR F_OFD_SETLKW ,
103-
lock acquisitions are not subject to deadlock detection, a request will
104-
never fail with
103+
lock acquisitions on locks managed by the generic VFS locking code are not
104+
subject to deadlock detection, a request will never fail with
105105
.BR -EDEADLK .
106106
A request that can never be satisfied remains pending until cancelled.
107107
.PP
108-
Only locks managed by the generic VFS locking code are supported. If the
109-
file resides on a file system that implements its own locking, such as NFS,
110-
the request fails with
111-
.BR -EOPNOTSUPP .
108+
If the file resides on a file system that implements its own locking, such
109+
as NFS or FUSE, the request is handled by the io_uring async worker pool
110+
instead, as even a non-blocking attempt may have to communicate with a
111+
lock server. Such requests behave like the file system's
112+
.BR fcntl (2)
113+
locking does - including any deadlock detection it may implement - with
114+
the caveat that each pending request occupies a worker thread for as long
115+
as it waits for a contended lock. If the wait is interrupted by a signal,
116+
the request completes with
117+
.BR -EINTR .
112118
.PP
113119
Available since kernel 7.3.
114120

@@ -145,6 +151,9 @@ on one not open for writing.
145151
.B -ECANCELED
146152
The request was cancelled before the lock was acquired.
147153
.TP
154+
.B -EINTR
155+
The wait for a file system managed lock was interrupted by a signal.
156+
.TP
148157
.B -EINVAL
149158
.I type
150159
or
@@ -156,10 +165,6 @@ exceeds the maximum file offset.
156165
.B -ENOLCK
157166
The kernel ran out of memory for allocating lock records.
158167
.TP
159-
.B -EOPNOTSUPP
160-
The file has a file system specific lock implementation, which is not
161-
supported.
162-
.TP
163168
.B -EOVERFLOW
164169
.I start
165170
plus

0 commit comments

Comments
 (0)