[LU-10787] setxattr(..., XATTR_REPLACE) removes rather than replaces the attribute Created: 07/Mar/18 Updated: 06/Dec/23 Resolved: 09/Apr/18 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.12.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | John Hammond | Assignee: | John Hammond |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
|
(setfattr does not allow us to specify XATTR_REPLACE so I used a custom utility.) n:lustre# rm f0
n:lustre# touch f0
n:lustre# setfattr -n user.foo -v foo f0
n:lustre# getfattr -d f0
# file: f0
user.foo="foo"
n:lustre# setfattr -n user.foo -v bar f0
n:lustre# getfattr -d f0
# file: f0
user.foo="bar"
n:lustre# strace -e trace=setxattr ~/sys/sys_setxattr -r f0 user.foo baz
setxattr("f0", "user.foo", "baz", 3, XATTR_REPLACE) = 0
+++ exited with 0 +++
n:lustre# getfattr -d f0
n:lustre#
This is due to ll_xattr_set_common() using OBD_MD_FLXATTRRM for XATTR_REPLACE: if (flags == XATTR_REPLACE) { ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1); valid = OBD_MD_FLXATTRRM; } else { ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_SETXATTR, 1); valid = OBD_MD_FLXATTR; } |
| Comments |
| Comment by Gerrit Updater [ 08/Mar/18 ] |
|
John L. Hammond (john.hammond@intel.com) uploaded a new patch: https://review.whamcloud.com/31594 |
| Comment by Gerrit Updater [ 09/Apr/18 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/31594/ |
| Comment by Peter Jones [ 09/Apr/18 ] |
|
Landed for 2.12 |