Re: [PATCH] SUNRPC: Clear xpt_bc_xprt if xs_setup_bc_tcp failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/2014 01:01 PM, Trond Myklebust wrote:
> 
> On Jan 6, 2014, at 23:41, Kinglong Mee <kinglongmee@xxxxxxxxx> wrote:
> 
>> If try_module_get failed, xpt_bc_xprt should be set to NULL,
>> because xprt will be free.
>>
>> Don't needed using xprt_put to free xprt, because it is always new.
>>
>> Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
>> ---
>> net/sunrpc/xprtsock.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
>> index 4fcdf74..5ed124f 100644
>> --- a/net/sunrpc/xprtsock.c
>> +++ b/net/sunrpc/xprtsock.c
>> @@ -2986,10 +2986,10 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
>> 	 */
>> 	xprt_set_connected(xprt);
>>
>> -
>> 	if (try_module_get(THIS_MODULE))
>> 		return xprt;
>> -	xprt_put(xprt);
>> +
>> +	args->bc_xprt->xpt_bc_xprt = NULL;
>> 	ret = ERR_PTR(-EINVAL);
>> out_err:
>> 	xs_xprt_free(xprt);
> 
> 
> Just move the 'args->bc_xprt->xpt_bc_xprt = xprt’ line into the caller 
> (see earlier discussion about xs_setup_bc_tcp()).
> Quite frankly, I don’t see why the client code should be modifying this variable in the first place.
> An svc_xprt is a server construct.

That's really better.

I will check those codes for NFSv4.1 backchannel in sunrpc, 
maybe I will cleanup the client code from svc_xprt.

thanks,
Kinglong Mee


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux