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

getxattr() for {lustre,trusted}.lov on HSM released file returns stripe count 0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • Lustre 2.7.0
    • 3
    • 17381

    Description

      When getxattr() is called to retrieve the lustre.lov or trusted.lov xattr of a regular file the returned value is synthesized from the LSM attached to that file. When the file is released that LSM will have a stripe count of 0.

      # lfs setstripe -c2 f0
      # lfs getstripe f0
      f0
      lmm_stripe_count:   2
      lmm_stripe_size:    1048576
      lmm_pattern:        1
      lmm_layout_gen:     0
      lmm_stripe_offset:  0
              obdidx          objid           objid           group
              0               3               0x3             0
              1               3               0x3             0
      
      # sys_getxattr --raw f0 lustre.lov | hexdump -C
      00000000  d0 0b d1 0b 01 00 00 00  04 00 00 00 00 00 00 00  |................|
      00000010  00 04 00 00 02 00 00 00  00 00 10 00 02 00 00 00  |................|
      00000020  03 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
      00000030  00 00 00 00 00 00 00 00  03 00 00 00 00 00 00 00  |................|
      00000040  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 00  |................|
      00000050
      # sys_getxattr --raw f0 trusted.lov | hexdump -C
      00000000  d0 0b d1 0b 01 00 00 00  04 00 00 00 00 00 00 00  |................|
      00000010  00 04 00 00 02 00 00 00  00 00 10 00 02 00 00 00  |................|
      00000020  03 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
      00000030  00 00 00 00 00 00 00 00  03 00 00 00 00 00 00 00  |................|
      00000040  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 00  |................|
      00000050
      # lfs hsm_archive f0
      # lfs hsm_release f0
      # lfs hsm_state f0
      f0: (0x0000000d) released exists archived, archive_id:1
      

      lfs getstripe returns the correct answer as it does not use the LSM but instead does a IOC_MDC_GETFILESTRIPE ioctl on the parent directory which calls ll_lov_getstripe_ea_info() and sends a MDS_GETATTR_NAME request.

      # lfs getstripe f0
      f0
      lmm_stripe_count:   2
      lmm_stripe_size:    1048576
      lmm_pattern:        80000001
      lmm_layout_gen:     1
      lmm_stripe_offset:  0
      

      getxattr() returns the wrong answer as it uses that attached LSM:

      q:lustre# sys_getxattr -r f0 lustre.lov | hexdump -C
      00000000  d0 0b d1 0b 01 00 00 80  04 00 00 00 00 00 00 00  |................|
      00000010  00 04 00 00 02 00 00 00  00 00 10 00 00 00 00 00  |................|
      00000020
      q:lustre# sys_getxattr -r f0 trusted.lov | hexdump -C
      00000000  d0 0b d1 0b 01 00 00 80  04 00 00 00 00 00 00 00  |................|
      00000010  00 04 00 00 02 00 00 00  00 00 10 00 00 00 00 00  |................|
      00000020
      
                magic------ pattern----  oi---------------------
      00000000  d0 0b d1 0b 01 00 00 80  04 00 00 00 00 00 00 00  |................|
                -----------------------  size------- count gen--
      00000010  00 04 00 00 02 00 00 00  00 00 10 00 00 00 00 00  |................|
      

      When the LL_IOC_LOV_GETSTRIPE ioctl is done on a regular file we will also get a stripe count of 0 on a released file. But neither llapi nor lfs will use LL_IOC_LOV_GETSTRIPE on a regular file.

      Note that this code was modified recently as part of CLIO simplification (see LU-5823 and http://review.whamcloud.com/12452) but the same defect existed before that commit.

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: