[sheepdog] [PATCH] lib/net: fix CMD_FILTER branch never reached

Ruoyu liangry at ucweb.com
Tue Jul 29 08:25:09 CEST 2014


Please ignore this mail and I will submit another patch very soon 
advised by Yuan.


On 2014年07月29日 09:47, Ruoyu wrote:
> In the previous patch, SD_FLAG_CMD_FILTER is introduced. It should operate
> both writing and reading, and what the client read is the subset of what
> it write. Therefore, for least modification, SD_FLAG_CMD_FILTER is set to 0x11
> (SD_FLAG_CMD_WRITE is 0x01).
>
> The problem is, the previous patch does not handle it correctly. CMD_FILTER
> should be checked first.
>
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>   lib/net.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lib/net.c b/lib/net.c
> index 552e945..5a86107 100644
> --- a/lib/net.c
> +++ b/lib/net.c
> @@ -331,12 +331,13 @@ int exec_req(int sockfd, struct sd_req *hdr, void *data,
>   	struct sd_rsp *rsp = (struct sd_rsp *)hdr;
>   	unsigned int wlen, rlen;
>   
> -	if (hdr->flags & SD_FLAG_CMD_WRITE) {
> -		wlen = hdr->data_length;
> -		rlen = 0;
> -	} else if (hdr->flags & SD_FLAG_CMD_FILTER) {
> +	/* filter(0x11) contains write(0x01), must check it first */
> +	if (hdr->flags & SD_FLAG_CMD_FILTER) {
>   		wlen = hdr->data_length;
>   		rlen = hdr->data_length;
> +	} else if (hdr->flags & SD_FLAG_CMD_WRITE) {
> +		wlen = hdr->data_length;
> +		rlen = 0;
>   	} else {
>   		wlen = 0;
>   		rlen = hdr->data_length;





More information about the sheepdog mailing list