How to break a hung lock in NetApp ONTAP 9

If the reason you need to close locked files is to stop the whole CIFS server, then there are different instructions.  If you are just trying to recover a file that has a stuck lock, this should help.

If you are familiar with Window file servers, the NetApp CIFS server works the same way.  You can connect to it with the File Sharing MMC tool in Windows.  The user you are logged into Windows as needs to have Administrator rights on the File Share.

Start->Run->mmc

In the MMC

File->Add/Remove Snap-In->Shared Folders->Add

Select “Another Computer” and enter the name of the vServer.

You can leave “All” selected.

Click “Okay”

Navigate to “Open Files”

Find the file that is locked

Right-Click on the file and choose “Close Open File”

This will fix a locked file issue most of the time.

To close the file in the ONTAP Command Line, it is a lot more complicated.

You need to know the vServer Name (file server)

You need to know the Volume Name (usually the share name)

It helps to know the whole path to the file.

Login to the ONTAP Command Line

To show ALL locks (lots of output)

vserver locks show -protocol cifs

To show all locks on one vserver

vserver locks show -protocol cifs -vserver [vservername]

To show all locks on a specific volume and or path

vserver locks show -protocol cifs -vserver [vservername] -volume [volumeName}-path [ontapPathToFile]

Example

vserver locks show -vserver wdl-svm-management -volume wdl_files

wdl-ontap1::> vserver locks show -vserver wdl-svm-management -volume wdl_files  -protocol cifs                                                       
Vserver: wdl-svm-management
Volume   Object Path               LIF         Protocol  Lock Type   Client
-------- ------------------------- ----------- --------- ----------- ----------
wdl_files
         /wdl_files/               wdl-svm-management_cifs_lif1
                                               cifs      share-level 10.0.10.210
                Sharelock Mode: read-deny_none
                                                                     10.0.10.209
                Sharelock Mode: read-deny_none
         /wdl_files/home/Administrator/Security/Certificates/CAs
                                   wdl-svm-management_cifs_lif1
                                               cifs      share-level 10.0.10.209
                Sharelock Mode: read-deny_none
         /wdl_files/home/Administrator/Security/Certificates/CAs/LAB-PDX-DC-01-CA
                                   wdl-svm-management_cifs_lif1
                                               cifs      share-level 10.0.10.209
                Sharelock Mode: read-deny_none
4 entries were displayed.

To break a lock, use the break command and the full path from the output above

vserver locks break -vserver [vservername] -volume [volumename] -path [full_path]

Example:

wdl-ontap1::> vserver locks break -vserver wdl-svm-management -volume wdl_files -path /wdl_files/home/Administrator/Security/Certificates/CAs/LAB-PDX-DC-01-CA

Warning: Breaking file locks can cause applications to become unsynchronized and may lead to data corruption.
Do you want to continue? {y|n}: y
1 entry was acted on.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: