From patchwork Sat Jan 18 22:45:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 11340289 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 A3C41109A for ; Sat, 18 Jan 2020 22:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8379C246AC for ; Sat, 18 Jan 2020 22:48:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="DG6UzNT1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgARWsT (ORCPT ); Sat, 18 Jan 2020 17:48:19 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51918 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbgARWsT (ORCPT ); Sat, 18 Jan 2020 17:48:19 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMcuBI072129 for ; Sat, 18 Jan 2020 22:48:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=IN7rGyvK4+5g9KG9S8KAOc5+nBnGikA/igjkRXSxqmo=; b=DG6UzNT1qgPxH8qORp72lyxy/biFui+46ejAIfW4NgLbDbNZzhRzwq3Q65cAkQl75OWx Yss8yWXFmcuXZdXu79TOEP9upggaPEeysOR5e1A1N/sd00ebVM7q37Xiq86YcVoi8otT EhRn88heRE9J0V5PI3yV1HhMuHedAZ3DBroGT1LrVJRAhiCLoerR2SH2XQb46v8pWF+i qCq3G3/i5dHlO+q5eFQ/uTDKVWAoVzt20Scn7STuiMZBg5yZihVfz/X+ai5ImVFlo+B6 RvNtab3SmzSGOtXR6Z0oJhajei2IGGsNxRIHcVuu90Hum9+Wf7ikDx+1jIS78S9CO3gA yA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2xktnqsw0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:48:17 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMcss6162083 for ; Sat, 18 Jan 2020 22:46:17 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2xksc4a7m3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:46:16 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00IMkGRd023089 for ; Sat, 18 Jan 2020 22:46:16 GMT Received: from localhost.localdomain (/67.1.3.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 18 Jan 2020 14:46:15 -0800 From: Allison Collins To: linux-xfs@vger.kernel.org Subject: [PATCH v6 12/17] xfsprogs: Check for -ENOATTR or -EEXIST Date: Sat, 18 Jan 2020 15:45:53 -0700 Message-Id: <20200118224558.19382-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200118224558.19382-1-allison.henderson@oracle.com> References: <20200118224558.19382-1-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9504 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001180185 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9504 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001180185 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Delayed operations cannot return error codes. So we must check for these conditions first before starting set or remove operations Signed-off-by: Allison Collins --- libxfs/xfs_attr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index b681f54..042eee2 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -456,6 +456,14 @@ xfs_attr_set( goto out_trans_cancel; xfs_trans_ijoin(args.trans, dp, 0); + + error = xfs_has_attr(&args); + if (error == -EEXIST && (name->type & ATTR_CREATE)) + goto out_trans_cancel; + + if (error == -ENOATTR && (name->type & ATTR_REPLACE)) + goto out_trans_cancel; + error = xfs_attr_set_args(&args); if (error) goto out_trans_cancel; @@ -544,6 +552,10 @@ xfs_attr_remove( */ xfs_trans_ijoin(args.trans, dp, 0); + error = xfs_has_attr(&args); + if (error != -EEXIST) + goto out; + error = xfs_attr_remove_args(&args); if (error) goto out;