Unlock a shared file on NetApp CIFS

We had a ticket come in regarding an Excel file which was complaining that it was “locked for editing” by a user whenever anyone (including that user) tried to open it. There were no temp Excel files in the directory container and user had already rebooted their workstation and cleared out temp windows cache.

First thing I did was open Computer Management and connect to the filer. I looked at the list of open files and didn’t see the file listed as being open.

Next thing I did was ssh into the filer and issue a lock status command:

lock status -f "/vol/Share/folder/file.xlsx" -p cifs  

This produced results back. And indeed, it was indicating the user had a lock on the file.

To unlock:

Data ONTAP 7-mode:
lock break -f "/vol/Share/folder/file.xlsx" -p cifs  
Clustered Data ONTAP:
::> vserver locks show

Notice: Using this command can impact system performance. It is recommended that you specify both the vserver and the volume when issuing this command to minimize the scope of the command’s operation. To abort the command, press Ctrl-C.

Change to advanced mode:

::> set advanced

Perform a break for that client:

::*> vserver locks break -vserver vservername -volume volname -lif lifname -path pathtofile

Warning: Breaking file locks can cause applications to become unsynchronized and might lead to data corruption. If you are breaking a file lock on a volume that is being accessed by a FlexCache you must take the volume offline on the FlexCache to reestablish proper delegation synchronization between the origin and the cache.

Leave a Reply

Your email address will not be published. Required fields are marked *