Remove locked files on a NetApp filer

In this post we’ll see how to find and remove locked files on a
NetApp filer.

It may happen sometimes that an application that depends on a shared
storage is not starting up or not even working properly. Most of the
times this is caused by locked files on the shared storage and here we
will see how to remove them.

Our setup consists of one NetApp filer with a volume that is exported
over CIFS, which in turn is mounted on a Windows(R) client machine.

First login to the NetApp filer over SSH using account that has
administrative privileges:

$ ssh root@netapp.examle.org

Once logged in on the NetApp filer, lets see the currently locked
files:

netapp> lock status -p cifs

The above command will show you the locked files on the NetApp filer
which are using the CIFS protocol.

And here’s the output we got after executing the above command on the
NetApp filer:

From the above output we can see the locks of the different files,
which are using the CIFS protocol. You are also able to filter the
lock files by specifying the hostname of a machine that is supposed to
hold a locked file or even specify different protocols.

For more information on the supported options by the lock command
execute this:

netapp> lock help

Once you’ve found the locked file that needs to be released, you can
do so by executing the command below:

netapp> lock break-f </vol/path/to/file> -p cifs

This is how for example we can release the lock of the log-file.log
file: