From mboxrd@z Thu Jan 1 00:00:00 1970 From: Emanuele Giuseppe Esposito Date: Tue, 14 Apr 2020 14:43:01 +0200 Subject: [Ocfs2-devel] [PATCH 7/8] debugfs: switch to simplefs inode creation API In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> Message-ID: <20200414124304.4470-8-eesposit@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-nfs@vger.kernel.org Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , linux-s390@vger.kernel.org, Christoph Hellwig , Andrew Donnellan , Emanuele Giuseppe Esposito , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Michael Ellerman , Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , netdev@vger.kernel.org, Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Uma Krishnan , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Alexander Viro , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , Mike Marciniszyn , Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Anna Schumaker , Luis Chamberlain , Chuck Lever , Jeremy Kerr , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , ocfs2-devel@oss.oracle.com, Joel Becker The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144 +++++---------------------------------------- 1 file changed, 15 insertions(+), 129 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 834b5872ca0d..7a2369373b85 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent) } EXPORT_SYMBOL_GPL(debugfs_lookup); -static struct dentry *start_creating(const char *name, struct dentry *parent) -{ - struct dentry *dentry; - int error; - - pr_debug("creating file '%s'\n", name); - - if (IS_ERR(parent)) - return parent; - - error = simple_pin_fs(&debugfs, &debug_fs_type); - if (error) { - pr_err("Unable to pin filesystem for file '%s'\n", name); - return ERR_PTR(error); - } - - /* If the parent is not specified, we create it in the root. - * We need the root dentry to do this, which is in the super - * block. A pointer to that is in the struct vfsmount that we - * have around. - */ - if (!parent) - parent = debugfs.mount->mnt_root; - - inode_lock(d_inode(parent)); - if (unlikely(IS_DEADDIR(d_inode(parent)))) - dentry = ERR_PTR(-ENOENT); - else - dentry = lookup_one_len(name, parent, strlen(name)); - if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { - if (d_is_dir(dentry)) - pr_err("Directory '%s' with parent '%s' already present!\n", - name, parent->d_name.name); - else - pr_err("File '%s' in directory '%s' already present!\n", - name, parent->d_name.name); - dput(dentry); - dentry = ERR_PTR(-EEXIST); - } - - if (IS_ERR(dentry)) { - inode_unlock(d_inode(parent)); - simple_release_fs(&debugfs); - } - - return dentry; -} - -static struct dentry *failed_creating(struct dentry *dentry) -{ - inode_unlock(d_inode(dentry->d_parent)); - dput(dentry); - simple_release_fs(&debugfs); - return ERR_PTR(-ENOMEM); -} - -static struct dentry *end_creating(struct dentry *dentry) -{ - inode_unlock(d_inode(dentry->d_parent)); - return dentry; -} - static struct dentry *__debugfs_create_file(const char *name, umode_t mode, struct dentry *parent, void *data, const struct file_operations *proxy_fops, @@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode, struct dentry *dentry; struct inode *inode; - if (!(mode & S_IFMT)) - mode |= S_IFREG; - BUG_ON(!S_ISREG(mode)); - dentry = start_creating(name, parent); - + dentry = simplefs_create_file(&debugfs, &debug_fs_type, + name, mode, parent, data, &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create file '%s'\n", - name); - return failed_creating(dentry); - } - - inode->i_mode = mode; - inode->i_private = data; - inode->i_op = &debugfs_file_inode_operations; inode->i_fop = proxy_fops; dentry->d_fsdata = (void *)((unsigned long)real_fops | DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); - d_instantiate(dentry, inode); - fsnotify_create(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } /** @@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size); */ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) { - struct dentry *dentry = start_creating(name, parent); + struct dentry *dentry; struct inode *inode; + dentry = simplefs_create_dir(&debugfs, &debug_fs_type, + name, 0755, parent, &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create directory '%s'\n", - name); - return failed_creating(dentry); - } - - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; inode->i_op = &debugfs_dir_inode_operations; - inode->i_fop = &simple_dir_operations; - - /* directory inodes start off with i_nlink == 2 (for "." entry) */ - inc_nlink(inode); - d_instantiate(dentry, inode); - inc_nlink(d_inode(dentry->d_parent)); - fsnotify_mkdir(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_dir); @@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name, debugfs_automount_t f, void *data) { - struct dentry *dentry = start_creating(name, parent); + struct dentry *dentry; struct inode *inode; + dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent, + &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create automount '%s'\n", - name); - return failed_creating(dentry); - } - make_empty_dir_inode(inode); inode->i_flags |= S_AUTOMOUNT; inode->i_private = data; dentry->d_fsdata = (void *)f; - /* directory inodes start off with i_nlink == 2 (for "." entry) */ - inc_nlink(inode); - d_instantiate(dentry, inode); - inc_nlink(d_inode(dentry->d_parent)); - fsnotify_mkdir(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL(debugfs_create_automount); @@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, { struct dentry *dentry; struct inode *inode; - char *link = kstrdup(target, GFP_KERNEL); - if (!link) - return ERR_PTR(-ENOMEM); - dentry = start_creating(name, parent); - if (IS_ERR(dentry)) { - kfree(link); + dentry = simplefs_create_symlink(&debugfs, &debug_fs_type, + name, parent, target, &inode); + if (IS_ERR(dentry)) return dentry; - } - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create symlink '%s'\n", - name); - kfree(link); - return failed_creating(dentry); - } - inode->i_mode = S_IFLNK | S_IRWXUGO; inode->i_op = &debugfs_symlink_inode_operations; - inode->i_link = link; - d_instantiate(dentry, inode); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_symlink); -- 2.25.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CDF3C2BA19 for ; Tue, 14 Apr 2020 12:44:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B228F20656 for ; Tue, 14 Apr 2020 12:44:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T9XOagZZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B228F20656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 64BD18E000C; Tue, 14 Apr 2020 08:44:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D0FE8E0001; Tue, 14 Apr 2020 08:44:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44A808E000C; Tue, 14 Apr 2020 08:44:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 2D2E58E0001 for ; Tue, 14 Apr 2020 08:44:28 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D80B6180AD802 for ; Tue, 14 Apr 2020 12:44:27 +0000 (UTC) X-FDA: 76706428974.22.jump55_26eac4df92257 X-HE-Tag: jump55_26eac4df92257 X-Filterd-Recvd-Size: 13690 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Apr 2020 12:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586868266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZ6xsK3V0N91Fk8iBgZd6BgXsfySMhIjcPWAROHMn1Y=; b=T9XOagZZ9qqTvd5vZu43LN2CyGB+XARX1831qR/1OxiwHY4btCe+4FHJ9ujYlpXMmJTwfR s4qKwB73o8Kcw92yLVF4yKIVJrI3jPGlLfhXLDyE0FfyM3tmu7pKjVPXqFiziZtmEMuN4t nuGJ/48CkvpYn97g8C8o167XxaJKThg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-53qq-KUVOz-COxl0cTk3UA-1; Tue, 14 Apr 2020 08:44:25 -0400 X-MC-Unique: 53qq-KUVOz-COxl0cTk3UA-1 Received: by mail-wm1-f70.google.com with SMTP id h6so3704600wmi.7 for ; Tue, 14 Apr 2020 05:44:25 -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:mime-version:content-transfer-encoding; bh=41gcpXPXsxw0iFMzm+k+g/C6jCPBlhyC8+dVJ9Pc1fA=; b=eULDMZ67Du9IJDcLFUBTJBbZ6LVgWKr2PhEMIWl8IE3Fsr0kRNRKtG3kvrdn+fGDZG 3T0dpER+/1yu42r4IDsqHp7iGw2BwdkETtWFOZSiMj7A36O+O0P+7sxwhPRma3kALxVl L4oLTy2kGjDlm8aldhTaGpx2wGX3okfgNkzl/Qg1yJg7HBzJMkS+DaN6XsZ6yye6SVOk C4WS40zwQayOQCcoguiHeRZ8V/qCKuD6XwaoTdsTaYAshzid67z3FApFQMEawcttSGav QDSvjXly/CngTE3pIUdKq37YXlyK3TirhAn/c5l5aMUx7k0XzDy/KiwDS7gtnCVTihpy jjdQ== X-Gm-Message-State: AGi0PuZ5AMBqhr0pfelnrc3mS6SL8BZCQLJO/YOfsWJw6I3GPwOyHaOz pvAYk6nqRLnOvRrrE+xsVUjWK6U3WhDNniIezva2kMWZLdtA09Up+Uu0wmyaFTQUXmdmJmTnz4b J2CRLIc02B/U= X-Received: by 2002:a1c:147:: with SMTP id 68mr24229389wmb.28.1586868264248; Tue, 14 Apr 2020 05:44:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLG15Rdex4MNDkfLSgxNLw13YiMYBHA340JgiTMak7ycYuMs+tWPpamut6Uc41GnMvfLqOpAg== X-Received: by 2002:a1c:147:: with SMTP id 68mr24229312wmb.28.1586868263915; Tue, 14 Apr 2020 05:44:23 -0700 (PDT) Received: from localhost.localdomain ([194.230.155.210]) by smtp.gmail.com with ESMTPSA id m14sm16948816wrs.76.2020.04.14.05.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 05:44:23 -0700 (PDT) From: Emanuele Giuseppe Esposito To: linux-nfs@vger.kernel.org Cc: Paolo Bonzini , Emanuele Giuseppe Esposito , Jeremy Kerr , Arnd Bergmann , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Greg Kroah-Hartman , Robert Richter , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Alexander Viro , Ian Kent , Joel Becker , Christoph Hellwig , "Rafael J. Wysocki" , Matthew Garrett , Ard Biesheuvel , Miklos Szeredi , Mike Kravetz , Mark Fasheh , Joseph Qi , Alexey Dobriyan , Luis Chamberlain , Kees Cook , Iurii Zaikin , Anton Vorontsov , Colin Cross , Tony Luck , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Hugh Dickins , Andrew Morton , "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker , "David S. Miller" , Jakub Kicinski , James Morris , "Serge E. Hallyn" , John Johansen , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, oprofile-list@lists.sf.net, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org, ocfs2-devel@oss.oracle.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH 7/8] debugfs: switch to simplefs inode creation API Date: Tue, 14 Apr 2020 14:43:01 +0200 Message-Id: <20200414124304.4470-8-eesposit@redhat.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144 +++++---------------------------------------- 1 file changed, 15 insertions(+), 129 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 834b5872ca0d..7a2369373b85 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct= dentry *parent) } EXPORT_SYMBOL_GPL(debugfs_lookup); =20 -static struct dentry *start_creating(const char *name, struct dentry *pare= nt) -{ -=09struct dentry *dentry; -=09int error; - -=09pr_debug("creating file '%s'\n", name); - -=09if (IS_ERR(parent)) -=09=09return parent; - -=09error =3D simple_pin_fs(&debugfs, &debug_fs_type); -=09if (error) { -=09=09pr_err("Unable to pin filesystem for file '%s'\n", name); -=09=09return ERR_PTR(error); -=09} - -=09/* If the parent is not specified, we create it in the root. -=09 * We need the root dentry to do this, which is in the super -=09 * block. A pointer to that is in the struct vfsmount that we -=09 * have around. -=09 */ -=09if (!parent) -=09=09parent =3D debugfs.mount->mnt_root; - -=09inode_lock(d_inode(parent)); -=09if (unlikely(IS_DEADDIR(d_inode(parent)))) -=09=09dentry =3D ERR_PTR(-ENOENT); -=09else -=09=09dentry =3D lookup_one_len(name, parent, strlen(name)); -=09if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { -=09=09if (d_is_dir(dentry)) -=09=09=09pr_err("Directory '%s' with parent '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09else -=09=09=09pr_err("File '%s' in directory '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09dput(dentry); -=09=09dentry =3D ERR_PTR(-EEXIST); -=09} - -=09if (IS_ERR(dentry)) { -=09=09inode_unlock(d_inode(parent)); -=09=09simple_release_fs(&debugfs); -=09} - -=09return dentry; -} - -static struct dentry *failed_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09dput(dentry); -=09simple_release_fs(&debugfs); -=09return ERR_PTR(-ENOMEM); -} - -static struct dentry *end_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09return dentry; -} - static struct dentry *__debugfs_create_file(const char *name, umode_t mode= , =09=09=09=09struct dentry *parent, void *data, =09=09=09=09const struct file_operations *proxy_fops, @@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const cha= r *name, umode_t mode, =09struct dentry *dentry; =09struct inode *inode; =20 -=09if (!(mode & S_IFMT)) -=09=09mode |=3D S_IFREG; -=09BUG_ON(!S_ISREG(mode)); -=09dentry =3D start_creating(name, parent); - +=09dentry =3D simplefs_create_file(&debugfs, &debug_fs_type, +=09=09=09=09 name, mode, parent, data, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create file '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D mode; -=09inode->i_private =3D data; - =09inode->i_op =3D &debugfs_file_inode_operations; =09inode->i_fop =3D proxy_fops; =09dentry->d_fsdata =3D (void *)((unsigned long)real_fops | =09=09=09=09DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); =20 -=09d_instantiate(dentry, inode); -=09fsnotify_create(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } =20 /** @@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size); */ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dir(&debugfs, &debug_fs_type, +=09=09=09=09 name, 0755, parent, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create directory '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; =09inode->i_op =3D &debugfs_dir_inode_operations; -=09inode->i_fop =3D &simple_dir_operations; - -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_dir); =20 @@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *n= ame, =09=09=09=09=09debugfs_automount_t f, =09=09=09=09=09void *data) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dentry(&debugfs, &debug_fs_type, name, paren= t, +=09=09=09=09=09&inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create automount '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - =09make_empty_dir_inode(inode); =09inode->i_flags |=3D S_AUTOMOUNT; =09inode->i_private =3D data; =09dentry->d_fsdata =3D (void *)f; -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL(debugfs_create_automount); =20 @@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *nam= e, struct dentry *parent, { =09struct dentry *dentry; =09struct inode *inode; -=09char *link =3D kstrdup(target, GFP_KERNEL); -=09if (!link) -=09=09return ERR_PTR(-ENOMEM); =20 -=09dentry =3D start_creating(name, parent); -=09if (IS_ERR(dentry)) { -=09=09kfree(link); +=09dentry =3D simplefs_create_symlink(&debugfs, &debug_fs_type, +=09=09=09=09=09 name, parent, target, &inode); +=09if (IS_ERR(dentry)) =09=09return dentry; -=09} =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create symlink '%s'\n", -=09=09 name); -=09=09kfree(link); -=09=09return failed_creating(dentry); -=09} -=09inode->i_mode =3D S_IFLNK | S_IRWXUGO; =09inode->i_op =3D &debugfs_symlink_inode_operations; -=09inode->i_link =3D link; -=09d_instantiate(dentry, inode); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_symlink); =20 --=20 2.25.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D93C2BB86 for ; Tue, 14 Apr 2020 13:22:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 891872075E for ; Tue, 14 Apr 2020 13:22:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T9XOagZZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 891872075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 491mPZ3ttKzDqCk for ; Tue, 14 Apr 2020 23:22:42 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.81; helo=us-smtp-delivery-1.mimecast.com; envelope-from=eesposit@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T9XOagZZ; dkim-atps=neutral Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 491lYT4xdHzDqZQ for ; Tue, 14 Apr 2020 22:44:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586868266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZ6xsK3V0N91Fk8iBgZd6BgXsfySMhIjcPWAROHMn1Y=; b=T9XOagZZ9qqTvd5vZu43LN2CyGB+XARX1831qR/1OxiwHY4btCe+4FHJ9ujYlpXMmJTwfR s4qKwB73o8Kcw92yLVF4yKIVJrI3jPGlLfhXLDyE0FfyM3tmu7pKjVPXqFiziZtmEMuN4t nuGJ/48CkvpYn97g8C8o167XxaJKThg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-6obAIY5PPkOVLj0CpobG4Q-1; Tue, 14 Apr 2020 08:44:25 -0400 X-MC-Unique: 6obAIY5PPkOVLj0CpobG4Q-1 Received: by mail-wr1-f69.google.com with SMTP id r11so7566391wrx.21 for ; Tue, 14 Apr 2020 05:44:25 -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:mime-version:content-transfer-encoding; bh=41gcpXPXsxw0iFMzm+k+g/C6jCPBlhyC8+dVJ9Pc1fA=; b=pmjC/corQeBb3NqpuSAIUR8WCCItsanqgrzfWib6J6+3GJ68OlE0dkV6AjnsQz17Za AKgQEWCf/5c3n9WlUUtJGiNPjiue+gcmWSXQno4qCiNSKoMSFOTS/WAKsvqwcfpF27gs 0w3kdCrpoqxx87zOMh9YroziyNFC+BCThahjaVZqQt6RnmS6NjLBq9epJpdO0GY6EX1n U59v0jPxYh3ZiUiOTC2SDUFjFjw5vaqS6JUSx4k/TVGBOl2LNnm55QuErr7r1XJ25BKf T+eZ67lqyQlkHsDBGzVksWlgDqjqp/rM3Ym/gdmEJTehHeVbfosEMXjMJXrppE5081WQ WKAA== X-Gm-Message-State: AGi0PuYwvTFU9uX4B9Ypio50aX7ksgu2rO6RlV7MyfNUxmqJwjwSFgAF 8QZtAt8UYM+osnqgwtQidJOA9ew/xn0eyUZkzmNxotge9+UdmPmoGl4SVHGzKZy/1o6fwZkpAzY N4xtS7MfvN0Y4mV/DNDWCP75c8g== X-Received: by 2002:a1c:147:: with SMTP id 68mr24229390wmb.28.1586868264250; Tue, 14 Apr 2020 05:44:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLG15Rdex4MNDkfLSgxNLw13YiMYBHA340JgiTMak7ycYuMs+tWPpamut6Uc41GnMvfLqOpAg== X-Received: by 2002:a1c:147:: with SMTP id 68mr24229312wmb.28.1586868263915; Tue, 14 Apr 2020 05:44:23 -0700 (PDT) Received: from localhost.localdomain ([194.230.155.210]) by smtp.gmail.com with ESMTPSA id m14sm16948816wrs.76.2020.04.14.05.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 05:44:23 -0700 (PDT) From: Emanuele Giuseppe Esposito To: linux-nfs@vger.kernel.org Subject: [PATCH 7/8] debugfs: switch to simplefs inode creation API Date: Tue, 14 Apr 2020 14:43:01 +0200 Message-Id: <20200414124304.4470-8-eesposit@redhat.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Tue, 14 Apr 2020 22:51:51 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , netdev@vger.kernel.org, linux-s390@vger.kernel.org, Christoph Hellwig , Andrew Donnellan , Emanuele Giuseppe Esposito , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Maarten Lankhorst , Uma Krishnan , Maxime Ripard , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Alexander Viro , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , Mike Marciniszyn , Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Anna Schumaker , Luis Chamberlain , Chuck Lever , Jeremy Kerr , Daniel Vetter , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , ocfs2-devel@oss.oracle.com, Joel Becker Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144 +++++---------------------------------------- 1 file changed, 15 insertions(+), 129 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 834b5872ca0d..7a2369373b85 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct= dentry *parent) } EXPORT_SYMBOL_GPL(debugfs_lookup); =20 -static struct dentry *start_creating(const char *name, struct dentry *pare= nt) -{ -=09struct dentry *dentry; -=09int error; - -=09pr_debug("creating file '%s'\n", name); - -=09if (IS_ERR(parent)) -=09=09return parent; - -=09error =3D simple_pin_fs(&debugfs, &debug_fs_type); -=09if (error) { -=09=09pr_err("Unable to pin filesystem for file '%s'\n", name); -=09=09return ERR_PTR(error); -=09} - -=09/* If the parent is not specified, we create it in the root. -=09 * We need the root dentry to do this, which is in the super -=09 * block. A pointer to that is in the struct vfsmount that we -=09 * have around. -=09 */ -=09if (!parent) -=09=09parent =3D debugfs.mount->mnt_root; - -=09inode_lock(d_inode(parent)); -=09if (unlikely(IS_DEADDIR(d_inode(parent)))) -=09=09dentry =3D ERR_PTR(-ENOENT); -=09else -=09=09dentry =3D lookup_one_len(name, parent, strlen(name)); -=09if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { -=09=09if (d_is_dir(dentry)) -=09=09=09pr_err("Directory '%s' with parent '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09else -=09=09=09pr_err("File '%s' in directory '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09dput(dentry); -=09=09dentry =3D ERR_PTR(-EEXIST); -=09} - -=09if (IS_ERR(dentry)) { -=09=09inode_unlock(d_inode(parent)); -=09=09simple_release_fs(&debugfs); -=09} - -=09return dentry; -} - -static struct dentry *failed_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09dput(dentry); -=09simple_release_fs(&debugfs); -=09return ERR_PTR(-ENOMEM); -} - -static struct dentry *end_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09return dentry; -} - static struct dentry *__debugfs_create_file(const char *name, umode_t mode= , =09=09=09=09struct dentry *parent, void *data, =09=09=09=09const struct file_operations *proxy_fops, @@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const cha= r *name, umode_t mode, =09struct dentry *dentry; =09struct inode *inode; =20 -=09if (!(mode & S_IFMT)) -=09=09mode |=3D S_IFREG; -=09BUG_ON(!S_ISREG(mode)); -=09dentry =3D start_creating(name, parent); - +=09dentry =3D simplefs_create_file(&debugfs, &debug_fs_type, +=09=09=09=09 name, mode, parent, data, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create file '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D mode; -=09inode->i_private =3D data; - =09inode->i_op =3D &debugfs_file_inode_operations; =09inode->i_fop =3D proxy_fops; =09dentry->d_fsdata =3D (void *)((unsigned long)real_fops | =09=09=09=09DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); =20 -=09d_instantiate(dentry, inode); -=09fsnotify_create(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } =20 /** @@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size); */ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dir(&debugfs, &debug_fs_type, +=09=09=09=09 name, 0755, parent, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create directory '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; =09inode->i_op =3D &debugfs_dir_inode_operations; -=09inode->i_fop =3D &simple_dir_operations; - -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_dir); =20 @@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *n= ame, =09=09=09=09=09debugfs_automount_t f, =09=09=09=09=09void *data) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dentry(&debugfs, &debug_fs_type, name, paren= t, +=09=09=09=09=09&inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create automount '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - =09make_empty_dir_inode(inode); =09inode->i_flags |=3D S_AUTOMOUNT; =09inode->i_private =3D data; =09dentry->d_fsdata =3D (void *)f; -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL(debugfs_create_automount); =20 @@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *nam= e, struct dentry *parent, { =09struct dentry *dentry; =09struct inode *inode; -=09char *link =3D kstrdup(target, GFP_KERNEL); -=09if (!link) -=09=09return ERR_PTR(-ENOMEM); =20 -=09dentry =3D start_creating(name, parent); -=09if (IS_ERR(dentry)) { -=09=09kfree(link); +=09dentry =3D simplefs_create_symlink(&debugfs, &debug_fs_type, +=09=09=09=09=09 name, parent, target, &inode); +=09if (IS_ERR(dentry)) =09=09return dentry; -=09} =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create symlink '%s'\n", -=09=09 name); -=09=09kfree(link); -=09=09return failed_creating(dentry); -=09} -=09inode->i_mode =3D S_IFLNK | S_IRWXUGO; =09inode->i_op =3D &debugfs_symlink_inode_operations; -=09inode->i_link =3D link; -=09d_instantiate(dentry, inode); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_symlink); =20 --=20 2.25.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E976BC2BA19 for ; Tue, 14 Apr 2020 12:44:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF04220656 for ; Tue, 14 Apr 2020 12:44:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QCkgW4fk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF04220656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FCFE6E0F6; Tue, 14 Apr 2020 12:44:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE6856E0F6 for ; Tue, 14 Apr 2020 12:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586868270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZ6xsK3V0N91Fk8iBgZd6BgXsfySMhIjcPWAROHMn1Y=; b=QCkgW4fk8wFmcCdRhnjuSpbfSzRRe9nToAXIa5zPQtSw1pCiT8TBAMQbQBCLVLrmbeZAbY L+7ZFojA1pGuK4ZygIO9zyxX/yzvzuV99XlSlj0r4Hf0St5RvpUgT8RYRTsEXybFSbcGmF JNKqWxHlGrtl8dTEVg+vdwQQDHvZBRw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-IP1CbYMgMTOsDrMYGtievw-1; Tue, 14 Apr 2020 08:44:25 -0400 X-MC-Unique: IP1CbYMgMTOsDrMYGtievw-1 Received: by mail-wr1-f71.google.com with SMTP id e5so31075wrs.23 for ; Tue, 14 Apr 2020 05:44:25 -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:mime-version:content-transfer-encoding; bh=41gcpXPXsxw0iFMzm+k+g/C6jCPBlhyC8+dVJ9Pc1fA=; b=MlHbtnqMRCxu0Om8hl0IkFY6q1Lav5W7W+2D858Ygg9+oTNARQ6LeRKerZDJL1lOgx WgdFBMmYzRstrAKHStTnCswhBrQsw8vI/HicFt0ZLkM8ja+U2/iVh7PWPgEP/tUHS4bc TK8BtO/pVVtWfncGte0vWXq7vzXaGAScbwIhIBwNyBJI4Q0BoJ4q19Q1cLlxVC70z4Fn yU6326WXx6Ijpyq5Kw/iX0X+nB3HqCGMUcweeIb1ux1VX/MxYdG15tn1wYpx2rxdKMQv pUyxyEWYlSJJbJJOFRu8OHCGzuIf8n4eNLrQgQpCowRGzqZgiKVniKTS+G/lm6+Mw6dn VVYQ== X-Gm-Message-State: AGi0PuaFZrwvmou6NOByX+yl640wKshnbwn2FhjVP4Fj3mHpfjGAg52v Ne4tYAtsHJ4pMgyXh4GsPVPyS+rr5F73lQ8NRCC+mXMcpdM6sHJeA+mMfag1T/p53QSz//0RvA7 uNXym32X8FKxtKzJMcSxxtFlH8WEb X-Received: by 2002:a1c:147:: with SMTP id 68mr24229393wmb.28.1586868264251; Tue, 14 Apr 2020 05:44:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLG15Rdex4MNDkfLSgxNLw13YiMYBHA340JgiTMak7ycYuMs+tWPpamut6Uc41GnMvfLqOpAg== X-Received: by 2002:a1c:147:: with SMTP id 68mr24229312wmb.28.1586868263915; Tue, 14 Apr 2020 05:44:23 -0700 (PDT) Received: from localhost.localdomain ([194.230.155.210]) by smtp.gmail.com with ESMTPSA id m14sm16948816wrs.76.2020.04.14.05.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 05:44:23 -0700 (PDT) From: Emanuele Giuseppe Esposito To: linux-nfs@vger.kernel.org Subject: [PATCH 7/8] debugfs: switch to simplefs inode creation API Date: Tue, 14 Apr 2020 14:43:01 +0200 Message-Id: <20200414124304.4470-8-eesposit@redhat.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , linux-s390@vger.kernel.org, Christoph Hellwig , Andrew Donnellan , Emanuele Giuseppe Esposito , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Michael Ellerman , Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , netdev@vger.kernel.org, Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Uma Krishnan , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Alexander Viro , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , Mike Marciniszyn , Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Anna Schumaker , Luis Chamberlain , Chuck Lever , Jeremy Kerr , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , ocfs2-devel@oss.oracle.com, Joel Becker Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144 +++++---------------------------------------- 1 file changed, 15 insertions(+), 129 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 834b5872ca0d..7a2369373b85 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent) } EXPORT_SYMBOL_GPL(debugfs_lookup); -static struct dentry *start_creating(const char *name, struct dentry *parent) -{ - struct dentry *dentry; - int error; - - pr_debug("creating file '%s'\n", name); - - if (IS_ERR(parent)) - return parent; - - error = simple_pin_fs(&debugfs, &debug_fs_type); - if (error) { - pr_err("Unable to pin filesystem for file '%s'\n", name); - return ERR_PTR(error); - } - - /* If the parent is not specified, we create it in the root. - * We need the root dentry to do this, which is in the super - * block. A pointer to that is in the struct vfsmount that we - * have around. - */ - if (!parent) - parent = debugfs.mount->mnt_root; - - inode_lock(d_inode(parent)); - if (unlikely(IS_DEADDIR(d_inode(parent)))) - dentry = ERR_PTR(-ENOENT); - else - dentry = lookup_one_len(name, parent, strlen(name)); - if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { - if (d_is_dir(dentry)) - pr_err("Directory '%s' with parent '%s' already present!\n", - name, parent->d_name.name); - else - pr_err("File '%s' in directory '%s' already present!\n", - name, parent->d_name.name); - dput(dentry); - dentry = ERR_PTR(-EEXIST); - } - - if (IS_ERR(dentry)) { - inode_unlock(d_inode(parent)); - simple_release_fs(&debugfs); - } - - return dentry; -} - -static struct dentry *failed_creating(struct dentry *dentry) -{ - inode_unlock(d_inode(dentry->d_parent)); - dput(dentry); - simple_release_fs(&debugfs); - return ERR_PTR(-ENOMEM); -} - -static struct dentry *end_creating(struct dentry *dentry) -{ - inode_unlock(d_inode(dentry->d_parent)); - return dentry; -} - static struct dentry *__debugfs_create_file(const char *name, umode_t mode, struct dentry *parent, void *data, const struct file_operations *proxy_fops, @@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode, struct dentry *dentry; struct inode *inode; - if (!(mode & S_IFMT)) - mode |= S_IFREG; - BUG_ON(!S_ISREG(mode)); - dentry = start_creating(name, parent); - + dentry = simplefs_create_file(&debugfs, &debug_fs_type, + name, mode, parent, data, &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create file '%s'\n", - name); - return failed_creating(dentry); - } - - inode->i_mode = mode; - inode->i_private = data; - inode->i_op = &debugfs_file_inode_operations; inode->i_fop = proxy_fops; dentry->d_fsdata = (void *)((unsigned long)real_fops | DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); - d_instantiate(dentry, inode); - fsnotify_create(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } /** @@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size); */ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) { - struct dentry *dentry = start_creating(name, parent); + struct dentry *dentry; struct inode *inode; + dentry = simplefs_create_dir(&debugfs, &debug_fs_type, + name, 0755, parent, &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create directory '%s'\n", - name); - return failed_creating(dentry); - } - - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; inode->i_op = &debugfs_dir_inode_operations; - inode->i_fop = &simple_dir_operations; - - /* directory inodes start off with i_nlink == 2 (for "." entry) */ - inc_nlink(inode); - d_instantiate(dentry, inode); - inc_nlink(d_inode(dentry->d_parent)); - fsnotify_mkdir(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_dir); @@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name, debugfs_automount_t f, void *data) { - struct dentry *dentry = start_creating(name, parent); + struct dentry *dentry; struct inode *inode; + dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent, + &inode); if (IS_ERR(dentry)) return dentry; - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create automount '%s'\n", - name); - return failed_creating(dentry); - } - make_empty_dir_inode(inode); inode->i_flags |= S_AUTOMOUNT; inode->i_private = data; dentry->d_fsdata = (void *)f; - /* directory inodes start off with i_nlink == 2 (for "." entry) */ - inc_nlink(inode); - d_instantiate(dentry, inode); - inc_nlink(d_inode(dentry->d_parent)); - fsnotify_mkdir(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL(debugfs_create_automount); @@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, { struct dentry *dentry; struct inode *inode; - char *link = kstrdup(target, GFP_KERNEL); - if (!link) - return ERR_PTR(-ENOMEM); - dentry = start_creating(name, parent); - if (IS_ERR(dentry)) { - kfree(link); + dentry = simplefs_create_symlink(&debugfs, &debug_fs_type, + name, parent, target, &inode); + if (IS_ERR(dentry)) return dentry; - } - inode = simple_new_inode(dentry->d_sb); - if (unlikely(!inode)) { - pr_err("out of free dentries, can not create symlink '%s'\n", - name); - kfree(link); - return failed_creating(dentry); - } - inode->i_mode = S_IFLNK | S_IRWXUGO; inode->i_op = &debugfs_symlink_inode_operations; - inode->i_link = link; - d_instantiate(dentry, inode); - return end_creating(dentry); + return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_symlink); -- 2.25.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Emanuele Giuseppe Esposito Subject: [PATCH 7/8] debugfs: switch to simplefs inode creation API Date: Tue, 14 Apr 2020 14:43:01 +0200 Message-ID: <20200414124304.4470-8-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586868266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZ6xsK3V0N91Fk8iBgZd6BgXsfySMhIjcPWAROHMn1Y=; b=T9XOagZZ9qqTvd5vZu43LN2CyGB+XARX1831qR/1OxiwHY4btCe+4FHJ9ujYlpXMmJTwfR s4qKwB73o8Kcw92yLVF4yKIVJrI3jPGlLfhXLDyE0FfyM3tmu7pKjVPXqFiziZtmEMuN4t nuGJ/48CkvpYn97g8C8o167XxaJKThg= In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane-mx.org@lists.ozlabs.org Sender: "Linuxppc-dev" Content-Type: text/plain; charset="us-ascii" To: linux-nfs@vger.kernel.org Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , netdev@vger.kernel.org, linux-s390@vger.kernel.org, Christoph Hellwig , Andrew Donnellan , Emanuele Giuseppe Esposito , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Mark Fasheh The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144 +++++---------------------------------------- 1 file changed, 15 insertions(+), 129 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 834b5872ca0d..7a2369373b85 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct= dentry *parent) } EXPORT_SYMBOL_GPL(debugfs_lookup); =20 -static struct dentry *start_creating(const char *name, struct dentry *pare= nt) -{ -=09struct dentry *dentry; -=09int error; - -=09pr_debug("creating file '%s'\n", name); - -=09if (IS_ERR(parent)) -=09=09return parent; - -=09error =3D simple_pin_fs(&debugfs, &debug_fs_type); -=09if (error) { -=09=09pr_err("Unable to pin filesystem for file '%s'\n", name); -=09=09return ERR_PTR(error); -=09} - -=09/* If the parent is not specified, we create it in the root. -=09 * We need the root dentry to do this, which is in the super -=09 * block. A pointer to that is in the struct vfsmount that we -=09 * have around. -=09 */ -=09if (!parent) -=09=09parent =3D debugfs.mount->mnt_root; - -=09inode_lock(d_inode(parent)); -=09if (unlikely(IS_DEADDIR(d_inode(parent)))) -=09=09dentry =3D ERR_PTR(-ENOENT); -=09else -=09=09dentry =3D lookup_one_len(name, parent, strlen(name)); -=09if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { -=09=09if (d_is_dir(dentry)) -=09=09=09pr_err("Directory '%s' with parent '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09else -=09=09=09pr_err("File '%s' in directory '%s' already present!\n", -=09=09=09 name, parent->d_name.name); -=09=09dput(dentry); -=09=09dentry =3D ERR_PTR(-EEXIST); -=09} - -=09if (IS_ERR(dentry)) { -=09=09inode_unlock(d_inode(parent)); -=09=09simple_release_fs(&debugfs); -=09} - -=09return dentry; -} - -static struct dentry *failed_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09dput(dentry); -=09simple_release_fs(&debugfs); -=09return ERR_PTR(-ENOMEM); -} - -static struct dentry *end_creating(struct dentry *dentry) -{ -=09inode_unlock(d_inode(dentry->d_parent)); -=09return dentry; -} - static struct dentry *__debugfs_create_file(const char *name, umode_t mode= , =09=09=09=09struct dentry *parent, void *data, =09=09=09=09const struct file_operations *proxy_fops, @@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const cha= r *name, umode_t mode, =09struct dentry *dentry; =09struct inode *inode; =20 -=09if (!(mode & S_IFMT)) -=09=09mode |=3D S_IFREG; -=09BUG_ON(!S_ISREG(mode)); -=09dentry =3D start_creating(name, parent); - +=09dentry =3D simplefs_create_file(&debugfs, &debug_fs_type, +=09=09=09=09 name, mode, parent, data, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create file '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D mode; -=09inode->i_private =3D data; - =09inode->i_op =3D &debugfs_file_inode_operations; =09inode->i_fop =3D proxy_fops; =09dentry->d_fsdata =3D (void *)((unsigned long)real_fops | =09=09=09=09DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); =20 -=09d_instantiate(dentry, inode); -=09fsnotify_create(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } =20 /** @@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size); */ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dir(&debugfs, &debug_fs_type, +=09=09=09=09 name, 0755, parent, &inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create directory '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - -=09inode->i_mode =3D S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; =09inode->i_op =3D &debugfs_dir_inode_operations; -=09inode->i_fop =3D &simple_dir_operations; - -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_dir); =20 @@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *n= ame, =09=09=09=09=09debugfs_automount_t f, =09=09=09=09=09void *data) { -=09struct dentry *dentry =3D start_creating(name, parent); +=09struct dentry *dentry; =09struct inode *inode; =20 +=09dentry =3D simplefs_create_dentry(&debugfs, &debug_fs_type, name, paren= t, +=09=09=09=09=09&inode); =09if (IS_ERR(dentry)) =09=09return dentry; =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create automount '%s'\n", -=09=09 name); -=09=09return failed_creating(dentry); -=09} - =09make_empty_dir_inode(inode); =09inode->i_flags |=3D S_AUTOMOUNT; =09inode->i_private =3D data; =09dentry->d_fsdata =3D (void *)f; -=09/* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ -=09inc_nlink(inode); -=09d_instantiate(dentry, inode); -=09inc_nlink(d_inode(dentry->d_parent)); -=09fsnotify_mkdir(d_inode(dentry->d_parent), dentry); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL(debugfs_create_automount); =20 @@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *nam= e, struct dentry *parent, { =09struct dentry *dentry; =09struct inode *inode; -=09char *link =3D kstrdup(target, GFP_KERNEL); -=09if (!link) -=09=09return ERR_PTR(-ENOMEM); =20 -=09dentry =3D start_creating(name, parent); -=09if (IS_ERR(dentry)) { -=09=09kfree(link); +=09dentry =3D simplefs_create_symlink(&debugfs, &debug_fs_type, +=09=09=09=09=09 name, parent, target, &inode); +=09if (IS_ERR(dentry)) =09=09return dentry; -=09} =20 -=09inode =3D simple_new_inode(dentry->d_sb); -=09if (unlikely(!inode)) { -=09=09pr_err("out of free dentries, can not create symlink '%s'\n", -=09=09 name); -=09=09kfree(link); -=09=09return failed_creating(dentry); -=09} -=09inode->i_mode =3D S_IFLNK | S_IRWXUGO; =09inode->i_op =3D &debugfs_symlink_inode_operations; -=09inode->i_link =3D link; -=09d_instantiate(dentry, inode); -=09return end_creating(dentry); +=09return simplefs_finish_dentry(dentry, inode); } EXPORT_SYMBOL_GPL(debugfs_create_symlink); =20 --=20 2.25.2