Resumption of CIFS connection after suspend

Forum › Forums › General › Software › Resumption of CIFS connection after suspend

  • This topic has 4 replies, 2 voices, and was last updated Oct 10-4:56 pm by fanantix.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #187172
    fanantix
    Member

      Testing my custom lighting adjustment script, I found that a mounted CIFS share was not reconnecting immediately after wake from suspend. The last of the dmesg log shows:

      [290081.030353] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
      [290083.424426] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
      [290083.424604] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
      [290252.770119] CIFS VFS: Server [x.x.x.x] has not responded in 180 seconds. Reconnecting...

      The share is properly reconnected after that delay. Is there a way to force re-connection immediately after wake (on ‘resume’) in an action script in /etc/pm/sleep.d/?

      #187176
      abc-nix
      Member

        Does this mounted share mount automatically or do you mount it manually? When mounting, you can configure the wait timeout and change it to 10-30 seconds, so you don’t have to wait so much. If mounted automatically (with autofs, for example), you can configure this option. If mounted manually, see how you can add this option to the mounting command.

        Corruption has two hands: the Right and the Left. Don't let them squeeze you.

        #187180
        fanantix
        Member

          Mounted manually as a share:

          sudo mount -t cifs //[x.x.x.x]/Users/ /media/xxx/xxxx -o username=xxx -o password= -o gid=1000 -o uid=1000

          Can I use remount to reconnect immediately?

          #187184
          abc-nix
          Member

            You could first try it manually with remount, and if it works, add it to /etc/pm/sleep.d/50cifs-remount (or some other name)

            #!/bin/sh
            case "$1" in
            	resume)
            		sleep 3 && mount -o remount /media/xxx/xxxx 
            		;;
            esac

            If it doesn’t work, see if you can find a simple command to remount without having to give the password again.

            Corruption has two hands: the Right and the Left. Don't let them squeeze you.

            #187260
            fanantix
            Member

              Thanks, abc-nix. I was unable to get the remount option to force an near-immediate reconnect on the CIFS share; as you suggested, I reduced the echo_interval (from 60 seconds, apparently) to 10 seconds so that dmesg now reports:

              CIFS VFS: Server [x.x.x.x] has not responded in 30 seconds. Reconnecting...

              This delay and the additional network consumption is bearable. The share mount script now contains:

              sudo mount -t cifs //[x.x.x.x]/Users/ /media/xxx/xxxx -o username=xxx,password=,gid=1000,uid=1000,echo_interval=10

              Thanks again.

              • This reply was modified 11 months, 3 weeks ago by fanantix.
            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.