From patchwork Tue Oct 6 02:26:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 11818029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 639CD6CA for ; Tue, 6 Oct 2020 02:26:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DBEA20870 for ; Tue, 6 Oct 2020 02:26:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ej4Zhw6U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725881AbgJFC0e (ORCPT ); Mon, 5 Oct 2020 22:26:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37737 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbgJFC0e (ORCPT ); Mon, 5 Oct 2020 22:26:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601951193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=PGn5mh7ASvGAEmdDQtZCgtBH1GbkFXZP73mEWE94+P4=; b=ej4Zhw6UfHBoi14gcfcDHfAxTeMBcxSVfOGsrd4x/qTm0QtGL9E/i64mOR/Vzz+7ScFKfZ 6Wj59bm+5dEab/CTCwnDAPcNZf9KUkAjdPVkdD5BigNFBF1Xn5onkRmKovb/JGiQY5YXN8 itYJ4gmsyV3hYG01tHSnMwYM9XVhgno= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-_TWGEA39PvWS6OsShtH8EA-1; Mon, 05 Oct 2020 22:26:31 -0400 X-MC-Unique: _TWGEA39PvWS6OsShtH8EA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98F2D107AFA5; Tue, 6 Oct 2020 02:26:30 +0000 (UTC) Received: from test1103.test.redhat.com (vpn2-54-124.bne.redhat.com [10.64.54.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D44927BDD; Tue, 6 Oct 2020 02:26:29 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH] cifs: handle -EINTR in cifs_setattr Date: Tue, 6 Oct 2020 12:26:23 +1000 Message-Id: <20201006022623.21026-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- fs/cifs/inode.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3989d08396ac..74ed12f2c8aa 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2879,13 +2879,17 @@ 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; - 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); + } while (rc == -EINTR); /* BB: add cifs_setattr_legacy for really old servers */ + return rc; } #if 0