summaryrefslogtreecommitdiffstats
path: root/fs/debugfs/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 15:24:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 15:24:03 -0400
commitf632a8170a6b667ee4e3f552087588f0fe13c4bb (patch)
tree9fbdd3505f1471364265727dea1bc9d034cbed8f /fs/debugfs/inode.c
parentef8f3d48afd6a17a0dae8c277c2f539c2f19fd16 (diff)
parentc33d442328f556460b79aba6058adb37bb555389 (diff)
Merge tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core and debugfs updates from Greg KH: "Here is the "big" driver core and debugfs changes for 5.3-rc1 It's a lot of different patches, all across the tree due to some api changes and lots of debugfs cleanups. Other than the debugfs cleanups, in this set of changes we have: - bus iteration function cleanups - scripts/get_abi.pl tool to display and parse Documentation/ABI entries in a simple way - cleanups to Documenatation/ABI/ entries to make them parse easier due to typos and other minor things - default_attrs use for some ktype users - driver model documentation file conversions to .rst - compressed firmware file loading - deferred probe fixes All of these have been in linux-next for a while, with a bunch of merge issues that Stephen has been patient with me for" * tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (102 commits) debugfs: make error message a bit more verbose orangefs: fix build warning from debugfs cleanup patch ubifs: fix build warning after debugfs cleanup patch driver: core: Allow subsystems to continue deferring probe drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT arch_topology: Remove error messages on out-of-memory conditions lib: notifier-error-inject: no need to check return value of debugfs_create functions swiotlb: no need to check return value of debugfs_create functions ceph: no need to check return value of debugfs_create functions sunrpc: no need to check return value of debugfs_create functions ubifs: no need to check return value of debugfs_create functions orangefs: no need to check return value of debugfs_create functions nfsd: no need to check return value of debugfs_create functions lib: 842: no need to check return value of debugfs_create functions debugfs: provide pr_fmt() macro debugfs: log errors when something goes wrong drivers: s390/cio: Fix compilation warning about const qualifiers drivers: Add generic helper to match by of_node driver_find_device: Unify the match function with class_find_device() bus_find_device: Unify the match callback with class_find_device ...
Diffstat (limited to 'fs/debugfs/inode.c')
-rw-r--r--fs/debugfs/inode.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 1e444fe1f778..042b688ed124 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -2,13 +2,16 @@
2/* 2/*
3 * inode.c - part of debugfs, a tiny little debug file system 3 * inode.c - part of debugfs, a tiny little debug file system
4 * 4 *
5 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 5 * Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
6 * Copyright (C) 2004 IBM Inc. 6 * Copyright (C) 2004 IBM Inc.
7 * Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
7 * 8 *
8 * debugfs is for people to use instead of /proc or /sys. 9 * debugfs is for people to use instead of /proc or /sys.
9 * See ./Documentation/core-api/kernel-api.rst for more details. 10 * See ./Documentation/core-api/kernel-api.rst for more details.
10 */ 11 */
11 12
13#define pr_fmt(fmt) "debugfs: " fmt
14
12#include <linux/module.h> 15#include <linux/module.h>
13#include <linux/fs.h> 16#include <linux/fs.h>
14#include <linux/mount.h> 17#include <linux/mount.h>
@@ -285,15 +288,17 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
285 struct dentry *dentry; 288 struct dentry *dentry;
286 int error; 289 int error;
287 290
288 pr_debug("debugfs: creating file '%s'\n",name); 291 pr_debug("creating file '%s'\n", name);
289 292
290 if (IS_ERR(parent)) 293 if (IS_ERR(parent))
291 return parent; 294 return parent;
292 295
293 error = simple_pin_fs(&debug_fs_type, &debugfs_mount, 296 error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
294 &debugfs_mount_count); 297 &debugfs_mount_count);
295 if (error) 298 if (error) {
299 pr_err("Unable to pin filesystem for file '%s'\n", name);
296 return ERR_PTR(error); 300 return ERR_PTR(error);
301 }
297 302
298 /* If the parent is not specified, we create it in the root. 303 /* If the parent is not specified, we create it in the root.
299 * We need the root dentry to do this, which is in the super 304 * We need the root dentry to do this, which is in the super
@@ -306,6 +311,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
306 inode_lock(d_inode(parent)); 311 inode_lock(d_inode(parent));
307 dentry = lookup_one_len(name, parent, strlen(name)); 312 dentry = lookup_one_len(name, parent, strlen(name));
308 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { 313 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
314 if (d_is_dir(dentry))
315 pr_err("Directory '%s' with parent '%s' already present!\n",
316 name, parent->d_name.name);
317 else
318 pr_err("File '%s' in directory '%s' already present!\n",
319 name, parent->d_name.name);
309 dput(dentry); 320 dput(dentry);
310 dentry = ERR_PTR(-EEXIST); 321 dentry = ERR_PTR(-EEXIST);
311 } 322 }
@@ -349,8 +360,11 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
349 return dentry; 360 return dentry;
350 361
351 inode = debugfs_get_inode(dentry->d_sb); 362 inode = debugfs_get_inode(dentry->d_sb);
352 if (unlikely(!inode)) 363 if (unlikely(!inode)) {
364 pr_err("out of free dentries, can not create file '%s'\n",
365 name);
353 return failed_creating(dentry); 366 return failed_creating(dentry);
367 }
354 368
355 inode->i_mode = mode; 369 inode->i_mode = mode;
356 inode->i_private = data; 370 inode->i_private = data;
@@ -511,8 +525,11 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
511 return dentry; 525 return dentry;
512 526
513 inode = debugfs_get_inode(dentry->d_sb); 527 inode = debugfs_get_inode(dentry->d_sb);
514 if (unlikely(!inode)) 528 if (unlikely(!inode)) {
529 pr_err("out of free dentries, can not create directory '%s'\n",
530 name);
515 return failed_creating(dentry); 531 return failed_creating(dentry);
532 }
516 533
517 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; 534 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
518 inode->i_op = &simple_dir_inode_operations; 535 inode->i_op = &simple_dir_inode_operations;
@@ -550,8 +567,11 @@ struct dentry *debugfs_create_automount(const char *name,
550 return dentry; 567 return dentry;
551 568
552 inode = debugfs_get_inode(dentry->d_sb); 569 inode = debugfs_get_inode(dentry->d_sb);
553 if (unlikely(!inode)) 570 if (unlikely(!inode)) {
571 pr_err("out of free dentries, can not create automount '%s'\n",
572 name);
554 return failed_creating(dentry); 573 return failed_creating(dentry);
574 }
555 575
556 make_empty_dir_inode(inode); 576 make_empty_dir_inode(inode);
557 inode->i_flags |= S_AUTOMOUNT; 577 inode->i_flags |= S_AUTOMOUNT;
@@ -606,6 +626,8 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
606 626
607 inode = debugfs_get_inode(dentry->d_sb); 627 inode = debugfs_get_inode(dentry->d_sb);
608 if (unlikely(!inode)) { 628 if (unlikely(!inode)) {
629 pr_err("out of free dentries, can not create symlink '%s'\n",
630 name);
609 kfree(link); 631 kfree(link);
610 return failed_creating(dentry); 632 return failed_creating(dentry);
611 } 633 }