Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1251119pxx; Tue, 27 Oct 2020 11:51:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/vKV7TdNi3MJAouzhom2eKvqtDr62sx20VQuO3GOYgEcuFm0Q6ciHJxILgbDfpGWTIf/n X-Received: by 2002:a17:906:4a03:: with SMTP id w3mr3893637eju.15.1603824691092; Tue, 27 Oct 2020 11:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603824691; cv=none; d=google.com; s=arc-20160816; b=Q65f4kZVSHqqALZNkVIFQjO5N9wZlmzLEvCymd8u+EMxQ83tIK9WiDnAjZaqDRa3Fm jfoQFTTLDllkWiAEF6eL5fulJy1iWbNFvF3FXQgm7f+bzuQRlWQXpqaRMbmprOvmB6lw ErTlObIoMryo/Nnu+2BCrCb89B2ul++5aSvwx214uX04RBhKS5r5Hma1wQbR2A9o4kV2 aP6TFSteu2ypXbrZKXFXDsV+DW2Z7QDy2hLIpRHSAyejysmf6tO6HtTgduAjFYskH3z7 oQ9GuJ1u//TsJVVAobVV9xBTUJ1MNqWFG0c3sMnUPk9ixNM6clqmli7sPacQDaDgpYtH vk0w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y8T23zVynUjNFNtWBxCJp92lWBomZ+T+hsiAColrrO0=; b=hlnezSmb/4mujNSqDkIH9lKRjqC3D6Dd81mGGNmyVvxtTms/VDSLZLukNvBZIsA863 hFAb/j2eAjSHZbYWRot9PrsEtMcf6m3IqJv54aq6Iey4WeAKHUr7G5DLeRIqZJIf9ufz +Ty+R1ApnWDix/StFNHIf8nDQ6VlQk5qAGd0MLKV7qIIoEbsiizJHSCmVSdCdycsj5cb VDs18LarT6U5SGOaIT2wX94JjAcpLT2/cxwa0HbaGpEe8T/3tf5+eHOBq7HPVfE4mW7L myWK+4jWIjmjMOLoKqEE72vAcMGt7bO9IkhP1kg9JKvUwAUipbwG3xqd1tafC2J0ga+s Q8jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W2DlNiug; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si1532928edy.528.2020.10.27.11.51.08; Tue, 27 Oct 2020 11:51:31 -0700 (PDT) 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=W2DlNiug; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443784AbgJ0Abu (ORCPT + 99 others); Mon, 26 Oct 2020 20:31:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409504AbgJZXvn (ORCPT ); Mon, 26 Oct 2020 19:51:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A1B320882; Mon, 26 Oct 2020 23:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756302; bh=fbOKK3oj6RLCzwslWtdXpYtuvTduGUnB3rdCifdbUIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W2DlNiugeajzi+LFJxkw7am2Znyh5RNsM9wtavd2H1acACBoYU9L/HUjJLfDN04fD fQIbOcvhZCT7KsG4zeqsLUSL2Ji5X+qJgFnhWxnFNaDHlXHKuxX5/doK/r4j1sNgL4 bw4fBdPtAvzKdKflkBvE8Zc3GhfnmX2kU+f0Zh9M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ronnie Sahlberg , Steve French , Sasha Levin , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH AUTOSEL 5.9 128/147] cifs: handle -EINTR in cifs_setattr Date: Mon, 26 Oct 2020 19:48:46 -0400 Message-Id: <20201026234905.1022767-128-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 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 -- 2.25.1