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

getxattr("lustre.lov") on an open file returns a stale layout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None
    • FLR files read by fd on 2 clients
    • 3
    • 9223372036854775807

      After another client changes a file's layout (a write that makes a mirror stale, a resync), fgetxattr(fd, "lustre.lov") on a file kept open returns the old layout until something else refreshes it, for example a stat(). llapi_layout_get_by_fd() reads the same xattr, so tools that read the layout of an open file act on a mirror state that is no longer true. getxattr by path mostly sees the change, since the lookup revalidates the inode.

      Reproducer

      Two clients A and B, a file with two mirrors in sync:

      1. A opens the file and reads the layout generation with fgetxattr(): 5
      2. B writes 4 KiB into the file: generation 6, one mirror stale
      3. A's fgetxattr() keeps returning 5 for at least 6 s, and 6 right after a stat()

      Cause

      ll_getxattr_lov() packs the layout of the client's cl_object with cl_object_layout_get() and never calls ll_layout_refresh().

      Fix

      Refresh the layout in getxattr of a regular file before packing it, as I/O does. With a cached layout lock this costs no RPC. Group-locked files are excluded, since a new layout would wait for the group lock’s own I/O (LU-17620). Details and tests are in the patch.

      Related: LU-14549, LU-18553, LU-17620

            wc-triage WC Triage
            markus.hilger Markus Hilger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: