From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josef Bacik Subject: [PATCH] fs: allow user.* xattrs on symlinks Date: Tue, 16 Aug 2011 15:13:19 -0400 Message-ID: <1313521999-19760-1-git-send-email-josef@redhat.com> To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59500 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416Ab1HPTNW (ORCPT ); Tue, 16 Aug 2011 15:13:22 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: I ran into this when I was trying to track down a lsetxattr bug on btrfs. Apparently we're not allowed to set user.* xattrs on symlinks, but theres no really clear reason why, and I should be able to use user.* for testing rather than having to use trusted.*. Thanks, Signed-off-by: Josef Bacik --- fs/xattr.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index f060663..22f231f 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -55,12 +55,13 @@ xattr_permission(struct inode *inode, const char *name, int mask) } /* - * In the user.* namespace, only regular files and directories can have - * extended attributes. For sticky directories, only the owner and - * privileged users can write attributes. + * In the user.* namespace, only regular files, directories links + * can have extended attributes. For sticky directories, only the owner + * and privileged users can write attributes. */ if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) { - if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && + !S_ISLNK(inode->i_mode)) return (mask & MAY_WRITE) ? -EPERM : -ENODATA; if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) && (mask & MAY_WRITE) && !inode_owner_or_capable(inode)) -- 1.7.5.2