This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: XFS reports lchmod failure, but changes file system contents
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: "Darrick J. Wong" <darrick dot wong at oracle dot com>
- Cc: Christoph Hellwig <hch at infradead dot org>, linux-xfs at vger dot kernel dot org, libc-alpha at sourceware dot org, linux-fsdevel at vger dot kernel dot org, viro at zeniv dot linux dot org dot uk, Rich Felker <dalias at libc dot org>
- Date: Wed, 12 Feb 2020 20:15:08 +0100
- Subject: Re: XFS reports lchmod failure, but changes file system contents
- References: <874kvwowke.fsf@mid.deneb.enyo.de> <20200212161604.GP6870@magnolia> <20200212181128.GA31394@infradead.org> <20200212183718.GQ6870@magnolia>
* Darrick J. Wong:
> On Wed, Feb 12, 2020 at 10:11:28AM -0800, Christoph Hellwig wrote:
>> On Wed, Feb 12, 2020 at 08:16:04AM -0800, Darrick J. Wong wrote:
>> > xfs_setattr_nonsize calls posix_acl_chmod which returns EOPNOTSUPP
>> > because the xfs symlink inode_operations do not include a ->set_acl
>> > pointer.
>> >
>> > I /think/ that posix_acl_chmod code exists to enforce that the file mode
>> > reflects any acl that might be set on the inode, but in this case the
>> > inode is a symbolic link.
>> >
>> > I don't remember off the top of my head if ACLs are supposed to apply to
>> > symlinks, but what do you think about adding get_acl/set_acl pointers to
>> > xfs_symlink_inode_operations and xfs_inline_symlink_inode_operations ?
>>
>> Symlinks don't have permissions or ACLs, so adding them makes no
>> sense.
>
> Ahh, I thought so!
>
>> xfs doesn't seem all that different from the other file systems,
>> so I suspect you'll also see it with other on-disk file systems.
>
> Yeah, I noticed that btrfs seems to exhibit the same behavior.
>
> I also noticed that ext4 actually /does/ implement [gs]et_acl for
> symlinks.
Rich Felker noticed this, which may be related:
| Further, I've found some inconsistent behavior with ext4: chmod on the
| magic symlink fails with EOPNOTSUPP as in Florian's test, but fchmod
| on the O_PATH fd succeeds and changes the symlink mode. This is with
| 5.4. Cany anyone else confirm this? Is it a problem?
It looks broken to me because fchmod (as an inode-changing operation)
is not supposed to work on O_PATH descriptors.