[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:
Related
is related to LU-9679 Prepare lustre for adoption into the ... Resolved
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
Subject: LU-10787 llite: correct removexattr detection
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a3d576231ee0cd85f236fd2d0b74cc7f94c6953b

Comment by Gerrit Updater [ 09/Apr/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/31594/
Subject: LU-10787 llite: correct removexattr detection
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 7a9a2e4aeec952169841a84be0679d1d1ed35acf

Comment by Peter Jones [ 09/Apr/18 ]

Landed for 2.12

Generated at Sat Feb 10 02:38:11 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.