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

osd-ldiskfs fills file offsets into lnb->offset fields used as page offsets

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • Lustre 2.4.0
    • Lustre 2.4.0
    • 3
    • 3988

    Description

      This affects ofd + osd-ldiskfs but not obdfilter or current MDS/MGS stack.

      static int osd_map_remote_to_local(loff_t offset, ssize_t len, int *nrpages,
                                         struct niobuf_local *lnb)
      {
              ENTRY;
      
              *nrpages = 0;  
      
              while (len > 0) {
                      int poff = offset & (CFS_PAGE_SIZE - 1);
                      int plen = CFS_PAGE_SIZE - poff;
      
                      if (plen > len)
                              plen = len;
                      lnb->offset = offset;
                      /* lnb->lnb_page_offset = poff; */
      

      "offset" contains the file offset, while "lnb->offset" is expected to be the page offset:

      static int osd_write_prep(const struct lu_env *env, struct dt_object *dt,
                                struct niobuf_local *lnb, int npages)
      {
      [...]
      
                      if (maxidx >= lnb[i].page->index) {
                              osd_iobuf_add_page(iobuf, lnb[i].page);
                      } else {
                              long off;
                              char *p = kmap(lnb[i].page);
      
                              off = lnb[i].offset;
                              if (off)
                                      memset(p, 0, off);
      

      The memset() call might zero out quite a number of pages that may not belong to Lustre.

      Attachments

        Issue Links

          Activity

            [LU-1883] osd-ldiskfs fills file offsets into lnb->offset fields used as page offsets

            Please let me know if this is still an issue and needs to be reopened.

            jlevi Jodi Levi (Inactive) added a comment - Please let me know if this is still an issue and needs to be reopened.

            The master patch has landed.

            liwei Li Wei (Inactive) added a comment - The master patch has landed.

            This is actually a blocker for 2.4. I have to remove 2.3.0 from the "affects version/s" list, so that this does not block 2.3.

            liwei Li Wei (Inactive) added a comment - This is actually a blocker for 2.4. I have to remove 2.3.0 from the "affects version/s" list, so that this does not block 2.3.
            liwei Li Wei (Inactive) added a comment - http://review.whamcloud.com/4051 This is for master.

            Yes, the patch makes sure lnb_file_offset and lnb_page_offset both store what the names imply.

            liwei Li Wei (Inactive) added a comment - Yes, the patch makes sure lnb_file_offset and lnb_page_offset both store what the names imply.

            lnb has already lnb_file_offset field in master, so we need just use it as file offset and lnb->offset as page offset. Separate patch would rename other lnb fields to have lnb_ prefix.

            tappro Mikhail Pershin added a comment - lnb has already lnb_file_offset field in master, so we need just use it as file offset and lnb->offset as page offset. Separate patch would rename other lnb fields to have lnb_ prefix.
            liwei Li Wei (Inactive) added a comment - - edited
            liwei Li Wei (Inactive) added a comment - - edited http://review.whamcloud.com/3940 This is for b2_3.

            the correct fix would be to introduce lnb_page_offset and lnb_file_offset as in orion.

            bzzz Alex Zhuravlev added a comment - the correct fix would be to introduce lnb_page_offset and lnb_file_offset as in orion.

            People

              liwei Li Wei (Inactive)
              liwei Li Wei (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: