【ceph研发】ceph+nfs-ganesha异步读写git历史记录

ceph+nfs-ganesha异步读写git历史记录

1. client: unlock client_lock when copying data and do more check for the client_lock

2. Client: C_Read_Async_Finisher should assume client_lock is held

3. client: handle context completion during async I/O call when the client is not mounting [2023年12月4日]

4. client: handle callback when async io fails #54690 [2023年11月28日]

 

this refinement gets rid of the rw lock in the I/O path and provides a bit
more fairness to open/upgrade/downgrade/close and uses dec_and_lock to
better prevent spurious wakeup due to a race that is not habdled above
increment io_work.

if fd_work != 0
	lock mutex
	if fd_work != 0
		// fd work is waiting, block until it's done
		if decrement io_work == 0
			signal condition var
		while fd_work != 0
			wait on condition var
		// we are done waiting for fd work, so resume I/O
		increment io_work
	unlock mutex
// now we know no fd work is waiting or in progress and can't start

initiate I/O
on I/O complete (async or immediate):
-------------------------------------
if decrement_and_lock io_work
	if fd_work != 0
		signal condition var
	unlock mutex

open/upgrade/downgrade/close:
-----------------------------
increment fd_work
lock mutex
while io_work != 0
	// now fd_work is non-zero and io_work is zero, any I/O that
	// tries to start will block until fd_work goes to zero
	wait on cond var
// io_work was zero, and because we checked while holding the mutex, but made
// fd_work non-zero before taking the mutex any I/O threads that try to start
// after we took the mutex MUST be blocked, proceed
unlock mutex
// serialize any open/upgrade/downgrade/close
take write lock
re-open fd in new mode or close it
release write lock
// now ready to allow I/O to resume
if decrement_and_lock fd_work
	if fd_work == 0
		signal cond var
	unlock mutex

 

posted @ 2018-06-24 21:17  苏格拉底的落泪  阅读(435)  评论(0编辑  收藏  举报