Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1393560ybp; Thu, 17 Oct 2019 12:07:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP0rH78aRQwhnc15Iwy368buaL/1Wcv23oVS17VwhT5zmQOTuXDlwPt4F3LCw9hZyOb6fK X-Received: by 2002:a17:906:c2c1:: with SMTP id ch1mr4789719ejb.321.1571339256081; Thu, 17 Oct 2019 12:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571339256; cv=none; d=google.com; s=arc-20160816; b=kKoqbFWnJ/L3gEAFyIhnN5CjxSWg7Aixz3pjPxpafNkFMMfLwQsS+jbm11NTLrEAiN xx//mktqI/oDVpAiq3q0UZ32FjUykWad5TO9BioWueD/9xpVy7cbKR2YngnjEKJIXQJs 9cukiX0dBB2Oua5Cn6ZHen3y0FRuuz8Aulp1IbXuKLzbhk8FUa8tMXkxR8Cms9zKhM4s ZQ+vgpUYrzRvvQyDABQAXGZkTDBgXv91fT+0ISvf59USrT32qBPiTFDdBLCLeBfJOaUH Y19ly9bgiL37gDds1kUPsru7pBmrGWx1dHHfMtb95cwu6iQ0jNfdsQ8CkmTr3Gb06bvi 7kUw== 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=1ju+GhZzhBoB1kJ7RgkC8rwgjVZxeqdtnqCvksObqVQ=; b=UCqQiN8+/E/I4yf4ujlM9wWeWwZHruaDlEkTEcZzh68451cgHHVq6/gqdrhWrxScqG dcjKZtXVek5fNmIRb8+buhKnHr+4ATYYuP9hd+0DJ/u8o35uhMEvvffYLvnP5ZDYY+uC kd+VG1NELhCwm29ttzteZQC9QDTdAWMLaR4C/L5tlS8efKH9i5ngSuxLf0u7zijUUc13 2R2kx2K+7iq+4EgaOP+buU4TxHBh2sRgC3IFd6XFenDemcrfwIOs4mJ0/OJRntiZjSGP rSBOSitDYV335BmBoOgjtk/2gCS7HTh2h8NZ6uYaClPWYUaz5cXOXXvWB/Q8GzZvzaYS T1sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cwycZzVU; 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 e22si2150279ejm.72.2019.10.17.12.07.12; Thu, 17 Oct 2019 12:07:36 -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=cwycZzVU; 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 S2439250AbfJPWM3 (ORCPT + 99 others); Wed, 16 Oct 2019 18:12:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:47786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406613AbfJPV4R (ORCPT ); Wed, 16 Oct 2019 17:56:17 -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 DABFF21925; Wed, 16 Oct 2019 21:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262977; bh=UlGrKMgXgRaTB19PpiO2d5UObMhWdYR3TmQmAa+QV6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cwycZzVUMtW2QF7K8Kcg1yFoZislhG3nGQlYp1D0CkYHXaO4bmiasbCavMpsK7Zxk GV1WTMSNuM+zejZS1YUISFL6t8D25Jppw5O16b2QWIfAMc5xwotxbw/gyOCMaWiRUH aKODznVCOFyuEZ/6bfDUhioMJQIvb5XhzXnkvLhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French Subject: [PATCH 4.14 46/65] CIFS: Gracefully handle QueryInfo errors during open Date: Wed, 16 Oct 2019 14:51:00 -0700 Message-Id: <20191016214834.485897161@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214756.457746573@linuxfoundation.org> References: <20191016214756.457746573@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 @@ -252,6 +252,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;