From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: Fabian Frederick <fabf@skynet.be>, Chris Mason <clm@fb.com>,
Josef Bacik <jbacik@fb.com>, David Sterba <dsterba@suse.cz>,
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 [thread overview]
Message-ID: <1432223732-19057-1-git-send-email-fabf@skynet.be> (raw)
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:<user>: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 <fabf@skynet.be>
---
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))
--
2.4.1
reply other threads:[~2015-05-21 15:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432223732-19057-1-git-send-email-fabf@skynet.be \
--to=fabf@skynet.be \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).