From: Manish Katiyar Subject: [PATCH]: Return better error code from vfs_unlink if operation is not defined. Date: Fri, 16 Jan 2009 11:13:04 +0530 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: mkatiyar@gmail.com To: linux-fsdevel@vger.kernel.org, Al Viro , Matthew Wilcox Return-path: Received: from ti-out-0910.google.com ([209.85.142.185]:35191 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbZAPFnF (ORCPT ); Fri, 16 Jan 2009 00:43:05 -0500 Received: by ti-out-0910.google.com with SMTP id b6so811080tic.23 for ; Thu, 15 Jan 2009 21:43:04 -0800 (PST) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, If the unlink function is not defined by filesystem, then I think it is better to return operation not supported rather than saying permission denied, which can come from lot other places and keep user guessing what went wrong. I came across this while testing one of my small modules. Signed-off-by: Manish Katiyar --- fs/namei.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index bbc15c2..02c8d7f 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2208,7 +2208,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) return error; if (!dir->i_op->unlink) - return -EPERM; + return -EOPNOTSUPP; DQUOT_INIT(dir); -- 1.5.4.3 Thanks - Manish