From patchwork Thu Apr 12 15:08:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10338767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99F1D602D8 for ; Thu, 12 Apr 2018 15:18:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ECC42785D for ; Thu, 12 Apr 2018 15:18:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81866279E0; Thu, 12 Apr 2018 15:18:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3128B2785D for ; Thu, 12 Apr 2018 15:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753597AbeDLPSA (ORCPT ); Thu, 12 Apr 2018 11:18:00 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38600 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753596AbeDLPI7 (ORCPT ); Thu, 12 Apr 2018 11:08:59 -0400 Received: by mail-wr0-f193.google.com with SMTP id l13so4424965wrb.5 for ; Thu, 12 Apr 2018 08:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GTQ0EC05y/1W6nQaibqwsmYkIz1jW5hxx+1tQwxP2WE=; b=Uy/o95tI2Rk0XLtumjsigK5rNbBD8V/+IqJlrBx92Fc4f7FCMvj3On2PFp0DV4kR6s aFbcqbodPLBdu+AH9MK2jtiEo/nxTmUFBl0X1An/Hu/drKy5IvHPAWhmIQFcg07ZUIoZ ewLfFm0KhgJEo3QqhTGDukUp7blJq4n1SHrnX//moMWWFPVsoUQUy7mWoAMb95QLSCW2 XaGrQWB4b1yv8lnmHEPpQIRYF0Wcubd4lC3iBMWl2bqwqXEVMlw1T+Tmif3skdG3mbiG bzRA832SgL3Xxe4V2BaAaiBN8V1S2XDlZhJZOCrmqR4T7pBWULumsDUfRE1Qmqh9OTNT pLIw== X-Gm-Message-State: ALQs6tCuG6yVZpukMUDM0e7tt7BJEL4UQeQ0bbaCG9SroqDs6b7/EDBX C0ny5JYbFJW2Zgzek9uxN4hbiTwoNBc= X-Google-Smtp-Source: AIpwx4+XZproQJ3gIU4bke4vamdvrOCKcV4FCfHKxr5i3qF7/wsuVnsImv8IzhPeZyVAFdFHqwur2A== X-Received: by 10.223.174.227 with SMTP id y90mr1083149wrc.76.1523545738319; Thu, 12 Apr 2018 08:08:58 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id p197sm2621783wme.43.2018.04.12.08.08.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 08:08:57 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 23/35] vfs: simplify dentry_open() Date: Thu, 12 Apr 2018 17:08:14 +0200 Message-Id: <20180412150826.20988-24-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180412150826.20988-1-mszeredi@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dentry_open() can now just call path_open(). Signed-off-by: Miklos Szeredi --- fs/open.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/fs/open.c b/fs/open.c index 1d1a52908b0f..442088ca30f9 100644 --- a/fs/open.c +++ b/fs/open.c @@ -891,31 +891,13 @@ EXPORT_SYMBOL(path_open); struct file *dentry_open(const struct path *path, int flags, const struct cred *cred) { - int error; - struct file *f; - validate_creds(cred); /* We must always pass in a valid mount pointer. */ BUG_ON(!path->mnt); - f = get_empty_filp(); - if (!IS_ERR(f)) { - f->f_flags = flags; - error = vfs_open(path, f, cred); - if (!error) { - /* from now on we need fput() to dispose of f */ - error = open_check_o_direct(f); - if (error) { - fput(f); - f = ERR_PTR(error); - } - } else { - put_filp(f); - f = ERR_PTR(error); - } - } - return f; + return path_open(path, flags, d_backing_inode(path->dentry), cred, + true); } EXPORT_SYMBOL(dentry_open);