From patchwork Tue Nov 3 20:33:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96D1EC388F7 for ; Tue, 3 Nov 2020 22:04:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D88021556 for ; Tue, 3 Nov 2020 22:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604441042; bh=SszlHjj0P9/SzAxyK6PRfcf2jLRolRlfYE8hPAcMXWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bu1wDbsOzPB9svOe14Y9tv4YxUiGYnJJxIHwKCdJDoP7P1wxulOcRbBwZ1DYf1Ekt stuxmx2k9ISosakF0pjv23WCwH9VlWgwKj/MDA6IA7m0Rr5Fn+1sI/SdcT5oGtSi5v tacTAX04O84TaMd0bgXZBby11vBgzgz2qPK0KXFg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729775AbgKCUoB (ORCPT ); Tue, 3 Nov 2020 15:44:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:58542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730810AbgKCUoA (ORCPT ); Tue, 3 Nov 2020 15:44:00 -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 7FA1D223BD; Tue, 3 Nov 2020 20:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436240; bh=SszlHjj0P9/SzAxyK6PRfcf2jLRolRlfYE8hPAcMXWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMmVdqUu1SaYoX04qQaMfF97oToj4Ok66x7PPPsUZyuJn/k1Xxr1UQefkp3vza0tW WYTWP5MXSNjA/cEuR5sZsYRm9uGrBqwwUl2D3vRYES92tW+FoCCpg3q1Asss4psZxn DQx/z8FTSlKS1yBhnv8l1nyVT2Q01cvtbdJDSZ+8= 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.9 163/391] cifs: handle -EINTR in cifs_setattr Date: Tue, 3 Nov 2020 21:33:34 +0100 Message-Id: <20201103203357.846420878@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 1f75b25e559a7..daec31be85718 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2883,13 +2883,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