SMB + SMB2: Accessing shares return an error after prolonged idle period

Environment
Red Hat Enterprise Linux
6
7
8
SMB
SMB2
Issue
After a period of inactivity, accessing a SMB v1 share returns Permission denied for a user, but not others
After a period of inactivity, accessing a SMB v2+ share returns Input/output error for a user, but not others.
The following error may be returned in the logs: CIFS VFS: Unexpected lookup error -5
Periodically accessing a share avoids the errors.
Shares have to be unmounted and then remounted to regain access.
Resolution
SMB v1
RHEL 6
The ability for the client to recover from this issue will not be improved in Red Hat Enterprise Linux 6. The maximum version supported by the client in Red Hat Enterprise Linux 6 is SMBv1. Please see Workaround section for options.
RHEL7
This issue has been resolved with the errata RHSA-2021:0336 for the package(s) kernel-3.10.0-1160.15.2.el7 or later.
RHEL8
This issue has been resolved with the errata RHSA-2021:1578 for the package(s) kernel-4.18.0-305.el8 or later.
Workaround
Periodically access the SMB share to prevent the session from being closed.
Extend the session length timer on the SMB server.
Use SMB v2+
SMB v2+
RHEL 7.5
This issue has been resolved with the errata RHSA-2018:3459 for the package(s) kernel-3.10.0-862.20.2.el7 or later.
RHEL7
This issue has been resolved with the errata RHSA-2018:3083 for the package(s) kernel-3.10.0-957.el7 or later.
RHEL8
RHEL8 is not impacted by this issue
Root Cause
Historically, RHEL SMB clients did not attempt to reconnect to a SMB server after receiving STATUS_USER_SESSION_DELETED.
The below commit changes RHEL SMB client behavior for SMB v2+ and will force users to reconnect to a SMB server after receiving STATUS_USER_SESSION_DELETED instead of returning Input/output error when the share is accessed.
Raw

https://www.cndba.cn/hbhe0316/article/106563
https://www.cndba.cn/hbhe0316/article/106563
https://www.cndba.cn/hbhe0316/article/106563
From 5ed415cf8a380136312352b9073d71e49548f819 Mon Sep 17 00:00:00 2001
From: Mark Syms <mark.syms@citrix.com>
Date: Thu, 24 May 2018 09:47:31 +0100
Subject: [PATCH] CIFS: 511c54a2f69195b28afb9dd119f03787b1625bb4 adds a check
 for  session expiry, status STATUS_NETWORK_SESSION_EXPIRED, however the
 server can also respond with STATUS_USER_SESSION_DELETED in cases  where the
 session has been idle for some time and the server reaps  the session to
 recover resources.

Handle this additional status in the same way as SESSION_EXPIRED.

Signed-off-by: Mark Syms <mark.syms@citrix.com>
---
 fs/cifs/smb2ops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 7c0edd2..33fa7fc 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1323,10 +1323,11 @@ static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon,
 {
        struct smb2_sync_hdr *shdr = get_sync_hdr(buf);

-       if (shdr->Status != STATUS_NETWORK_SESSION_EXPIRED)
+       if (shdr->Status != STATUS_NETWORK_SESSION_EXPIRED &&
+           shdr->Status != STATUS_USER_SESSION_DELETED)
                return false;

-       cifs_dbg(FYI, "Session expired/n");
+       cifs_dbg(FYI, "Session expired or deleted/n");
        return true;
 }

However, there is currently no transparent recovery for RHEL7 or RHEL8 as noted here. This means that the session will recover, but EAGAIN may be leaked to an application when requesting up-to-date inode information.
Diagnostic Steps
Record client side network traffic when it is accessing the SMB share.

https://www.cndba.cn/hbhe0316/article/106563
https://www.cndba.cn/hbhe0316/article/106563

On an unpatched system, the client is unable to establish a new connection for SMB2.https://www.cndba.cn/hbhe0316/article/106563https://www.cndba.cn/hbhe0316/article/106563

Rawhttps://www.cndba.cn/hbhe0316/article/106563https://www.cndba.cn/hbhe0316/article/106563

https://www.cndba.cn/hbhe0316/article/106563
48 2019-06-14 10:00:31.798107     192.0.2.20 → 192.0.2.10     SMB2 174 Negotiate Protocol Request
49 2019-06-14 10:00:31.798278     192.0.2.10 → 192.0.2.20     SMB2 291 Negotiate Protocol Response
50 2019-06-14 10:00:31.798292     192.0.2.20 → 192.0.2.10     TCP 68 55455 → 445 [ACK] Seq=107 Ack=224 Win=30336 Len=0 TSval=676258257 TSecr=456963500
51 2019-06-14 10:00:31.798319     192.0.2.20 → 192.0.2.10     SMB2 192 Session Setup Request, NTLMSSP_NEGOTIATE
52 2019-06-14 10:00:31.798476     192.0.2.10 → 192.0.2.20     SMB2 386 Session Setup Response, Error: STATUS_MORE_PROCESSING_REQUIRED, NTLMSSP_CHALLENGE
53 2019-06-14 10:00:31.798527     192.0.2.20 → 192.0.2.10     SMB2 484 Session Setup Request, NTLMSSP_AUTH, User: admin
54 2019-06-14 10:00:31.798698     192.0.2.10 → 192.0.2.20     SMB2 144 Session Setup Response
55 2019-06-14 10:00:31.798726     192.0.2.20 → 192.0.2.10     SMB2 232 Tree Connect Request Tree: //cifs_server/shared_data
56 2019-06-14 10:00:31.798835     192.0.2.10 → 192.0.2.20     SMB2 145 Tree Connect Response, Error: STATUS_USER_SESSION_DELETED
57 2019-06-14 10:00:31.798859     192.0.2.20 → 192.0.2.10     SMB2 140 Session Logoff Request
58 2019-06-14 10:00:31.798980     192.0.2.10 → 192.0.2.20     SMB2 145 Session Logoff Response, Error: STATUS_USER_SESSION_DELETED
The communication finishes with the error STATUS_USER_SESSION_DELETED
``` which is described in the protocol as:

Raw
STATUS_USER_SESSION_DELETED - The user session specified by the client has been deleted on the server.
A patched system shows that the SMB client creates a new session after receiving STATUS_USER_SESSION_DELETED
Raw

```shell
$ tshark -tad -n -r deleted_session.pcap -Y 'smb2 && frame.number in {836..898}'
  836 2021-02-03 14:40:52.146720 192.0.2.159 → 192.0.2.132 SMB2 168 Find Request File:  SMB2_FIND_ID_FULL_DIRECTORY_INFO Pattern: *
  837 2021-02-03 14:40:52.147087 192.0.2.132 → 192.0.2.159 SMB2 143 Find Response, Error: STATUS_NO_MORE_FILES SMB2_FIND_ID_FULL_DIRECTORY_INFO Pattern: *
  838 2021-02-03 14:40:52.149082 192.0.2.159 → 192.0.2.132 SMB2 158 Close Request File: 
  839 2021-02-03 14:40:52.149443 192.0.2.132 → 192.0.2.159 SMB2 194 Close Response
  857 2021-02-03 14:41:08.910419 192.0.2.159 → 192.0.2.132 SMB2 198 Create Request File: 
  858 2021-02-03 14:41:08.911356 192.0.2.132 → 192.0.2.159 SMB2 143 Create Response, Error: STATUS_USER_SESSION_DELETED
  865 2021-02-03 14:41:08.920313 192.0.2.159 → 192.0.2.132 SMB2 172 Negotiate Protocol Request
  867 2021-02-03 14:41:08.923798 192.0.2.132 → 192.0.2.159 SMB2 318 Negotiate Protocol Response
  872 2021-02-03 14:41:08.934015 192.0.2.159 → 192.0.2.132 SMB2 80 Session Setup Request
  874 2021-02-03 14:41:08.936261 192.0.2.132 → 192.0.2.159 SMB2 164 Session Setup Response
  875 2021-02-03 14:41:08.936333 192.0.2.159 → 192.0.2.132 SMB2 216 Tree Connect Request Tree: //win2k16-dfs1.example.net/greendale
  876 2021-02-03 14:41:08.936776 192.0.2.132 → 192.0.2.159 SMB2 150 Tree Connect Response
  877 2021-02-03 14:41:08.938886 192.0.2.159 → 192.0.2.132 SMB2 206 Tree Connect Request Tree: //win2k16-dfs1.example.net/IPC$
  878 2021-02-03 14:41:08.939305 192.0.2.132 → 192.0.2.159 SMB2 150 Tree Connect Response
  880 2021-02-03 14:41:08.947958 192.0.2.159 → 192.0.2.132 SMB2 80 Session Setup Request
  882 2021-02-03 14:41:08.949369 192.0.2.132 → 192.0.2.159 SMB2 164 Session Setup Response
  883 2021-02-03 14:41:08.949424 192.0.2.159 → 192.0.2.132 SMB2 216 Tree Connect Request Tree: //win2k16-dfs1.example.net/greendale
  884 2021-02-03 14:41:08.949803 192.0.2.132 → 192.0.2.159 SMB2 150 Tree Connect Response
  885 2021-02-03 14:41:08.950196 192.0.2.159 → 192.0.2.132 SMB2 206 Tree Connect Request Tree: //win2k16-dfs1.example.net/IPC$
  886 2021-02-03 14:41:08.950651 192.0.2.132 → 192.0.2.159 SMB2 150 Tree Connect Response
  895 2021-02-03 14:41:10.040311 192.0.2.159 → 192.0.2.132 SMB2 198 Create Request File: 
  896 2021-02-03 14:41:10.040949 192.0.2.132 → 192.0.2.159 SMB2 222 Create Response File: 
  898 2021-02-03 14:41:10.048646 192.0.2.159 → 192.0.2.132 SMB2 174 GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO File:

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
WebAssembly: Accessing C and C++ in Web Applications English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 1h 45m | 213 MB Accelerate web applications with native code using WebAssembly. WebAssembly is a new, revolutionary technology that allows developers to program webpages using popular high-level languages like C, C++, Rust, and Python. Code is then compiled to WebAssembly bytecode and implemented by the JavaScript engine built into all web browsers. You gain flexibility and functionality without sacrificing performance. This course focuses on the practical uses of the technology: converting C and C++ code to WebAssembly and executing WebAssembly in JavaScript. Programmer and engineer Matt Scarpino demonstrates the power of the WebAssembly, implementing quick sort and matrix multiplication algorithms. He also reviews advanced features, such as debugging and the WebAssembly text format. By the end of the course, you’ll understand the massive potential WebAssembly represents and be ready to implement it in your next web project. Topics include: Programming for WebAssembly with Enscripten Building projects with enmake Loading WebAssembly into JavaScript Calling JavaScript in WebAssembly Practical algorithms for WebAssembly apps Analyzing WebAssembly apps Table of Contents Introduction 1 Accelerate your web applications with WebAssembly 2 What you should know 3 Using the exercise files WebAssembly and Emscripten 4 Overview of WebAssembly 5 Installing Emscripten 6 Installation walk-through 7 Compilation and execution 8 Simple WebAssembly example 9 Building projects with emmake 10 Emscripten makefile example WebAssembly Development 11 Loading WebAssembly into JavaScript 12 Loading WebAssembly example 13 Calling JavaScript in WebAssembly 14 Calling JavaScript example 15 Memory objects 16 Memory object example Practical Algorithms in WebAssembly 17 Introduction to quicksort 18 Implementing quicksort in WebAssembly 19 Introduction to matrix operations 20 Managing matrice
Java 核心技术 卷1 Index Chapter 1: An Introduction to Java 1 Java As a Programming Platform 2 The Java “White Paper” Buzzwords 2 Java Applets and the Internet 7 A Short History of Java 9 Common Misconceptions about Java 11 Chapter 2: The Java Programming Environment 15 Installing the Java Development Kit 16 Choosing a Development Environment 21 Using the Command-Line Tools 22 Using an Integrated Development Environment 25 Running a Graphical Application 28 Building and Running Applets 31 Chapter 3: Fundamental Programming Structures in Java 35 A Simple Java Program 36 Comments 39 Data Types 40 Variables 44 Operators 46 Strings 53 Input and Output 63 Control Flow 71 Big Numbers 88 Arrays 90 Chapter 4: Objects and Classes 105 Introduction to Object-Oriented Programming 106 Using Predefined Classes 111 Defining Your Own Classes 122 Static Fields and Methods 132 Method Parameters 138 Object Construction 144 Packages 15 The Class Path 160 Documentation Comments 162 Class Design Hints 167 Chapter 5: Inheritance 171 Classes, Superclasses, and Subclasses 172 Object: The Cosmic Superclass 192 Generic Array Lists 204 Object Wrappers and Autoboxing 211 Methods with a Variable Number of Parameters 214 Enumeration Classes 215 Reflection 217 Design Hints for Inheritance 238 Chapter 6: Interfaces and Inner Classes 241 Interfaces 242 Object Cloning 249 Interfaces and Callbacks 255 Inner Classes 258 Proxies 275 Chapter 7: Graphics Programming 281 Introducing Swing 282 Creating a Frame 285 Positioning a Frame 288 Displaying Information in a Component 294 Working with 2D Shapes 299 Using Color 307 Using Special Fonts for Text 310 Displaying Images 318 Chapter 8: Event Handling 323 Basics of Event Handling 324 Actions 342 Mouse Events 349 The AWT Event Hierarchy 357 Chapter 9: User Interface Components with Swing 361 Swing and the Model-View-Controller Design Pattern 362 Introduction to Layout Management 368 Text Input 377 Choice Components 385 Menus 406 Sophisticated Layout Management 424 Dialog Boxes 452 Chapter 10: Deploying Applications and Applets 493 JAR Files 494 Java Web Start 501 Applets 516 Storage of Application Preferences 539 Chapter 11: Exceptions, Logging, Assertions, and Debugging 551 Dealing with Errors 552 Catching Exceptions 559 Tips for Using Exceptions 568 Using Assertions 571 Logging 575 Debugging Tips 591 Using a Debugger 607 Chapter 12: Generic Programming 613 Why Generic Programming? 614 Definition of a Simple Generic Class 616 Generic Methods 618 Bounds for Type Variables 619 Generic Code and the Virtual Machine 621 Restrictions and Limitations 626 Inheritance Rules for Generic Types 630 Wildcard Types 632 Reflection and Generics 640 Chapter 13: Collections 649 Collection Interfaces 650 Concrete Collections 658 The Collections Framework 689 Algorithms 700 Legacy Collections 707 Chapter 14: Multithreading 715 What Are Threads? 716 Interrupting Threads 728 Thread States 730 Thread Properties 733 Synchronization 736 Blocking Queues 764 Thread-Safe Collections 771 Callables and Futures 774 Executors 778 Synchronizers 785 Threads and Swing 794 Appendix 809 Index 813 Java 核心技术 卷2 Index Chapter 1: Streams and Files 1 Streams 2 Text Input and Output 11 Reading and Writing Binary Data 23 ZIP Archives 32 Object Streams and Serialization 39 File Management 59 New I/O 65 Regular Expressions 75 Chapter 2: XML 87 Introducing XML 88 Parsing an XML Document 93 Validating XML Documents 105 Locating Information with XPath 129 Using Namespaces 136 Streaming Parsers 138 Generating XML Documents 146 XSL Transformations 157 Chapter 3: Networking 169 Connecting to a Server 170 Implementing Servers 177 Interruptible Sockets 184 Sending E-Mail 191 Making URL Connections 196 Chapter 4: Database Programming 217 The Design of JDBC 218 The Structured Query Language 222 JDBC Configuration 227 Executing SQL Statements 232 Query Execution 242 Scrollable and Updatable Result Sets 254 Row Sets 260 Metadata 263 Transactions 273 Connection Management in Web and Enterprise Applications 278 Introduction to LDAP 279 Chapter 5: Internationalization 297 Locales 298 Number Formats 303 Date and Time 310 Collation 318 Message Formatting 324 Text Files and Character Sets 328 Resource Bundles 329 A Complete Example 333 Chapter 6: Advanced Swing 351 Lists 352 Tables 370 Trees 405 Text Components 442 Progress Indicators 479 Component Organizers 492 Chapter 7: Advanced AWT 521 The Rendering Pipeline 522 Shapes 524 Areas 540 Strokes 542 Paint 550 Coordinate Transformations 552 Clipping 557 Transparency and Composition 559 Rendering Hints 568 Readers and Writers for Images 575 Image Manipulation 585 Printing 601 The Clipboard 635 Drag and Drop 652 Platform Integration 668 Chapter 8: Javabeans Components 685 Why Beans? 686 The Bean-Writing Process 688 Using Beans to Build an Application 690 Naming Patterns for Bean Properties and Events 698 Bean Property Types 701 BeanInfo Classes 710 Property Editors 713 Customizers 723 JavaBeans Persistence 732 Chapter 9: Security 755 Class Loaders 756 Bytecode Verification 767 Security Managers and Permissions 771 User Authentication 790 Digital Signatures 805 Code Signing 822 Encryption 828 Chapter 10: Distributed Objects 841 The Roles of Client and Server 842 Remote Method Calls 845 The RMI Programming Model 846 Parameters and Return Values in Remote Methods 856 Remote Object Activation 865 Web Services and JAX-WS 871 Chapter 11: Scripting, Compiling, and Annotation Processing 883 Scripting for the Java Platform 884 The Compiler API 895 Using Annotations 905 Annotation Syntax 911 Standard Annotations 915 Source-Level Annotation Processing 919 Bytecode Engineering 926 Chapter 12: Native Methods 935 Calling a C Function from a Java Program 936 Numeric Parameters and Return Values 942 String Parameters 944 Accessing Fields 950 Encoding Signatures 954 Calling Java Methods 956 Accessing Array Elements 962 Handling Errors 966 Using the Invocation API 970 A Complete Example: Accessing the Windows Registry 975 Index 991

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值