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

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

    XMLWordPrintable

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

            People

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

              Dates

                Created:
                Updated:
                Resolved: