Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1347393ybp; Thu, 17 Oct 2019 11:24:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzax+Eufygl9+hBZkgALiFs8QhztUWy9mrEWVT8sZ95q2b+Y6ohwr6tZy3dD+QTiZ6IY542 X-Received: by 2002:a17:906:2410:: with SMTP id z16mr4881028eja.120.1571336653505; Thu, 17 Oct 2019 11:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336653; cv=none; d=google.com; s=arc-20160816; b=EkIEeu1FBImeCXHq1eWIq9pr7qA7EGtWxc29ihpCYLIFIYcirkmhCg79FbftyYOnjq 87PkIg43rdUDzHlSUoPD0HJLN+6FPGdHycF8ajC5CJr0ktN8KsCk1VFnd0v4Q6OtmyKs PhyQAP3V+l/Ubn6SpXpCQD6380LkjdEOKHzfWhhtJFZk/KnZ6Ye1k9OOKf6smtTFT8U7 I3xGl9Pc1gXQ0B2lnEtUWnWuSnmyMDLa/Mpf4S5lsCrTV723FQ5EiexhZED++epJxh9i dN1QLxXgCPmRQiE1W+M0z2u4FR6TOpfD5IuBwbZS2elH15+pWQFdcWlhk8eQXfraIBPG dNYA== 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=EXZ1wSILhC7DCQ+vxI1ShL18+C7rcHMQVgB4+ZRaGJU=; b=ArKjDtTr/qgXTsA/XCGS2MFQkingcyXgtqbFYSw9sM69rs1xgrSZlaYN7qzbpEY7a+ oTqb5ctyZ9fwO9dP7Q4Jp5Ve+Nopy8KmTbkVoPIKrda/S8I1DP5gSBLLZFpKkDV/S6sH vz/xY2r3tQ/4n4miTcAsWnmnFyGAv91Llj+Q31iUqGB3r3Qf7CEN8LIs24P8iPMq48IJ JLF2xfzyhBOzCpVFySjd0RlMDvI8kKzwDlHoK2JpJ18F3o4yLCjGHdEJ1Aks+X8C3I7E 8aK67egch22co2WDIBOEdEi+SsStZ9a/Qe+Va57HZeH2jqi7gfdKyGJiUMqXhlAkJ4iZ s7Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bnPo8qeF; 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 s27si2094342edm.226.2019.10.17.11.23.50; Thu, 17 Oct 2019 11:24:13 -0700 (PDT) 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=bnPo8qeF; 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 S2392192AbfJPWDH (ORCPT + 99 others); Wed, 16 Oct 2019 18:03:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:54388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438528AbfJPV7b (ORCPT ); Wed, 16 Oct 2019 17:59:31 -0400 Received: from localhost (unknown [192.55.54.58]) (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 3926E21D7D; Wed, 16 Oct 2019 21:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263170; bh=wlLlmK994FjL3PziOltQbyYG2OnxFty8CYXPDJhvTl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bnPo8qeFKuZ5PeGVLSVee+IQt7dy2ogna/mq5i8PAOaw/cB2kR46/w2gHTNMEII5t Eap9dTYGqZkzD3WTWY+1PZbJtmeRDrGUXkGlYYeMHelZA/OVLLi/A5fDdISY/tmO9R ApDwjCaRMIGWeuMs22vQESv/VEbWuQQeNSSAKadY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French Subject: [PATCH 5.3 071/112] CIFS: Gracefully handle QueryInfo errors during open Date: Wed, 16 Oct 2019 14:51:03 -0700 Message-Id: <20191016214903.478659039@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Pavel Shilovsky commit 30573a82fb179420b8aac30a3a3595aa96a93156 upstream. Currently if the client identifies problems when processing metadata returned in CREATE response, the open handle is being leaked. This causes multiple problems like a file missing a lease break by that client which causes high latencies to other clients accessing the file. Another side-effect of this is that the file can't be deleted. Fix this by closing the file after the client hits an error after the file was opened and the open descriptor wasn't returned to the user space. Also convert -ESTALE to -EOPENSTALE to allow the VFS to revalidate a dentry and retry the open. Cc: Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/file.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -253,6 +253,12 @@ cifs_nt_open(char *full_path, struct ino rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb, xid, fid); + if (rc) { + server->ops->close(xid, tcon, fid); + if (rc == -ESTALE) + rc = -EOPENSTALE; + } + out: kfree(buf); return rc;