Excel reports files in read only mode after recovering from sleep

sharedfolders

(Istvan) #1

NethServer Version: 7.4.1708

Hello,

We have two shares where users keep some Excel files. If a computer enters in sleep mode while an Excel file is opened from the Samba share, when is waked up it says the Excel file is in read-only mode because is already opened by “user X”, where “user X” is the user of the computer. If I restart the Samba service everything is back to normal.
Do you know a way how can I prevent file locks in Samba?

Istvan


(Markus Neuberger) #2

Which Excel version(s) do you use? I see basically two approaches: Change the Excel way to save (cached) files or change Samba way to lock files. I tend to the first choice.

I did some research and found:

https://social.technet.microsoft.com/Forums/lync/en-US/3e3c9aad-3164-452a-9832-9ea9a2477936/excel-2013-set-all-file-readonly-for-user-on-network-drive?forum=excel

I’ll try to reproduce your issue…


(Istvan) #3

We have Excel 2016 with Windows 10.


(Markus Neuberger) #4

I tried it now (Win 10 Client, Excel 2016, fully updated NS4 AD Server) with a guest share and it worked after wake up. Did you set some ACLs on the share or do you already use custom templates as regards samba?


(Giacomo Sanchietti) #5

You should also check if something went wrong during the boot.

Is the whole root filesystem mounted in read-only mode?
You can see it by executing the mount command.


(Istvan) #6

What is a “fully updated NS4 AD Server” ?
The shares are guest enabled. There are no custom templates. Everything the default.


(Istvan) #7

Restarting Samba unlocks the files.


(Michael Träumner) #8

Nethserver Samba 4 Active Directory with all updates installed.


(Istvan) #9

I can confirm this.


(Markus Neuberger) #10

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

(Marc) #11

Side note: That reminds me of


(Istvan) #12

This is very useful info. I will test it and let you know the results.

Thank you!