trelay: fix deadlock on remove
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
Wed, 25 Sep 2019 14:47:12 +0000 (17:47 +0300)
committerRISCi_ATOM <bob@bobcall.me>
Wed, 23 Oct 2019 15:36:45 +0000 (11:36 -0400)
commit550ceaa74c3a068dca5152af1dfb200af7cc090e
tree22c0e0fcf727c8e5e8e7bfca98bf096bbe4c345f
parentf7a087029e8d20d442ccccfd44b8098f41e22609
trelay: fix deadlock on remove

Upon writing to "remove" file, debugfs_remove_recursive() blocks while
holding rtnl_lock. This is because debugfs' file_ops callbacks are
executed in debugfs_use_file_*() context which prevents file removal.

Fix this by only flagging the device for removal and then do the cleanup
in file_ops.release callback which is executed out of that context.

Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
(cherry picked from commit c2635b871d1dd03a6608a9255222672decd49e09)
package/kernel/trelay/src/trelay.c