-
-
Notifications
You must be signed in to change notification settings - Fork 605
Description
As already noticed long ago in commit 907e633, our VFS implementation (copied from Prex) has a serious problem in vfs_file::read() and vfs_file::write(): These unduely hold the vnode lock for the entire duration of read() or write call.
In commit 907e633, we noticed one bad result of this fact: While one thread is blocked read()ing from /dev/console, another thread cannot write() to it! This is completely broken behavior, and the aforementioned commit just worked around it (not open /dev/console) instead of fixing it.
Today, the same bug is causing us slowdown in multi-cpu Cassandra runs: Multiple threads hold several fd's pointing to the same on-disk file, and doing lseek(); read() on those fd's concurrently. Because we hold the vnode lock throughout the entire read() call, we basically serialize the calls to read() instead of doing much of the work in parallel (and batching I/O).