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

osd-ldiskfs: T10-PI guards ignore segment offset within page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None
    • 3
    • 9223372036854775807

      osd_dif_generate() and osd_dif_verify() (lustre/osd-ldiskfs/osd_integrity.c) take the client guards for a bio integrity segment from lnb->lnb_guards[0], whatever the segment's offset in its page (bv_offset). osd_bio_integrity_compare() does the same. tgt_checksum_niobuf_t10pi() sets lnb_guard_rpc for full-page writes whose checksum type matches the device's T10 type, so those guards are used.

      When a bio segment starts in the middle of a page, the sectors after that point get the guards of the start of the page. Depending on whether the device checks guards on write, the write then fails with a protection error, or a later read fails verification.

      This can only happen with PAGE_SIZE larger than the filesystem block size (64 KiB pages with 4 KiB blocks, aarch64 or ppc64le servers), a T10-PI capable device and the client T10 guards in use. osd_do_bio() starts a bio in the middle of a page after a transaction restart in the middle of a page (dr_start_pg_wblks) or at a gap in the disk blocks inside a page.

      A fix would offset the guard pointer by offset_in_page(data_buf) / interval for the segment (and the same in verify and compare), or fall back to computing the guard when the segment does not start the page.

      Found while reviewing https://review.whamcloud.com/c/fs/lustre-release/+/69823 (LU-20994), which could have added a third way to start a bio in the middle of a page (a RAID row cut). That patch now never cuts a row that starts inside a page.

            wc-triage WC Triage
            patrickbot Patrick Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: