From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f195.google.com ([209.85.216.195]:51201 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753301AbdJSTlW (ORCPT ); Thu, 19 Oct 2017 15:41:22 -0400 Received: by mail-qt0-f195.google.com with SMTP id h4so15868808qtk.8 for ; Thu, 19 Oct 2017 12:41:22 -0700 (PDT) Date: Thu, 19 Oct 2017 16:41:17 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: linux-fsdevel@vger.kernel.org Cc: Al Viro , Andreas Gruenbacher , Hin-Tak Leung , Vyacheslav Dubeyko , Andrew Morton , Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= Subject: [PATCH] hfsplus: return ENODATA when no xattr is found Message-ID: <20171019194114.GA4045@debian.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: There are several points in the code where ENOENT or EOPNOTSUPP are used to signal that an extended attribute does not exist. This is clearly noticeable from the odd error messages shown by setfattr and getfattr. Use ENODATA instead. Signed-off-by: Ernesto A. Fernández --- fs/hfsplus/attributes.c | 6 ++++-- fs/hfsplus/xattr.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c index e5b221d..77b0d40 100644 --- a/fs/hfsplus/attributes.c +++ b/fs/hfsplus/attributes.c @@ -268,7 +268,7 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid, offsetof(struct hfsplus_attr_key, cnid), sizeof(__be32)); if (cnid != be32_to_cpu(found_cnid)) - return -ENOENT; + return -ENODATA; hfs_bnode_read(fd->bnode, &record_type, fd->entryoffset, sizeof(record_type)); @@ -283,7 +283,7 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid, return -EOPNOTSUPP; default: pr_err("invalid extended attribute record\n"); - return -ENOENT; + return -ENODATA; } err = hfs_brec_remove(fd); @@ -324,6 +324,8 @@ int hfsplus_delete_attr(struct inode *inode, const char *name) } err = hfs_brec_find(&fd, hfs_find_rec_by_key); + if (err == -ENOENT) + err = -ENODATA; if (err) goto out; diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index d37bb88..814082c 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c @@ -511,7 +511,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, return hfsplus_getxattr_finder_info(inode, value, size); if (!HFSPLUS_SB(inode->i_sb)->attr_tree) - return -EOPNOTSUPP; + return -ENODATA; entry = hfsplus_alloc_attr_entry(); if (!entry) { @@ -697,7 +697,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) if (res < 0) return res; else if (!HFSPLUS_SB(inode->i_sb)->attr_tree) - return (res == 0) ? -EOPNOTSUPP : res; + return (res == 0) ? -ENODATA : res; err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->attr_tree, &fd); if (err) { @@ -780,7 +780,7 @@ static int hfsplus_removexattr(struct inode *inode, const char *name) int is_all_xattrs_deleted = 0; if (!HFSPLUS_SB(inode->i_sb)->attr_tree) - return -EOPNOTSUPP; + return -ENODATA; if (!strcmp_xattr_finder_info(name)) return -EOPNOTSUPP; -- 2.1.4