-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
3
-
9223372036854775807
LU-14838 removed lockless truncate, and the client side of contention-based lockless buffered I/O. Two ways to request lockless I/O explicitly are still in master, and both reach buffered I/O.
1. The nolock mount option (LL_SBI_NOLCK)
The flag comment says "DLM locking disabled directio-only", but nothing enforces that. With the option set, ll_file_nolock() is true for every file. ll_io_init() then sets ci_lockreq = CILR_NEVER and ci_no_srvlock = 1, and vvp_io_rw_lock() passes CEF_NEVER, for buffered I/O as well as direct I/O. A buffered write goes through osc_io_commit_async() into the page cache with no client DLM lock and no server-side lock. Only mmap and a few other operations refuse nolock.
2. LL_IOC_SETFLAGS with LL_FILE_IGNORE_LOCK
The ioctl refuses IGNORE_LOCK on a file not opened O_DIRECT, but it checks only when the flag is set. llite has no check_flags(), so fcntl(F_SETFL) can clear O_DIRECT afterwards. Later buffered I/O on that file descriptor is then lockless in the same way.
Both were found by reading the code; neither has been reproduced.
Lockless buffered I/O cannot be kept consistent across clients, for the reasons given in LU-14838. It also breaks an assumption elsewhere. Before lock replay, the no-wait LRU cancel selects only locks with no dirty or writeback pages under them (see LU-20157). A lockless writer can dirty pages under such a lock without ever touching the lock.
For direct I/O these interfaces add nothing useful. Direct I/O is already lockless on the client by default, and these interfaces also drop the server-side lock.
Proposed change
- Stop honouring the nolock mount option. Keep accepting it, so that existing fstab entries still mount, but print a warning that it is ignored and mount with normal locking.
- Remove the LL_IOC_SETFLAGS / LL_IOC_CLRFLAGS handling, and keep both ioctl numbers reserved in lustre_user.h. LL_FILE_IGNORE_LOCK is the only flag a caller can usefully set through them:
- LL_FILE_GROUP_LOCKED is refused.
- LL_FILE_READAHEA and LL_FILE_LOCKED_DIRECTIO are not referenced anywhere in the tree.
- LL_FILE_FLOCK_WARNING is internal state.
Nothing in-tree (lfs, liblustreapi, the test suite) calls either ioctl.
- Remove ll_file_nolock(). Once CILR_NEVER is gone, also remove any lockless handling on the buffered write path that becomes unreachable.
- is related to
-
LU-14838 Remove old lockless code: Truncate & contention based lockless i/o
-
- Resolved
-