-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Linux 4.9 compat: fix zfs_ctldir xattr handling #6189
Conversation
@loli10K, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @tuxoko and @ahrens to be potential reviewers. |
module/zfs/zfs_ctldir.c
Outdated
@@ -492,6 +492,9 @@ zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id, | |||
ip->i_ctime = now; | |||
ip->i_fop = fops; | |||
ip->i_op = ops; | |||
#ifndef HAVE_GENERIC_SETXATTR | |||
ip->i_opflags = ~IOP_XATTR; | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, yes we should definitely do this but I'd suggest adding this same logic a little differently. The following has a few advantages.
-
Checking for
IOP_XATTR
instead ofHAVE_GENERIC_SETXATTR
ensures we're depending on exactly this interface change. That way in the unlikely case this change gets cherry picked in to an older kernel this will still work correctly. -
Using
&= ~IOP_XATTR
just clears the one bit we care about.
#if defined(IOP_XATTR)
ip->i_opflags &= ~IOP_XATTR;
#endif
Since torvalds/linux@d0a5b99 IOP_XATTR is used to indicate the inode has xattr support: clear it for the ctldir inodes to avoid EIO errors. Signed-off-by: loli10K <[email protected]>
882cb82
to
e623855
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good. And the test case failures are unrelated.
Since torvalds/linux@d0a5b99 IOP_XATTR is used to indicate the inode has xattr support: clear it for the ctldir inodes to avoid EIO errors. Reviewed-by: Chunwei Chen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes openzfs#6189
Since torvalds/linux@d0a5b99 IOP_XATTR is used to indicate the inode has xattr support: clear it for the ctldir inodes to avoid EIO errors. Reviewed-by: Chunwei Chen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #6189
Description
Since torvalds/linux@d0a5b99
IOP_XATTR
is used to indicate the inode has xattr support: we should clear it for the ctldir inodes to avoid IO errors.Motivation and Context
On Linux 4.9+
ls -la
on the ".zfs" directory produces IO errors:How Has This Been Tested?
Manual testing. We could also add a new test to the ZTS in "functional/xattr".
Types of changes
Checklist:
Signed-off-by
.