Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp631145imu; Fri, 11 Jan 2019 06:30:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN62guzZU2i0w4s5zh/URTdL/w5hR2ZX1OQgg4iFmar8MSRABwkHxgZnWlJBCmZLMdmLQHI4 X-Received: by 2002:a63:6984:: with SMTP id e126mr13738645pgc.143.1547217013259; Fri, 11 Jan 2019 06:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547217013; cv=none; d=google.com; s=arc-20160816; b=KD3xYy1rSQUyuUT2foIwdvI8bpbmJcQp9r0CtkmIz+U3gAYhL7woPZ+k/UqMiHTNJo hGZIpf42St1qMiefeiZxQYZk8sNIyQtsGeJs7TPEIdEtLBR8fFjRtckIhsauSWZqYyZu trmZEPSPPfYQI26oCIXQXY1hOiuPnqjsatobceTolIbZQIsy4g7NOLs7eIXRkNmd7Rmb VcxZ55UwNxRiN7Ao4wbByonmWM9LhDix/fpuClJ7TeRE358Vw5dm6vr26DhY6wSB3Udz 2BntnAFPIzcJ14KJ7ztZUEK4aRAneIQjqsYsAlM1oI50KaE+U6nMzx26MJUAm4lMSCCL lYAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zVnjC9WIfKl2vnvYvrq758FUaPW2dHhCVAd5So4X9Hs=; b=A0xSJYtcRXBBHkVTKwrWxnebSOBRivkp6ZFuuOh0DIWOqRi7bRnx6xebXDm6gOak4E Yf2Lp5qO1+SUT0GDo+IvJSG8K4gTar/mKoEqKoofUd2JSBZouBVreN+aXg7i9Ua0tINV mx4eFuj6xnso3THZUr93wxy+UszhqvT3PREBWmg8XbuKfIBizWhdW/jZ56jBOyhbyide gN6isCJixgZ8Eys4a0rLFPsjqrHlRLE3PmEzh2aOi0wybw0EbsryRn7z2GkpQAcyJqER 3C4YIatHm6Z/slREc8l1B/0lnyd/7b1j6KnpE7+Dy57XhecR4Jwzc7mdzHGkkaj2ztgx S16Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=er8pCSGN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si22412464pgg.279.2019.01.11.06.29.57; Fri, 11 Jan 2019 06:30:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=er8pCSGN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388235AbfAKOZd (ORCPT + 99 others); Fri, 11 Jan 2019 09:25:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:35004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730454AbfAKOSa (ORCPT ); Fri, 11 Jan 2019 09:18:30 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5BF0214D8; Fri, 11 Jan 2019 14:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216309; bh=RdZderfgA2MCXwQ6oZ+691K5defJsuuQpLb+DrLBdTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=er8pCSGNqVDBs6jrzb3oNVmRoYBDz3rwJ0NqTrE3RQQUMg/u5QJdlyjuTIGjl2cqI yzHlASdMC/KaM/BDN+UPczpxL3wWojCMVYVuBvlFrxtadN2fEnyMDdvwPLD9Dx5BZI gQNlxL9bRYOnCDAY7gH5v50wEXhHumWD2cR0LExg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Georgy A Bystrenin , Pavel Shilovsky , Steve French Subject: [PATCH 4.4 53/88] CIFS: Fix error mapping for SMB2_LOCK command which caused OFD lock problem Date: Fri, 11 Jan 2019 15:08:22 +0100 Message-Id: <20190111131053.932964287@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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"},