Search code examples
bitbucketrhelrhel7rhel6

unable to lock a file in RHEL6.4


Trying to lock a file in RHEL but seeing following issue

Stopped the services

service rpcbind stop service nfslock stop rm -rf /var/lib/nfs/statd/sm/* rm -rf /var/lib/nfs/statd/sm.bak/* service rpcbind start service nfslock start

After this I'm using C program mentioned in https://community.microfocus.com/microfocus/cobol/net_express__server_express/w/knowledge_base/6215/c-program-to-validate-nfs-locking-ability to :-

• Open File(Create)

• Lock File

• Close File

But seeing below errors [root@mywebappsserver shared]$ ./nfs_lock FATAL ERROR: Could not lock file

Even after restarting rpcbind and nfslock not seeing any entry under # ls -l /var/lib/nfs/statd/sm/

Need your help in same


Solution

  • Fixed it after changing /var/lib permissions

    Before:-

    ls -ld lib

    drwx------. 34 root root 4096 Jul 7 08:32 lib After:-

    ls -ld lib

    drwxr-xr-x. 34 root root 4096 Jul 7 08:32 lib