From patchwork Thu Sep 5 22:18:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 11134051 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 BB5DD1862 for ; Thu, 5 Sep 2019 22:19:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF4662137B for ; Thu, 5 Sep 2019 22:19:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="m/Xo89rI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391142AbfIEWTL (ORCPT ); Thu, 5 Sep 2019 18:19:11 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:39000 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391140AbfIEWTK (ORCPT ); Thu, 5 Sep 2019 18:19:10 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x85MJ8rB084595 for ; Thu, 5 Sep 2019 22:19:08 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=ebCEWeORPWDt6RRkNqmzEcPQaf5RfFKnmNO2uTl3Mrw=; b=m/Xo89rIbAEoUgIHKkY3hwQlSIOI5wlsNr43n3uRk6v1tHMDLuGSrwllcl0lThLZASLl OdMo3FtR5aYcveFx4XHq3Ly3OpsaXARadM6ZpBRPzHguJdBUPSAFPku72J/xnDnQ1q9z Pm6Iq2/SGlqiaZd5QEsNdIEIyTKWJ38B36vYeqbjK5dXRIwQLFIUx66UGlkdHdeEnkKZ 2kZd9KOyg5gpk/GslzX/PXsS5tSE0GwhbF2EceDszqOv3oZdJzIEtMEwRWt2rO75XFFb 9EwZYh5uaVoXtSNRd2al1FQpQuqIE0p2MqKBzdykwMr0Td2nAQVtaScXjRveIiwobv/e 0w== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2uuaqxr2ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 05 Sep 2019 22:19:08 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x85MIe9f123356 for ; Thu, 5 Sep 2019 22:19:03 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2uthq27v2p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 05 Sep 2019 22:19:03 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x85MJ2Ei008909 for ; Thu, 5 Sep 2019 22:19:02 GMT Received: from localhost.localdomain (/67.1.183.122) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 05 Sep 2019 15:19:02 -0700 From: Allison Collins To: linux-xfs@vger.kernel.org Subject: [PATCH v2 08/21] xfsprogs: Factor up commit from xfs_attr_try_sf_addname Date: Thu, 5 Sep 2019 15:18:42 -0700 Message-Id: <20190905221855.17555-9-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905221855.17555-1-allison.henderson@oracle.com> References: <20190905221855.17555-1-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9371 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-1906280000 definitions=main-1909050207 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9371 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-1906280000 definitions=main-1909050207 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org New delayed attribute routines cannot handle transactions, so factor this up to the calling function. Signed-off-by: Allison Collins --- libxfs/xfs_attr.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index a2e0172..6a5cdf7 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -193,7 +193,7 @@ xfs_attr_try_sf_addname( { struct xfs_mount *mp = dp->i_mount; - int error, error2; + int error; error = xfs_attr_shortform_addname(args); if (error == -ENOSPC) @@ -209,9 +209,7 @@ xfs_attr_try_sf_addname( if (mp->m_flags & XFS_MOUNT_WSYNC) xfs_trans_set_sync(args->trans); - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; + return error; } /* @@ -223,7 +221,7 @@ xfs_attr_set_args( { struct xfs_inode *dp = args->dp; struct xfs_buf *leaf_bp = NULL; - int error; + int error, error2 = 0;; /* * If the attribute list is non-existent or a shortform list, @@ -243,8 +241,11 @@ xfs_attr_set_args( * Try to add the attr to the attribute list in the inode. */ error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) - return error; + if (!error) { + error2 = xfs_trans_commit(args->trans); + args->trans = NULL; + return error ? error : error2; + } /* * It won't fit in the shortform, transform to a leaf block.