Re: [PATCH] cifs: set socket send and receive timeouts before attempting connect

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

 



On Thu, Jun 9, 2011 at 8:56 AM, Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> On Thu,  9 Jun 2011 09:53:43 -0400
> Jeff Layton <jlayton@xxxxxxxxxx> wrote:
>
>> Benjamin S. reported that he was unable to suspend his machine while
>> it had a cifs share mounted. The freezer caused this to spew when he
>> tried it:
>> We do attempt to perform a try_to_freeze in cifs_reconnect, but the
>> connection attempt itself seems to be taking longer than 20s to time
>> out. The connect timeout is governed by the socket send and receive
>> timeouts, so we can shorten that period by setting those timeouts
>> before attempting the connect instead of after.
>>
>> Adam Williamson tested the patch and said that it seems to have fixed
>> suspending on his laptop when a cifs share is mounted.
>>
>> Reported-by: Benjamin S <da_joind@xxxxxxx>
>> Tested-by: Adam Williamson <awilliam@xxxxxxxxxx>
>> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
>> ---
>>  fs/cifs/connect.c |   16 ++++++++--------
>>  1 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
>> index 61ed0ba..4ec9630 100644
>> --- a/fs/cifs/connect.c
>> +++ b/fs/cifs/connect.c
>> @@ -2471,14 +2471,6 @@ generic_ip_connect(struct TCP_Server_Info *server)
>>       if (rc < 0)
>>               return rc;
>>
>> -     rc = socket->ops->connect(socket, saddr, slen, 0);
>> -     if (rc < 0) {
>> -             cFYI(1, "Error %d connecting to server", rc);
>> -             sock_release(socket);
>> -             server->ssocket = NULL;
>> -             return rc;
>> -     }
>> -
>>       /*
>>        * Eventually check for other socket options to change from
>>        * the default. sock_setsockopt not used because it expects
>> @@ -2507,6 +2499,14 @@ generic_ip_connect(struct TCP_Server_Info *server)
>>                socket->sk->sk_sndbuf,
>>                socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo);
>>
>> +     rc = socket->ops->connect(socket, saddr, slen, 0);
>> +     if (rc < 0) {
>> +             cFYI(1, "Error %d connecting to server", rc);
>> +             sock_release(socket);
>> +             server->ssocket = NULL;
>> +             return rc;
>> +     }
>> +
>>       if (sport == htons(RFC1001_PORT))
>>               rc = ip_rfc1001_connect(server);
>>
>> --
>> 1.7.5.2
>>
>
> Doh! I meant to mark this for stable too as I think it's probably
> reasonable for that. Steve, would you add "Cc: stable@xxxxxxxxxx" if
> you agree?

yes


-- 
Thanks,

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


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux