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

user.job xattr is storing quotes around job name

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • Lustre 2.14.0, Lustre 2.16.1, Lustre 2.15.7
    • 3
    • 9223372036854775807

    Description

      The user.job xattr added in patch https://review.whamcloud.com/50982 ("LU-13031 jobstats: store jobid in xattr when files are created") is saving the " around the jobid:

      getfattr -d -m - /myth/tmp/foo 
      # file: myth/tmp/foo
      lustre.lov=0xd00bd70b0400000005da00003412000031323334
      trusted.link=0xdff1ea110100000036000000000000000000000000000000001e0000000200035f6200007fb000000000666f6f
      trusted.lma=0x0000000000000000315b0500020000000100000000000000
      trusted.lov=0xd00bd70b0400000005da00003412000031323334
      user.job=0x226d6f6f6b69653a6c66733a3022
      user.job="\"mookie:lfs:0\""
      

      The "0x22" at the start of the hex user.job show this as well as the ASCII version.

      This is stored in mdd_create_object():

             if (initial_create &&
                 spec->sp_cr_job_xattr[0] != '\0' &&
                 jobid[0] != '\0' &&
                 (S_ISREG(attr->la_mode) || S_ISDIR(attr->la_mode))) {
                     jobid_len = strnlen(jobid, LUSTRE_JOBID_SIZE);
                     buf = mdd_buf_get_const(env, jobid, jobid_len);
      
                     rc = mdo_xattr_set(env, son, buf, spec->sp_cr_job_xattr,
                                        LU_XATTR_CREATE, handle);
      
                     /* this xattr is nonessential, so ignore errors. */
                     if (rc != 0) {
                             CDEBUG(D_INODE,
                                    DFID" failed to set xattr '%s': rc = %d\n",
                                    PFID(son_fid), spec->sp_cr_job_xattr, rc);
                             rc = 0;
                     }
             }
      

      It doesn't make sense to save the quotes into the xattr, since this makes the processing more complex since it doesn't match the actual jobid, and the printing is ugly (note escaped quotes while printing it).

      If there are quotes around the jobid string, then the call to mdd_buf_get_const() should pass jobid + 1 and jobid_len - 2 so that they are not saved into the xattr.

      Attachments

        Issue Links

          Activity

            [LU-18798] user.job xattr is storing quotes around job name
            cfaber Colin Faber added a comment -

            Hi argupta Can you please investigate? Thank you!

            cfaber Colin Faber added a comment - Hi argupta Can you please investigate? Thank you!

            Hi Andreas – I would be happy to look into this. If I don't get to it in a week or so you can feel free to assign it to someone else but I'll try to get to it shortly.

            bertschinger Thomas Bertschinger added a comment - Hi Andreas – I would be happy to look into this. If I don't get to it in a week or so you can feel free to assign it to someone else but I'll try to get to it shortly.

            bertschinger is this something you could submit a patch to fix, or should I see if someone else could work on it? I suspect it is fairly trivial to fix.

            adilger Andreas Dilger added a comment - bertschinger is this something you could submit a patch to fix, or should I see if someone else could work on it? I suspect it is fairly trivial to fix.

            People

              argupta Aryan Gupta
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: