Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-10787

setxattr(..., XATTR_REPLACE) removes rather than replaces the attribute

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.12.0
    • None
    • None
    • 3
    • 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;
              }
      

      Attachments

        Issue Links

          Activity

            [LU-10787] setxattr(..., XATTR_REPLACE) removes rather than replaces the attribute
            pjones Peter Jones added a comment -

            Landed for 2.12

            pjones Peter Jones added a comment - Landed for 2.12

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            People

              jhammond John Hammond
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: