[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A48E9EB.9080803@kernel.org>
Date: Tue, 30 Jun 2009 01:20:59 +0900
From: Tejun Heo <tj@...nel.org>
To: Miklos Szeredi <miklos@...redi.hu>
CC: linux-kernel@...r.kernel.org, fuse-devel@...ts.sourceforge.net,
akpm@...ux-foundation.org, npiggin@...e.de
Subject: Re: [PATCH 2/4] FUSE: make request_wait_answer() wait for ->end()
completion
Hello, Miklos.
Miklos Szeredi wrote:
> On Thu, 18 Jun 2009, Tejun Heo wrote:
>> Previously, a request was marked FINISHED before ->end() is executed
>> and thus request_wait_answer() can return before it's done. This
>> patch makes request_wait_answer() wait for ->end() to finish before
>> returning.
>
> Why is this change needed?
Direct mmap implementation manages fds in the server process using the
end() callback. After each command which needs to manipulate server
fds in some way, the end callback is responsible for doing it and
communicating what happened to the client side which is executing
fuse_file_direct_mmap(), so it needs to wait for end to complete
before proceeding.
>> spin_unlock(&fc->lock);
>> - wake_up(&req->waitq);
>> - if (end)
>> +
>> + if (end) {
>> end(fc, req);
>> + smp_wmb();
>
> Why is this barrier needed?
To separate the changes end() made from setting FUSE_REQ_FINISHED.
The corresponding wait is in wait_answer_interruptible() and the
corresponding barrier is rmb() implied by spin_lock(&fc->lock) in that
function. ie. the barrier makes sure that when
wait_event_interruptible() exits the waiting state because state
equals FUSE_REQ_FINISHED, the caller is guaranteed to see the changes
made by end().
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists