From patchwork Thu May 21 15:55:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 6456811 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D9AD2C0020 for ; Thu, 21 May 2015 15:56:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1309C20490 for ; Thu, 21 May 2015 15:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25C2E20450 for ; Thu, 21 May 2015 15:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755072AbbEUPzl (ORCPT ); Thu, 21 May 2015 11:55:41 -0400 Received: from mailrelay101.isp.belgacom.be ([195.238.20.128]:45811 "EHLO mailrelay101.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbbEUPzi (ORCPT ); Thu, 21 May 2015 11:55:38 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=aVuRYB9jFzFsbHnyIO6WTXMsFsysg296qeRS+2aVNsk= c=1 sm=2 a=0lChHLD-54bqpzZXwyYA:9 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BwKQD6/l1V/+IttFtcgxCBMoFBr0AFAQEBAQEBBQGBBJhSgUdNAQEBAQEBgQuEfyOBGjeIMAHSHoYWiikdhBcFi02SNI0Pig4jYWYBCxOCFDwxgkcBAQE Received: from 226.45-180-91.adsl-dyn.isp.belgacom.be (HELO localhost.home.) ([91.180.45.226]) by relay.skynet.be with ESMTP; 21 May 2015 17:55:36 +0200 From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Fabian Frederick , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 1/1 linux-next] btrfs: remove -ENOENT from test values in btrfs_get_acl() Date: Thu, 21 May 2015 17:55:32 +0200 Message-Id: <1432223732-19057-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.4.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP btrfs_get_acl() calls __btrfs_getxattr() and checks for returned value to assign acl. Like FIXME presumed, -ENOENT is not part of those possible values. btrfs_search_slot() explicitly returns 1 when the key isn't found (see function comment). This patch also simplifies code by giving NULL value to acl by default. Previous behavior remains the same: mkdir d1 (remount) getfacl d1 system.posix_acl_access: size: ENODATA acl: NULL system.posix_acl_default size: ENODATA acl: NULL setfacl -d -m o::rw d1 (remount) getfacl d1 system.posix_acl_access: size: ENODATA acl: NULL system.posix_acl_default size: 28 acl not NULL setfacl -m u::r d1 (remount) getfacl d1 system.posix_acl_access: size: 44 acl: not NULL system.posix_acl_default: size: 28 acl: not NULL setfacl -k d1 (remount) getfacl d1 system.posix_acl_access: size: 44 acl: not NULL system.posix_acl_default: size: ENODATA acl: NULL Signed-off-by: Fabian Frederick --- fs/btrfs/acl.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 9a0124a..988cc52 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -33,7 +33,7 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type) int size; const char *name; char *value = NULL; - struct posix_acl *acl; + struct posix_acl *acl = NULL; switch (type) { case ACL_TYPE_ACCESS: @@ -53,14 +53,10 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type) return ERR_PTR(-ENOMEM); size = __btrfs_getxattr(inode, name, value, size); } - if (size > 0) { + if (size > 0) acl = posix_acl_from_xattr(&init_user_ns, value, size); - } else if (size == -ENOENT || size == -ENODATA || size == 0) { - /* FIXME, who returns -ENOENT? I think nobody */ - acl = NULL; - } else { + else if (size && size != -ENODATA) acl = ERR_PTR(-EIO); - } kfree(value); if (!IS_ERR(acl))