Project

General

Profile

Actions

Bug #14866

closed

SMB oplock not recalled when there is a request from NFS

Added by Gordon Ross 14 days ago. Updated 4 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cifs - CIFS server and client
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

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.

Fix is:
Import this commit from GitHub.com/Nexenta/illumos-nexenta

commit 3afddaed30a19c57d474ecb7e358181f7eba5274
Author: Gordon Ross <gordon.ross@tintri.com>
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 <prbadari@tintri.com>
    Reviewed by: Suresh Jayaraman <sjayaraman@tintri.com>

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

Files

lease-nfs.snoop (6.52 KB) lease-nfs.snoop Gordon Ross, 2022-07-30 03:40 PM
Actions #1

Updated by Electric Monk 14 days ago

  • Gerrit CR set to 2272
Actions #2

Updated by Gordon Ross 14 days ago

Testing:

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
//testshare/lease_request.dat
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

Actions #3

Updated by Gordon Ross 14 days ago

  • Status changed from New to In Progress
Actions #4

Updated by Gordon Ross 14 days ago

  • Category set to cifs - CIFS server and client
Actions #5

Updated by Gordon Ross 4 days ago

  • Description updated (diff)
  • Status changed from In Progress to Pending RTI
Actions #6

Updated by Gordon Ross 4 days ago

  • Description updated (diff)
Actions #7

Updated by Electric Monk 4 days ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit e8754e84740733dd9f21c60b5a5ac47d32dacb6b

commit  e8754e84740733dd9f21c60b5a5ac47d32dacb6b
Author: Gordon Ross <gordon.ross@tintri.com>
Date:   2022-08-09T20:23:36.000Z

    14866 SMB oplock not recalled when there is a request from NFS
    Reviewed by: Prashanth Badari <prbadari@tintri.com>
    Reviewed by: Suresh Jayaraman <sjayaraman@tintri.com>
    Reviewed by: Jerry Jelinek <gjelinek@gmail.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Reviewed by: Matt Barden <mbarden@tintri.com>
    Approved by: Dan McDonald <danmcd@mnx.io>

Actions

Also available in: Atom PDF