Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp886100pxx; Tue, 27 Oct 2020 03:03:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD1WP5ThPUf58bVgMBT+h5NPzX050cWzGJrbnUraDC2Tx3XPJS0AolJNqJeO13ERn+NQ7v X-Received: by 2002:adf:fdc7:: with SMTP id i7mr2013419wrs.198.1603793011207; Tue, 27 Oct 2020 03:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603793011; cv=none; d=google.com; s=arc-20160816; b=i0CEuLqXXKeZIrPI4SG11EUAzpA4a/rTVK2Pc3Jma3SrVGjtYoGEOqhxSeEwSsAkt2 R2xC0l4RLdVROj2sluDAjJYP5/fndvVzsP9HJFKNWnfhLzsiW310JlhwJjLLpKJy1BC3 d17CruU4HVO9vXB74BD5Tg12qf7Tf2AmP0RyW4Uu/VUXInughfNcuA+n7P5Xkc1S3FE5 3X8HGz9TXySdwyzTky2zQvPX90/JecTntla8pEtiaSdS/vNGX4NYXbUnEv5jfvTcPWf+ FUbSQZiddZei0zFL5E+6AlFp/hJjDzriHSi2S3w5WGUwBghvEFoALQ1iLxKOO5/MbnTJ GcSw== 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=FJSHYkAUNE1ulgv/LCbgDjTuxpYqBcxZDDtLyTzjDe4=; b=BYng3GG254qfXDsD1vxNyL9IUDBqzKduFqdaJ5uMIBtaGjKPG+5lZyV+JlW0eC9dGo QUebvWBfqJUfc5e54sAWsDpEROauHnenzdhVOtghkYdPG/IwMi3Bw5imnWQTrCrX39/h JKX6J1GqIZ2NbxpJD3FGsXCHIpCLijn+SLVeVgHKNiQmZK+iTutRtngF454KbjrW/ZYZ OP132qx2CEo2PvFAzY1s1vycLTkjg7klRD8T5Utb+Dgth3BDXXF2AExeB2DUkg7Si+C5 2D8ZvpWLdr+XTB28MTI6HY24gPUe6F0H2Kot52K/GiypbLpUlQJSiJwRIic/nUXBSZzt r6pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rIhjVr69; 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 h10si595233ejl.239.2020.10.27.03.03.09; Tue, 27 Oct 2020 03:03: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=rIhjVr69; 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 S2437181AbgJ0AAX (ORCPT + 99 others); Mon, 26 Oct 2020 20:00:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:36880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436563AbgJZX4l (ORCPT ); Mon, 26 Oct 2020 19:56:41 -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 819A921655; Mon, 26 Oct 2020 23:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756601; bh=O0MZKMgD+NDAuCsw5g8OkCFAStpHivZc/6eT5X7Illg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIhjVr69A+e9kRYp4Tm+SilD+oR0ILWzmdqZFT0FIwhJY9jj5eBgRsenq3gzoS0fw 6tL27GgTa14GD3rQFxjmov1wUYc3eShfvkIhez42OPXK+FnudKG1BvKEAYKMxGOnun cM5Nr/kgFICqlx0gqT/JTI1GDdH/oi5d52zdYR3o= 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.4 70/80] cifs: handle -EINTR in cifs_setattr Date: Mon, 26 Oct 2020 19:55:06 -0400 Message-Id: <20201026235516.1025100-70-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-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 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.25.1