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

Strange LASSERT in mdt_dom_read_on_open()

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.17.0
    • Lustre 2.17.0
    • None
    • 3
    • 9223372036854775807

    Description

      There's a strange code in mdt_dom_read_on_open (highlighted by smatch) that asserts for some non-sensical stuff that's not even changed inside the loop:

              rc = dt_read_prep(env, mo, lnb, nr_local);
              if (unlikely(rc))
                      GOTO(buf_put, rc);
              /* copy data to the buffer finally */
              for (i = 0; i < nr_local; i++) {
                      char *p = kmap(lnb[i].lnb_page);
                      long off;                LASSERT(lnb[i].lnb_page_offset == 0);
                      off = lnb[i].lnb_len & ~PAGE_MASK;
                      if (off > 0)
                              memset(p + off, 0, PAGE_SIZE - off);
                      memcpy(buf + (i << PAGE_SHIFT), p, lnb[i].lnb_len);
                      kunmap(lnb[i].lnb_page);
                      copied += lnb[i].lnb_len;
      ====>>>         LASSERT(rc <= len);        <<<<======= here
              }
      

      I checked with Mike (original path author) and he thinks we can just safely drop it.

      Attachments

        Issue Links

          Activity

            [LU-18987] Strange LASSERT in mdt_dom_read_on_open()
            pjones Peter Jones made changes -
            Assignee Original: WC Triage [ wc-triage ] New: Oleg Drokin [ green ]
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            green Oleg Drokin made changes -
            Link New: This issue is related to LU-10181 [ LU-10181 ]
            green Oleg Drokin made changes -
            Link Original: This issue is related to LU-18448 [ LU-18448 ]
            green Oleg Drokin made changes -
            Description Original: There's a strange code in mdt_read_on_open (highlighted by smatch) that asserts for some non-sensical stuff that's not even changed inside the loop:
            {code:java}
                    rc = dt_read_prep(env, mo, lnb, nr_local);
                    if (unlikely(rc))
                            GOTO(buf_put, rc);
                    /* copy data to the buffer finally */
                    for (i = 0; i < nr_local; i++) {
                            char *p = kmap(lnb[i].lnb_page);
                            long off;                LASSERT(lnb[i].lnb_page_offset == 0);
                            off = lnb[i].lnb_len & ~PAGE_MASK;
                            if (off > 0)
                                    memset(p + off, 0, PAGE_SIZE - off);
                            memcpy(buf + (i << PAGE_SHIFT), p, lnb[i].lnb_len);
                            kunmap(lnb[i].lnb_page);
                            copied += lnb[i].lnb_len;
            ====>>>         LASSERT(rc <= len); <<<<======= here
                    }
            {code}
            I checked with Mike (original path author) and he thinks we can just safely drop it.
            New: There's a strange code in mdt_dom_read_on_open (highlighted by smatch) that asserts for some non-sensical stuff that's not even changed inside the loop:
            {code:java}
                    rc = dt_read_prep(env, mo, lnb, nr_local);
                    if (unlikely(rc))
                            GOTO(buf_put, rc);
                    /* copy data to the buffer finally */
                    for (i = 0; i < nr_local; i++) {
                            char *p = kmap(lnb[i].lnb_page);
                            long off;                LASSERT(lnb[i].lnb_page_offset == 0);
                            off = lnb[i].lnb_len & ~PAGE_MASK;
                            if (off > 0)
                                    memset(p + off, 0, PAGE_SIZE - off);
                            memcpy(buf + (i << PAGE_SHIFT), p, lnb[i].lnb_len);
                            kunmap(lnb[i].lnb_page);
                            copied += lnb[i].lnb_len;
            ====>>>         LASSERT(rc <= len); <<<<======= here
                    }
            {code}
            I checked with Mike (original path author) and he thinks we can just safely drop it.
            green Oleg Drokin made changes -
            Summary Original: Strange LASSERT in mdt_read_on_open() New: Strange LASSERT in mdt_dom_read_on_open()
            adilger Andreas Dilger made changes -
            Description Original: There's a strange code in mdt_read_on_open (highlighted by smatch) that asserts for some non-sensical stuff that's not even changed inside the loop:
            {code:java}
                    rc = dt_read_prep(env, mo, lnb, nr_local);
                    if (unlikely(rc))
                            GOTO(buf_put, rc);
                    /* copy data to the buffer finally */
                    for (i = 0; i < nr_local; i++) {
                            char *p = kmap(lnb[i].lnb_page);
                            long off;                LASSERT(lnb[i].lnb_page_offset == 0);
                            off = lnb[i].lnb_len & ~PAGE_MASK;
                            if (off > 0)
                                    memset(p + off, 0, PAGE_SIZE - off);                memcpy(buf + (i << PAGE_SHIFT), p, lnb[i].lnb_len);
                            kunmap(lnb[i].lnb_page);
                            copied += lnb[i].lnb_len;
            ====>>>         LASSERT(rc <= len); <<<<======= here
                    }
            {code}
            I checked with Mike (original path author) and he thinks we can just safely drop it.
            New: There's a strange code in mdt_read_on_open (highlighted by smatch) that asserts for some non-sensical stuff that's not even changed inside the loop:
            {code:java}
                    rc = dt_read_prep(env, mo, lnb, nr_local);
                    if (unlikely(rc))
                            GOTO(buf_put, rc);
                    /* copy data to the buffer finally */
                    for (i = 0; i < nr_local; i++) {
                            char *p = kmap(lnb[i].lnb_page);
                            long off;                LASSERT(lnb[i].lnb_page_offset == 0);
                            off = lnb[i].lnb_len & ~PAGE_MASK;
                            if (off > 0)
                                    memset(p + off, 0, PAGE_SIZE - off);
                            memcpy(buf + (i << PAGE_SHIFT), p, lnb[i].lnb_len);
                            kunmap(lnb[i].lnb_page);
                            copied += lnb[i].lnb_len;
            ====>>>         LASSERT(rc <= len); <<<<======= here
                    }
            {code}
            I checked with Mike (original path author) and he thinks we can just safely drop it.
            adilger Andreas Dilger made changes -
            Link New: This issue is related to LU-18448 [ LU-18448 ]
            green Oleg Drokin created issue -

            People

              green Oleg Drokin
              green Oleg Drokin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: