From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752389AbbJNCr7 (ORCPT ); Tue, 13 Oct 2015 22:47:59 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:8450 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbbJNCr6 (ORCPT ); Tue, 13 Oct 2015 22:47:58 -0400 From: Tan Xiaojun To: CC: Subject: [PATCH] debugfs: update commits of debugfs_remove Date: Wed, 14 Oct 2015 10:53:57 +0800 Message-ID: <1444791237-105846-1-git-send-email-tanxiaojun@huawei.com> X-Mailer: git-send-email 2.5.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.38] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.561DC25B.0105,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2f96a86921585ddeecd82f9ad323bfe9 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function debugfs_remove can't remove a directory if it is not empty. The commits make misunderstood and cause misuse easily, so update it. Signed-off-by: Tan Xiaojun --- fs/debugfs/inode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index c711be8..350754e 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -531,7 +531,8 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) } /** - * debugfs_remove - removes a file or directory from the debugfs filesystem + * debugfs_remove - removes a file or an empty directory from the debugfs + * filesystem * @dentry: a pointer to a the dentry of the file or directory to be * removed. * @@ -542,6 +543,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) * This function is required to be called in order for the file to be * removed, no automatic cleanup of files will happen when a module is * removed, you are responsible here. + * + * For removing directory, if you are not sure it is empty or not, use + * debugfs_remove_recursive instead. */ void debugfs_remove(struct dentry *dentry) { -- 2.5.3