[Samba] Partially transferred files keep locked for a while after client disconnected ungracefully

赵培 zhaopei05 at gmail.com
Mon Apr 16 21:22:33 MDT 2012


Hi Experts,

When copying a big file from Windows to a Samba share working with the
normal TDB mode rather than CTDB mode, the Windows client disconnected from
the network ungracefully such as cable unplugging or network disabling.
Then, try to delete the partial transferred file from another client, we
will be prompted that another program is using this file. The lock can be
easily observed by smbstatus as follows:

Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock
SharePath   Name   Time
--------------------------------------------------------------------------------
------------------
30142        10500      DENY_ALL   0x30196     WRONLY     EXCLUSIVE+BATCH
/vx/fs0   3G_File   Wed Apr 11 23:14:53 2012

After a while (approximately 20 minutes), the lock was cleared by
Samba and the file can be accessed again.

*My question is whether there is any config item to set this lock
timeout period and why this doesn't happen to CTDB?*

BTW, I've already done some research and below is some findings:

1. 'veto oplock files', even setting 'oplocks = no' couldn't solve it.

2. 'reset on zero vc = yes' seems most close to what we want. But it only
kills other connections coming from the same IP.

3. 'deadtime' only takes effect if the number of open files is zero. The
ungracefully disconnection leaves the file open. So this doesn't work
either.


Thank you in advance!


Regards,

Pei


More information about the samba mailing list