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

Re-order inode_lock and lli_trunc_sem to fix pio deadlock

Details

    • Bug
    • Resolution: Won't Fix
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      When using pio, we take the inode lock in ll_file_io_generic. Unfortunately, this violates the expected ordering with lli_trunc_sem, as seen in vvp_io_setattr_

      {start,end}

      . This can result in a deadlock where a thread doing a write holds the inode lock and wants the trunc sem in read mode, but setattr already holds the trunc sem in write mode and wants the inode lock.

      It appears to be safe to change the ordering between inode_lock and the lli_trunc_sem, so we always take the inode lock first.

      Also, the forthcoming patch cleans up inode locking with pio, removing lli_inode_locked. The inode info is shared between all threads doing i/o on that inode, so usage of this meant we would not take the inode lock for operations that needed it if someone already held it (notably ll_fsync), and we would also let other threads unlock the inode lock for us.

      So operations that expect complete coverage could get unlocked at some random point in their operation. Also, if a pio were holding the inode lock, multiple ll_fsync operations could occur at the same time.

      Attachments

        Activity

          [LU-9937] Re-order inode_lock and lli_trunc_sem to fix pio deadlock

          PIO is removed.

          adilger Andreas Dilger added a comment - PIO is removed.

          Patrick Farrell (paf@cray.com) uploaded a new patch: https://review.whamcloud.com/28836
          Subject: LU-9937 llite: fix pio deadlock
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: ffbf1e49a97eb86309adc2ad581e4d7e16d56ae8

          gerrit Gerrit Updater added a comment - Patrick Farrell (paf@cray.com) uploaded a new patch: https://review.whamcloud.com/28836 Subject: LU-9937 llite: fix pio deadlock Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: ffbf1e49a97eb86309adc2ad581e4d7e16d56ae8

          People

            paf Patrick Farrell (Inactive)
            paf Patrick Farrell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: