Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3288325imm; Sun, 29 Jul 2018 15:07:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcz85u5L1TTVfirk0+q4ci6Ykhes53n+wpAtYk33MG4ZXNdnDhnt5/jtUsDfBMCVlIXubKt X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr15319111pfo.82.1532902029477; Sun, 29 Jul 2018 15:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532902029; cv=none; d=google.com; s=arc-20160816; b=mjgPKyyi0OdmuZP+VcB8E2IRa9Cq1aL6rtDZc1i0xtn3o3nSKrgqBdv3n2Pj9oZgEb fQaTpCtpSAzSwOrCSiYF+3RoOu01emkb8xEMVTty+52gry1wo0xPM4QackJY97JBO/35 KVMNQIDpCuBuhGS2PejAcNQn8YN++/sZ5HxpP1ihY8fj1nrhIoCsLrdL3ozai3mhB1hx x2RF0QDoopCgbUbn7yS4Ck4VFE3biMs2MWTiF65wCzZ4rj67WGNYFe7S8OO+CZCJYcqS Yh9Xa90H0pUJxQIeWZJwjFnmiVtu8UH5u3SdpzQnzSBvYpfEskktpWy4soTwwc2YgL60 iKBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JFD1lypMEmSnTzvYTsJ9lIC/C9yLbXWqp8jd0OMgNQw=; b=rGx10D33mrfQoh1DxSdicru+iEjLIlnyVPYVkuYl0U5qhMZihAZXQ4Skgxz+wAYTE4 6dXXfbjrm6R78Uj0DKFFE3IhC7hlYMB6fm7Pl8AhVugbPLg68mb/y/k4mxQDRCudVzKL PnInV+ky2t4/F/sz+fDo4SE2NKEUHDwmgmgcfAyrCBQkjSPELFm+xr1qL8ipneiA1lMl +NjKuJ3vKxkBWmE+Qs3E/za0ClxJccBQuS4cuI159KZyJTeFEHhycmhcMsSl9LcF84WW w6JSGoyWG33Anbi/9SQzOYBFZMz6N/c7I/aevddZFjew+F0EkSqX5lFwc4Z6dRVFU90l GZ9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si9592935pfn.241.2018.07.29.15.06.55; Sun, 29 Jul 2018 15:07:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732312AbeG2XhY (ORCPT + 99 others); Sun, 29 Jul 2018 19:37:24 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51610 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbeG2Xg5 (ORCPT ); Sun, 29 Jul 2018 19:36:57 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fjto7-0003WA-0c; Sun, 29 Jul 2018 22:04:55 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [PATCH 11/16] jfs: switch to discard_new_inode() Date: Sun, 29 Jul 2018 23:04:48 +0100 Message-Id: <20180729220453.13431-11-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180729220453.13431-1-viro@ZenIV.linux.org.uk> References: <20180729220317.GB30522@ZenIV.linux.org.uk> <20180729220453.13431-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro we don't want open-by-handle to pick an in-core inode that has failed setup halfway through. Signed-off-by: Al Viro --- fs/jfs/jfs_inode.c | 8 ++++---- fs/jfs/namei.c | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 5e9b7bb3aabf..96732c24b054 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c @@ -61,8 +61,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode) inode = new_inode(sb); if (!inode) { jfs_warn("ialloc: new_inode returned NULL!"); - rc = -ENOMEM; - goto fail; + return ERR_PTR(-ENOMEM); } jfs_inode = JFS_IP(inode); @@ -141,9 +140,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode) dquot_drop(inode); inode->i_flags |= S_NOQUOTA; clear_nlink(inode); - unlock_new_inode(inode); + discard_new_inode(inode); + return ERR_PTR(rc); + fail_put: iput(inode); -fail: return ERR_PTR(rc); } diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 56c3fcbfe80e..14528c0ffe63 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -175,8 +175,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, if (rc) { free_ea_wmap(ip); clear_nlink(ip); - unlock_new_inode(ip); - iput(ip); + discard_new_inode(ip); } else { d_instantiate_new(dentry, ip); } @@ -309,8 +308,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) if (rc) { free_ea_wmap(ip); clear_nlink(ip); - unlock_new_inode(ip); - iput(ip); + discard_new_inode(ip); } else { d_instantiate_new(dentry, ip); } @@ -1054,8 +1052,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, if (rc) { free_ea_wmap(ip); clear_nlink(ip); - unlock_new_inode(ip); - iput(ip); + discard_new_inode(ip); } else { d_instantiate_new(dentry, ip); } @@ -1441,8 +1438,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, if (rc) { free_ea_wmap(ip); clear_nlink(ip); - unlock_new_inode(ip); - iput(ip); + discard_new_inode(ip); } else { d_instantiate_new(dentry, ip); } -- 2.11.0