SMB oplock not recalled when there is a request from NFS
Cache delegations via SMB ("oplocks") are meant to be coherent with NFS cache delegations. However, when illumos 11016 (SMB2 oplock leases) went in, the mechanism implementing that coordination was accidentally dropped.
Without the fix, cache delegations could lead to cache incoherency. For example, if an SMB cache delegation (a.k.a. SMB oplock) were to be left in effect when it should have been recalled, that could result in an SMB client overwriting data written from NFS or a local process, once the SMB client writes back it's cache. Only multi-protocol cases are affected, or protocol vs. local access. Using SMB exclusively, or NFS exclusively, both avoid this defect.
Import this commit from GitHub.com/Nexenta/illumos-nexenta
commit 3afddaed30a19c57d474ecb7e358181f7eba5274 Author: Gordon Ross <firstname.lastname@example.org> Date: Wed Aug 26 17:48:44 2020 +0000 FIR-521 SMB oplock not recalled when there is a request from NFS Reviewed by: Prashanth Badari <email@example.com> Reviewed by: Suresh Jayaraman <firstname.lastname@example.org> 3 1 usr/src/cmd/smbsrv/testoplock/smbsrv/smb_kproto.h 12 1 usr/src/cmd/smbsrv/testoplock/tol_main.c 48 7 usr/src/uts/common/fs/smbsrv/smb_cmn_oplock.c
Updated by Gordon Ross 2 months ago
Run a network capture on port 445.
Run smbtorture under a debugger, and set a breakpoint in smb2_util_close
Run the smbtorture command "smb2.lease.request" (it will stop at the breakpoint)
With an NFS client (or even local access) append some data to the file
Let smbtorture continue. (it may complain about a lease break)
Stop the capture and examine.
There should be a lease break after the NFS modification.
As an example capture, see frame 27 in lease-nfs.snoop
Updated by Electric Monk about 2 months ago
- Status changed from Pending RTI to Closed
- % Done changed from 0 to 100
commit e8754e84740733dd9f21c60b5a5ac47d32dacb6b Author: Gordon Ross <email@example.com> Date: 2022-08-09T20:23:36.000Z 14866 SMB oplock not recalled when there is a request from NFS Reviewed by: Prashanth Badari <firstname.lastname@example.org> Reviewed by: Suresh Jayaraman <email@example.com> Reviewed by: Jerry Jelinek <firstname.lastname@example.org> Reviewed by: Garrett D'Amore <email@example.com> Reviewed by: Matt Barden <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>