NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

BtrieveBill's avatar
BtrieveBill
Aspirant
Aug 09, 2021
Solved

How do I reset a Windows File Sharing Session to close open files?

Like most of you, I assume, I use a ReadyNAS 516 to store a ton of data.  In my case, this also includes my users' Email profiles, which allows them to acecss their Email from any computer on the LAN (through Thunderbird).

 

Every once in a while, a computer crashes.  <Sarcasm>Gee, Windows 10 -- who'd have ever thunk THAT would happen?</Sarcasm>  When this happens, the Thunderbird Profile lock file is still being held open on the ReadyNAS even after the computer has rebooted, which prevents the newly-rebooted computer (or any other computer on the LAN, in fact) from accessing that Email profile until that file lock clears. In Windows, this is easy -- go to the Open Files screen and kill the dead connection, but I can't seem to find a way to do this on the ReadyNAS.

 

I suspect that the 2-hour TCP watchdogger will eventually clear out the latent connection, but I often can't wait that long to get to my Email.  I also don't want to simply reboot the ReadyNAS, because that will also kick off all of the other users as well, and everyone would have to restart their Email software, along with any other processes leveraging open files on the NAS.

 

So, my question is simply this: How can I close all open files from a single, presumed-dead, connection, without closing ALL open files for all other users?


  • BtrieveBill wrote:

     

    So, my question is simply this: How can I close all open files from a single, presumed-dead, connection, without closing ALL open files for all other users?


    You should be able to do it using ssh.

     

    smbstatus will give you the list of locked files at the end of the status info.  Each entry starts with the process ID (pid) that has that file open.  You find the file you want to forcibly close, and then kill the corresponding pid using kill.  Killing the process will close all files opened by that pid.

     

    You can reduce the amount of output using smbstatus | grep -i xxxx  - in your case, using the profile name (or a reasonably long part of it).

2 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    BtrieveBill wrote:

     

    So, my question is simply this: How can I close all open files from a single, presumed-dead, connection, without closing ALL open files for all other users?


    You should be able to do it using ssh.

     

    smbstatus will give you the list of locked files at the end of the status info.  Each entry starts with the process ID (pid) that has that file open.  You find the file you want to forcibly close, and then kill the corresponding pid using kill.  Killing the process will close all files opened by that pid.

     

    You can reduce the amount of output using smbstatus | grep -i xxxx  - in your case, using the profile name (or a reasonably long part of it).

    • BtrieveBill's avatar
      BtrieveBill
      Aspirant

      You are awesome, man!  Being an old command-line guy from too long ago to remember, this is exactly what I needed. 

       

      I just wish that NetGear had the foresight to understand that Windows machines do crash from time to time, and making an open file or connection list available from the GUI (along with a way to clear them out) is also important.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More