Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp828773pxb; Tue, 3 Nov 2020 13:44:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxAa5vEo5NRRryKD2aOnsJbjeAynWkSdAXGsl2cvjcFPWc5SgZxEr0I87Xa+gOMV1UZHkH X-Received: by 2002:a17:906:26c2:: with SMTP id u2mr21130429ejc.529.1604439842566; Tue, 03 Nov 2020 13:44:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439842; cv=none; d=google.com; s=arc-20160816; b=wB2rJZcVWFvxHTsPdJz6sda0eSfADu8XRlS0f240UhioSDuMC/TK6ZttUNUiDydhVV sN9Ph5Ij1/uCQicuLUw0aIGjA78qvAEsdCGoSWwYBXO397Zw1Yc9iIPZcu+5uzlnV19K PEKfr2db61kvKHPep8icSObbJjt3p3WjBDpeZ+jm+0rPUxxD4hxyAN8x2L5u4nrh82I9 c8TpxTxpbIBvKNaT5q4X0aq5LBSGneFoTtRuiiUQ1SMnO686xAiotj5ZwydJuVp9Q9mq D8HyIU+rMXRUkGWN6gxOkGyOp68ENhq69SBVnmmoRxIf9Ixbp/9QHXd7DhNYZRyH4igr 6Ycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zLEeOa0DhguSlCz9kEzgtpFnLPcaOXjgkbs6R8qC6ec=; b=KUDmuqlzdjiC7BMz6Zq3pmgRYMk1TCYDMml6vYPEfLotlANw8qidvLEqwh8CzRSvVz PlQbyoGG4z0SgTkAmNWkm9mJ/+zElZhca5P/w/EY8TFqxUPXrCuSeCq1T2LTyZb4N2on ViVYyQfD99GOBKcwYEnNxh0vam14Vl4/2i96WXBYSjpAsLx402TtzvfN8jrrdqvXDQQu BrrD0Wq12vhdKjqLksr3+hW3WTlwjabIflA2RyQXpRCdHOt4StaxhYEawGHlztWCQA1h RHda4QcfI9c7jBJTXfy583iS/kou5eU9Pb4grJOO7QvoVkWzfdIevgQjPfd2UAXnfbZi Jvyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=akfNdc3C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si27694ejj.377.2020.11.03.13.43.39; Tue, 03 Nov 2020 13:44:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=akfNdc3C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732439AbgKCU4C (ORCPT + 99 others); Tue, 3 Nov 2020 15:56:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:57100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732421AbgKCUz4 (ORCPT ); Tue, 3 Nov 2020 15:55:56 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 06CC422226; Tue, 3 Nov 2020 20:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436956; bh=VcqJGZGvfLtSxMUUO8ZasHLqmWQGZ+sqivDw7+BUfEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=akfNdc3Cs1m4romsSi0NCDb3ol0jMeRUcdn/sXi3fWw0UDR9kErJyxrA8mQR7Fiql 9ybpzp7oBr12tW8ZyVpjAVltoc1EPbxjKvwUaMWh9DePSp/6iMKtYiEA9BqW7kGIPt LsMbL8fpFWrpVzzEsffdfyfAzTD+ZhwNnhKrc1Yg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.4 085/214] cifs: handle -EINTR in cifs_setattr Date: Tue, 3 Nov 2020 21:35:33 +0100 Message-Id: <20201103203258.321164049@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronnie Sahlberg [ Upstream commit c6cc4c5a72505a0ecefc9b413f16bec512f38078 ] RHBZ: 1848178 Some calls that set attributes, like utimensat(), are not supposed to return -EINTR and thus do not have handlers for this in glibc which causes us to leak -EINTR to the applications which are also unprepared to handle it. For example tar will break if utimensat() return -EINTR and abort unpacking the archive. Other applications may break too. To handle this we add checks, and retry, for -EINTR in cifs_setattr() Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/inode.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 17df90b5f57a2..fd9e289f3e72a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2614,13 +2614,18 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) { struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); + int rc, retries = 0; - if (pTcon->unix_ext) - return cifs_setattr_unix(direntry, attrs); - - return cifs_setattr_nounix(direntry, attrs); + do { + if (pTcon->unix_ext) + rc = cifs_setattr_unix(direntry, attrs); + else + rc = cifs_setattr_nounix(direntry, attrs); + retries++; + } while (is_retryable_error(rc) && retries < 2); /* BB: add cifs_setattr_legacy for really old servers */ + return rc; } #if 0 -- 2.27.0