[Sheepdog] [PATCH] sheep: avoid calling get_vnode_info() against force operations

Liu Yuan namei.unix at gmail.com
Sat May 5 12:05:54 CEST 2012


On 05/04/2012 02:53 AM, MORITA Kazutaka wrote:

> The force operations can be processed before we set up
> current_vnode_info.  For example, when we start the cluster, sheep
> daemons can receive SD_OP_READ_VDIS requests from other nodes before
> setting current_vnode_info.  So the force operations shouldn't access
> req->vnodes in their process_work() and process_main().
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at gmail.com>
> ---
>  sheep/sdnet.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/sheep/sdnet.c b/sheep/sdnet.c
> index 1e001af..f59b1ff 100644
> --- a/sheep/sdnet.c
> +++ b/sheep/sdnet.c
> @@ -297,7 +297,14 @@ static void queue_request(struct request *req)
>  		break;
>  	}
>  
> -	req->vnodes = get_vnode_info();
> +	/*
> +	 * force operations shouldn't access req->vnodes in their
> +	 * process_work() and process_main() because they can be
> +	 * called before we set up current_vnode_info
> +	 */
> +	if (!is_force_op(req->op))
> +		req->vnodes = get_vnode_info();
> +
>  	if (is_io_op(req->op)) {
>  		req->work.fn = do_io_request;
>  		req->work.done = io_op_done;



Well, on the second look, free_request() calls put_vnode_info()... it
seems that we have to call get_vnode_info() for every request queuing, no?

Thanks,
Yuan



More information about the sheepdog mailing list