Summary: | on zfs extattr behaviour broken after unlink | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | justin | ||||||||
Component: | kern | Assignee: | Andriy Gapon <avg> | ||||||||
Status: | Closed FIXED | ||||||||||
Severity: | Affects Some People | CC: | avg, fs, justin, mahrens, op | ||||||||
Priority: | --- | Keywords: | patch | ||||||||
Version: | CURRENT | Flags: | op:
mfc-stable10?
|
||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
Attachments: |
|
Description
justin
2015-09-18 19:19:59 UTC
I could be wrong but I think that ENOENT is returned not because the file is unlinked but because the attribute is not found. That is, UFS reports the condition as errno 87, but ZFS reports it as errno 2. That looks like a porting bug. You can easily check that by calling extattr_get_fd(<missing-attribute>) on a file that is not unlinked. If the file is not unlinked I get attribute not found as expected (and as documented in the man page) 11141 luajit-2.0.4 CALL openat(AT_FDCWD,0x107550,0x601<O_WRONLY|O_CREAT|O_TRUNC>,0x1c0<S_IRUSR|S_IWUSR|S_IXUSR>) 11141 luajit-2.0.4 NAMI "XXXXYYYYZZZ452111141" 11141 luajit-2.0.4 RET openat 3 11141 luajit-2.0.4 CALL extattr_get_fd(0x3,0x1,0x1129d8,0,0) 11141 luajit-2.0.4 RET extattr_get_fd -1 errno 87 Attribute not found So the behaviour is specifically related to unlinking, not the xattr behaviour. (In reply to justin from comment #2) Thank you for the test. I misread the code indeed. Created attachment 161182 [details]
test case
Test case.
(In reply to justin from comment #4) Could you please also test the case where the attribute is actually set? That is, the case where extattr_get_fd() is supposed to succeed. I think that that test would currently fail for the unlinked file with ENOENT as well. Created attachment 161183 [details]
completely untested patch
Created attachment 161184 [details]
test case when attribute exists
Yes, when the attribute exists you get the same ENOENT error, see this test case.
[ping] Are you willing to test the patch? A commit references this bug: Author: avg Date: Mon Nov 2 10:07:21 UTC 2015 New revision: 290266 URL: https://svnweb.freebsd.org/changeset/base/290266 Log: zfs: allow the lookup of extended attributes of an unlinked file That's required for extattr_get_fd(2) and the like to work properly. PR: 203201 MFC after: 17 days Changes: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c MFC after: 17 days Do you still want to MFC this change to 10-STABLE? A commit references this bug: Author: mav Date: Sun Mar 20 23:20:16 UTC 2016 New revision: 297087 URL: https://svnweb.freebsd.org/changeset/base/297087 Log: MFC r290266 (by avg): zfs: allow the lookup of extended attributes of an unlinked file That's required for extattr_get_fd(2) and the like to work properly. PR: 203201 Changes: _U stable/10/ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thank you, Alexander. |