You can check the status of locked files with
smbstatus -L
With an open test.xls file in //server/scan
my output looks like this:
[root@server ~]# smbstatus -L
Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
7020 1136001107 DENY_WRITE 0x13019f RDWR LEASE(RWH) /var/lib/nethserver/ibay/scan ~$test.xlsx Tue Feb 20 13:28:14 2018
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 12:44:18 2018
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 12:45:07 2018
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 13:01:39 2018
7020 1136001107 DENY_WRITE 0x12019f RDWR LEASE(RWH) /var/lib/nethserver/ibay/scan test.xlsx Tue Feb 20 13:28:14 2018
You can see that the xls file is locked DENY_WRITE. If I kill Excel now or send my PC to sleep the lock is just away and only the folder is locked anymore:
[root@server ~]# smbstatus -L
Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 12:44:18 2018
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 12:45:07 2018
7020 1136001107 DENY_NONE 0x100081 RDONLY NONE /var/lib/nethserver/ibay/scan . Tue Feb 20 13:01:39 2018