From 83fa87276a3b60f320dfde8c1704132b7e21e334 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 7 Jan 2019 10:04:46 +0100 Subject: [PATCH] 4.9-stable patches added patches: cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch --- ...ommand-which-caused-ofd-lock-problem.patch | 52 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 queue-4.9/cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch diff --git a/queue-4.9/cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch b/queue-4.9/cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch new file mode 100644 index 00000000000..dbe684bc31b --- /dev/null +++ b/queue-4.9/cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch @@ -0,0 +1,52 @@ +From 9a596f5b39593414c0ec80f71b94a226286f084e Mon Sep 17 00:00:00 2001 +From: Georgy A Bystrenin +Date: Fri, 21 Dec 2018 00:11:42 -0600 +Subject: CIFS: Fix error mapping for SMB2_LOCK command which caused OFD lock problem + +From: Georgy A Bystrenin + +commit 9a596f5b39593414c0ec80f71b94a226286f084e upstream. + +While resolving a bug with locks on samba shares found a strange behavior. +When a file locked by one node and we trying to lock it from another node +it fail with errno 5 (EIO) but in that case errno must be set to +(EACCES | EAGAIN). +This isn't happening when we try to lock file second time on same node. +In this case it returns EACCES as expected. +Also this issue not reproduces when we use SMB1 protocol (vers=1.0 in +mount options). + +Further investigation showed that the mapping from status_to_posix_error +is different for SMB1 and SMB2+ implementations. +For SMB1 mapping is [NT_STATUS_LOCK_NOT_GRANTED to ERRlock] +(See fs/cifs/netmisc.c line 66) +but for SMB2+ mapping is [STATUS_LOCK_NOT_GRANTED to -EIO] +(see fs/cifs/smb2maperror.c line 383) + +Quick changes in SMB2+ mapping from EIO to EACCES has fixed issue. + +BUG: https://bugzilla.kernel.org/show_bug.cgi?id=201971 + +Signed-off-by: Georgy A Bystrenin +Reviewed-by: Pavel Shilovsky +CC: Stable +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/smb2maperror.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/cifs/smb2maperror.c ++++ b/fs/cifs/smb2maperror.c +@@ -377,8 +377,8 @@ static const struct status_to_posix_erro + {STATUS_NONEXISTENT_EA_ENTRY, -EIO, "STATUS_NONEXISTENT_EA_ENTRY"}, + {STATUS_NO_EAS_ON_FILE, -ENODATA, "STATUS_NO_EAS_ON_FILE"}, + {STATUS_EA_CORRUPT_ERROR, -EIO, "STATUS_EA_CORRUPT_ERROR"}, +- {STATUS_FILE_LOCK_CONFLICT, -EIO, "STATUS_FILE_LOCK_CONFLICT"}, +- {STATUS_LOCK_NOT_GRANTED, -EIO, "STATUS_LOCK_NOT_GRANTED"}, ++ {STATUS_FILE_LOCK_CONFLICT, -EACCES, "STATUS_FILE_LOCK_CONFLICT"}, ++ {STATUS_LOCK_NOT_GRANTED, -EACCES, "STATUS_LOCK_NOT_GRANTED"}, + {STATUS_DELETE_PENDING, -ENOENT, "STATUS_DELETE_PENDING"}, + {STATUS_CTL_FILE_NOT_SUPPORTED, -ENOSYS, + "STATUS_CTL_FILE_NOT_SUPPORTED"}, diff --git a/queue-4.9/series b/queue-4.9/series index 9fb0c0181b3..2a4339ed0de 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -64,3 +64,4 @@ media-v4l2-tpg-array-index-could-become-negative.patch mips-ensure-pmd_present-returns-false-after-pmd_mknotpresent.patch mips-align-kernel-load-address-to-64kb.patch mips-octeon-mark-rgmii-interface-disabled-on-octeon-iii.patch +cifs-fix-error-mapping-for-smb2_lock-command-which-caused-ofd-lock-problem.patch -- 2.47.3