Roman Pen
a8f324a46f
debugfs: fix inode i_nlink references for automount dentry
...
Directory inodes should start off with i_nlink == 2 (one extra ref
for "." entry). debugfs_create_automount() increases neither the
i_nlink reference for current inode nor for parent inode.
On attempt to remove the automount dentry, kernel complains:
[ 86.288070] WARNING: CPU: 1 PID: 3616 at fs/inode.c:273 drop_nlink+0x3e/0x50()
[ 86.288461] Modules linked in: debugfs_example2(O-)
[ 86.288745] CPU: 1 PID: 3616 Comm: rmmod Tainted: G O 4.4.0-rc3-next-20151207+ #135
[ 86.289197] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.2-20150617_082717-anatol 04/01/2014
[ 86.289696] ffffffff81be05c9 ffff8800b9e6fda0 ffffffff81352e2c 0000000000000000
[ 86.290110] ffff8800b9e6fdd8 ffffffff81065142 ffff8801399175e8 ffff8800bb78b240
[ 86.290507] ffff8801399175e8 ffff8800b73d7898 ffff8800b73d7840 ffff8800b9e6fde8
[ 86.290933] Call Trace:
[ 86.291080] [<ffffffff81352e2c>] dump_stack+0x4e/0x82
[ 86.291340] [<ffffffff81065142>] warn_slowpath_common+0x82/0xc0
[ 86.291640] [<ffffffff8106523a>] warn_slowpath_null+0x1a/0x20
[ 86.291932] [<ffffffff811ae62e>] drop_nlink+0x3e/0x50
[ 86.292208] [<ffffffff811ba35b>] simple_unlink+0x4b/0x60
[ 86.292481] [<ffffffff811ba3a7>] simple_rmdir+0x37/0x50
[ 86.292748] [<ffffffff812d9808>] __debugfs_remove.part.16+0xa8/0xd0
[ 86.293082] [<ffffffff812d9a0b>] debugfs_remove_recursive+0xdb/0x1c0
[ 86.293406] [<ffffffffa00004dd>] cleanup_module+0x2d/0x3b [debugfs_example2]
[ 86.293762] [<ffffffff810d959b>] SyS_delete_module+0x16b/0x220
[ 86.294077] [<ffffffff818ef857>] entry_SYSCALL_64_fastpath+0x12/0x6a
[ 86.294405] ---[ end trace c9fc53353fe14a36 ]---
[ 86.294639] ------------[ cut here ]------------
To reproduce the issue it is enough to invoke these lines:
autom = debugfs_create_automount("automount", NULL, vfsmount_cb, data);
BUG_ON(IS_ERR_OR_NULL(autom));
debugfs_remove(autom);
The issue is fixed by increasing inode i_nlink references for current
and parent inodes.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-29 10:11:44 -07:00
..
2016-01-22 18:04:28 -05:00
2016-01-20 17:09:18 -08:00
2016-02-20 00:15:51 -05:00
2016-01-22 18:04:28 -05:00
2016-03-19 18:52:29 -07:00
2016-01-14 16:00:49 -08:00
2016-01-14 16:00:49 -08:00
2016-03-21 18:12:42 -07:00
2016-02-01 12:30:10 -05:00
2016-03-25 18:51:56 +01:00
2016-03-19 18:52:29 -07:00
2016-01-23 12:24:56 -08:00
2016-03-19 18:52:29 -07:00
2015-12-08 22:41:36 -05:00
2016-03-26 10:13:05 -07:00
2016-03-29 10:11:44 -07:00
2016-02-06 23:45:46 -08:00
2016-03-17 16:38:36 -07:00
2016-03-23 06:12:39 -07:00
2016-02-10 16:25:52 +00:00
2016-01-14 16:00:49 -08:00
2016-01-22 18:04:28 -05:00
2016-01-22 18:04:28 -05:00
2016-03-17 16:31:18 -07:00
2016-03-22 15:36:02 -07:00
2016-03-17 21:19:47 -07:00
2016-03-22 15:36:02 -07:00
2015-12-08 22:41:36 -05:00
2015-11-11 02:11:02 -05:00
2016-03-16 14:38:31 +01:00
2016-03-17 16:51:32 -07:00
2016-01-22 18:04:28 -05:00
2016-01-22 18:04:28 -05:00
2016-01-22 18:04:28 -05:00
2016-02-27 19:15:51 -05:00
2016-01-22 18:04:28 -05:00
2016-01-14 16:00:49 -08:00
2016-03-13 17:38:20 -04:00
2016-03-24 19:57:15 -07:00
2016-01-22 18:04:28 -05:00
2016-03-21 10:05:13 -07:00
2016-01-07 10:10:50 -05:00
2016-01-22 18:04:28 -05:00
2016-01-14 16:00:49 -08:00
2016-03-07 22:25:16 -05:00
2016-03-24 19:50:32 -07:00
2015-08-13 10:22:06 -04:00
2016-03-24 19:50:32 -07:00
2016-03-17 15:09:34 -07:00
2016-02-18 16:23:24 -08:00
2016-01-22 18:04:28 -05:00
2016-03-25 16:37:42 -07:00
2016-01-14 16:00:49 -08:00
2016-03-26 07:22:00 -04:00
2016-03-21 17:31:46 +01:00
2016-03-21 10:05:13 -07:00
2016-03-10 09:43:36 -08:00
2016-01-14 16:00:49 -08:00
2016-01-14 16:00:49 -08:00
2016-03-21 12:22:37 -07:00
2015-12-08 22:41:36 -05:00
2016-02-09 13:05:23 +01:00
2016-01-14 16:00:49 -08:00
2016-01-14 16:00:49 -08:00
2015-11-13 21:53:18 -08:00
2016-01-14 16:00:49 -08:00
2016-01-22 18:04:28 -05:00
2016-03-20 21:37:46 +01:00
2016-02-09 13:05:23 +01:00
2016-01-14 16:00:49 -08:00
2016-03-24 19:50:32 -07:00
2015-09-04 16:54:41 -07:00
2016-01-22 18:04:28 -05:00
2015-12-06 21:17:14 -05:00
2015-11-10 12:07:22 -08:00
2016-02-27 10:28:52 -08:00
2016-01-22 18:04:28 -05:00
2016-03-18 16:43:11 -07:00
2016-03-15 16:55:16 -07:00
2016-03-29 10:11:44 -07:00
2016-02-14 14:25:59 -08:00
2016-01-04 10:28:32 -05:00
2016-03-22 15:36:02 -07:00
2016-03-21 11:53:05 -07:00
2016-03-14 00:17:38 -04:00
2016-03-21 11:53:05 -07:00
2015-08-17 18:39:46 -04:00
2016-03-22 15:36:02 -07:00
2016-03-17 15:09:34 -07:00
2016-03-20 19:08:56 -07:00
2016-01-09 02:55:37 -05:00
2016-03-22 15:36:02 -07:00
2015-08-07 04:39:40 +03:00
2016-01-14 16:00:49 -08:00
2016-01-19 12:02:23 -05:00
2016-03-20 09:44:20 -06:00
2016-02-16 14:57:21 -07:00
2016-01-08 21:20:11 -05:00
2016-01-22 18:04:28 -05:00
2016-03-26 12:59:04 -07:00
2016-01-22 18:04:28 -05:00
2016-01-22 18:04:28 -05:00
2016-03-26 12:59:04 -07:00
2016-02-22 22:44:04 -05:00
2015-06-30 19:44:56 -07:00
2016-03-15 16:55:16 -07:00
2016-03-14 00:16:33 -04:00
2016-01-22 18:04:28 -05:00
2015-09-11 15:21:34 -07:00
2016-03-22 15:36:02 -07:00
2016-01-19 19:25:21 -05:00
2016-02-20 00:15:52 -05:00
2015-07-22 20:33:27 -05:00
2015-12-13 19:46:12 -05:00
2016-03-16 13:09:08 -04:00
2016-03-18 16:07:38 -04:00
2016-01-22 18:04:28 -05:00
2016-03-17 15:09:34 -07:00
2015-11-06 17:50:42 -08:00
2015-08-07 04:39:40 +03:00
2016-03-18 16:07:38 -04:00
2016-01-16 11:17:23 -08:00
2016-03-03 14:42:50 -07:00
2015-11-06 17:50:42 -08:00
2016-01-17 11:13:55 +01:00
2016-03-02 09:03:18 -08:00
2016-01-22 18:04:28 -05:00
2016-02-20 00:15:51 -05:00