Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsattr is broken #1691

Closed
ryao opened this issue Sep 3, 2013 · 6 comments
Closed

lsattr is broken #1691

ryao opened this issue Sep 3, 2013 · 6 comments
Labels
Type: Feature Feature request or new feature
Milestone

Comments

@ryao
Copy link
Contributor

ryao commented Sep 3, 2013

lsattr and python's xattr.list() use an ioctl instead of the VFS call, which is not currently supported:

https://github.com/zfsonlinux/zfs/blob/master/module/zfs/zpl_file.c#L480

The result is that anything using it breaks. This includes Gentoo Portage's FEATURES=xattr:

https://bugs.gentoo.org/show_bug.cgi?id=483516

@behlendorf
Copy link
Contributor

This is a duplicate #229. File attributes should be relatively easy to get support added for but thus far it hasn't been a priority. There's a prototype patch in #229 which just need to be finalized, the only real hang up is the Solaris<->Linux mapping for the flags.

@ryao
Copy link
Contributor Author

ryao commented Sep 4, 2013

@behlendorf This is a development blocker for the Pentoo Linux project (run by another Gentoo developer), so I consider fixing this to be a high priority. I promised the Pentoo Linux project that I would write a fix within 24 hours. Making Gentoo Portage happy requires only implementing ZFS_IOC_GETFLAGS, which makes this a proper subset of #229, rather than a duplicate. It would be appropriate to reopen this, but I cannot do that because you closed it.

@lundman
Copy link
Contributor

lundman commented Sep 4, 2013

Unlikely it helps with the Linux version, we had to implement flags in OSX. Only weirdness was that OSX would sometimes set "only flags" when ZFS expects "flags AND mode". We have to look up mode in this case:

https://github.com/zfs-osx/zfs/blob/master/module/zfs/zfs_vnops_osx.c#L572

and Darwins flag mapping

https://github.com/zfs-osx/zfs/blob/master/module/zfs/zfs_vnops_osx_lib.c#L377

ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
Gentoo Portage's FEATURES=xattr breaks because python's xattr.list()
reads regular atrributes too. We implement FS_IOC_GETFLAGS to fix this.
Only flags common to both both Linux and Solaris are returned. Flags
cannot be set until FS_IOC_SETFLAGS is implemented.

Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
@ryao
Copy link
Contributor Author

ryao commented Sep 4, 2013

I have opened a pull request for the read case, which should be sufficient to make Gentoo Portage's FEATURES=xattr work and anything else that depends on python's xattr.list(). I consider the write case to be a separate issue with lower priority.

ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
Gentoo Portage's FEATURES=xattr breaks because python's xattr.list()
reads regular atrributes too. We implement FS_IOC_GETFLAGS to fix this.
Only flags common to both both Linux and Solaris are returned. Flags
cannot be set until FS_IOC_SETFLAGS is implemented.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation.  The
resolution of issue openzfs#229 should implement something
equivalent.

Closes openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
@behlendorf behlendorf reopened this Sep 4, 2013
ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
Gentoo Portage's FEATURES=xattr breaks because python's xattr.list()
reads regular attributes. Implementing FS_IOC_GETFLAGS fixes this.  Only
flags common to both both Linux and Solaris are returned. Flags cannot
be set until FS_IOC_SETFLAGS is implemented.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent.

Closes openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
Gentoo Portage's FEATURES=xattr breaks because python's xattr.list()
reads regular attributes. Implementing FS_IOC_GETFLAGS fixes this.  Only
flags common to both Linux and Solaris are returned. Flags cannot be set
until FS_IOC_SETFLAGS is implemented.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent.

Closes openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
@behlendorf
Copy link
Contributor

@ryao The FS_IOC_GETFLAGS implementation looks reasonable and if it resolves an issue you're having with Gentoo Portage by all means pull it in. I may have caused this when I merged 88c2839 to return the correct error codes. However, I'd prefer to avoid pulling this work in upstream until we have a working get and set. It doesn't look like a lot of work to get there if we just handle the attributes which map directly.

My suggestion would be to do something similar to what @lundman suggests. This is in fact almost all done in the original patch. We should just need to fill in the xvattr for zfs_setattr() and provide the mode bits. The mode bits could be cheaply read from the in memory znode/inode since we have the file pointer.

There are existing test cases in xfstests to verify this was done correctly. @ryao and chance I can persuade you to finish the write side of this as well?

@ryao
Copy link
Contributor Author

ryao commented Sep 4, 2013

@behlendorf The approach taken in behlendorf/zfs@d80bd25 risks clearing existing attributes that cannot be set by the GNU chattr. It also treats the output of copy_from_user() as an error code when it returns the number of bytes that could not be copied upon error.

I will take some time to do the write case.

ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Sep 4, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 5, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 6, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 7, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 12, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 12, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Oct 24, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Nov 9, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Nov 21, 2013
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jan 23, 2014
We add support for lsattr and chattr. Only attributes common to both
Solaris and Linux are supported. These are 'a', 'd' and 'i'. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch.

This commit removes the ZFS_IOC_GETFLAGS and ZFS_IOC_SETFLAGS macros in
recognition that this is not equivalent to the Solaris operation. The
resolution of issue openzfs#229 should implement something
equivalent that will permit access and modification of Solaris-specific
attributes.

This resolves a regression caused by
88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Apr 25, 2014
We add support for lsattr and chattr.  This resolves a regression caused
by 88c2839 that broke python's
xattr.list(). This broke Gentoo Portage's FEATURES=xattr, which depended
on this.

Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method.  That was the case prior to
this patch. The resolution of issue openzfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Apr 25, 2014
We add support for lsattr and chattr to resolve a regression caused by
88c2839 that broke Python's
xattr.list(). That changet broke Gentoo Portage's FEATURES=xattr, which
depended on Python's xattr.list().

Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method.  That was the case prior to
this patch. The resolution of issue openzfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Apr 25, 2014
We add support for lsattr and chattr to resolve a regression caused by
88c2839 that broke Python's
xattr.list(). That changet broke Gentoo Portage's FEATURES=xattr, which
depended on Python's xattr.list().

Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method.  That was the case prior to
this patch. The resolution of issue openzfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Apr 30, 2014
We add support for lsattr and chattr to resolve a regression caused by
88c2839 that broke Python's
xattr.list(). That changet broke Gentoo Portage's FEATURES=xattr, which
depended on Python's xattr.list().

Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method.  That was the case prior to
this patch. The resolution of issue openzfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue May 1, 2014
We add support for lsattr and chattr to resolve a regression caused by
88c2839 that broke Python's
xattr.list(). That changet broke Gentoo Portage's FEATURES=xattr, which
depended on Python's xattr.list().

Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method.  That was the case prior to
this patch. The resolution of issue openzfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.

https://bugs.gentoo.org/show_bug.cgi?id=483516
Issue openzfs#1691

Original-patch-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue May 1, 2014
We need inode_owner_or_capable() for ZFS file attributes in addition to
xattrs, so it should go into its own file. This moves it into its own
file and changes it to be more comprehensive. It will now fail if no
known good API is detected.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1691
@behlendorf behlendorf modified the milestones: 0.6.3, 0.7.0 May 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
Development

No branches or pull requests

3 participants