From patchwork Thu Oct 19 19:41:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 10018213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C16A660215 for ; Thu, 19 Oct 2017 19:41:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B186D28DED for ; Thu, 19 Oct 2017 19:41:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A58CD28E3F; Thu, 19 Oct 2017 19:41:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4899028DED for ; Thu, 19 Oct 2017 19:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752975AbdJSTlX (ORCPT ); Thu, 19 Oct 2017 15:41:23 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=qwfMI+vCoSkc4IpzIZrTwx9BtAVmp8PY3lhtJUormUU=; b=U4WhMzfFXavZgnXbNqxlfV5lDJeWXFCEASbGt10VORkXk86t9ZCehdDNPZIXflaEFc oCcODhxp/kRkw5Qj/BYI3o/SIQx3b1ymxBZGyXhaJ8fKUxP3kz0XEpbeC3dQeFKcehd9 1aBV+jdI5vh1hRKPjJWRneG6aowal3ey1AzvLPEnr1yCj9WkZVSqpCJVifemYaa3zulG lxqfCgP79OKIvL+66j85lDHiihu8Ef8mx/O57cWHTmOHxukAJn7lQy8JLtePCAhhiz2j f0CKguTGn0hxv9jm9uQRrZ71TxVYJ2bWKvqRN7Ma2d8HbeIuaoIanfyE0cm9bdnQc+tq mHLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=qwfMI+vCoSkc4IpzIZrTwx9BtAVmp8PY3lhtJUormUU=; b=sAGE7zulSQKx0wO/ZmTZ37azsjWWcgUG1PggpOud/4pGi/wn1SZkLQXkCKZSh58rQP jal9pQXCVnqiFGaevrXy9AprqBGcHJE8EBY3AGYtdpEXVtuTIe0AXn4MynmryVaLY9Ov IPaMVpQHgDpY1cOJ+sV2Ht67Z9mXUmLkC+B9FH+e199tndjlWxpDFd+MQTzNbCWWgDz3 OvXdegsoZjAkMpu/4K8hvK3IM4Z1+SPHTK+oJAOKXu4Yq61oWppqT+LYrv2fsrYp5krh wL9tXWlZigXGRgHpCuqAHJtpptk4Qo3Xu3eTWwRuazPwH0ca7CfzdNKOVHvTMTtFeh1K rWDA== X-Gm-Message-State: AMCzsaUmmbMzUV32JLj3qmPi2kRWuYjQ5uorwWuw37TdZoTXFZNRAfHv 9fpYNAIDNhgpTsKRgQ3E6xOhsw== X-Google-Smtp-Source: ABhQp+T4+PeqAUEWnrssYLS3wTt0BON48XIJf+pI2wT/4V+66qGrOysjTJ4iTdReEG+JNHk4fcx97w== X-Received: by 10.237.63.17 with SMTP id p17mr3874039qtf.235.1508442082209; Thu, 19 Oct 2017 12:41:22 -0700 (PDT) Received: from debian.home ([181.47.183.103]) by smtp.gmail.com with ESMTPSA id i27sm6978853qtc.91.2017.10.19.12.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 12:41:21 -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-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;