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

Backport patches from upstream to resolve deadlock in xattr

    XMLWordPrintable

Details

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

    Description

      We need backport below patches from upstream to resolve deadlock for i_data_sem.

      From a521100231f816f8cdd9c8e77da14ff1e42c2b17 Mon Sep 17 00:00:00 2001
      From: Theodore Ts'o <tytso@mit.edu>
      Date: Thu, 4 Sep 2014 18:06:25 -0400
      Subject: [PATCH] ext4: pass allocation_request struct to
      ext4_(alloc,splice)_branch

      Instead of initializing the allocation_request structure in
      ext4_alloc_branch(), set it up in ext4_ind_map_blocks(), and then pass
      it to ext4_alloc_branch() and ext4_splice_branch().

      This allows ext4_ind_map_blocks to pass flags in the allocation
      request structure without having to add Yet Another argument to
      ext4_alloc_branch().

      Signed-off-by: Theodore Ts'o <tytso@mit.edu>
      Reviewed-by: Jan Kara <jack@suse.cz>

      From e3cf5d5d9a86df1c5e413bdd3725c25a16ff854c Mon Sep 17 00:00:00 2001
      From: Theodore Ts'o <tytso@mit.edu>
      Date: Thu, 4 Sep 2014 18:07:25 -0400
      Subject: [PATCH] ext4: prepare to drop EXT4_STATE_DELALLOC_RESERVED

      The EXT4_STATE_DELALLOC_RESERVED flag was originally implemented
      because it was too hard to make sure the mballoc and get_block flags
      could be reliably passed down through all of the codepaths that end up
      calling ext4_mb_new_blocks().

      Since then, we have mb_flags passed down through most of the code
      paths, so getting rid of EXT4_STATE_DELALLOC_RESERVED isn't as tricky
      as it used to.

      This commit plumbs in the last of what is required, and then adds a
      WARN_ON check to make sure we haven't missed anything. If this passes
      a full regression test run, we can then drop
      EXT4_STATE_DELALLOC_RESERVED.

      Signed-off-by: Theodore Ts'o <tytso@mit.edu>
      Reviewed-by: Jan Kara <jack@suse.cz>

      From 2e81a4eeedcaa66e35f58b81e0755b87057ce392 Mon Sep 17 00:00:00 2001
      From: Jan Kara <jack@suse.cz>
      Date: Thu, 11 Aug 2016 12:38:55 -0400
      Subject: [PATCH] ext4: avoid deadlock when expanding inode size

      When we need to move xattrs into external xattr block, we call
      ext4_xattr_block_set() from ext4_expand_extra_isize_ea(). That may end
      up calling ext4_mark_inode_dirty() again which will recurse back into
      the inode expansion code leading to deadlocks.

      Protect from recursion using EXT4_STATE_NO_EXPAND inode flag and move
      its management into ext4_expand_extra_isize_ea() since its manipulation
      is safe there (due to xattr_sem) from possible races with
      ext4_xattr_set_handle() which plays with it as well.

      CC: stable@vger.kernel.org # 4.4.x
      Signed-off-by: Jan Kara <jack@suse.cz>
      Signed-off-by: Theodore Ts'o <tytso@mit.edu>

      Attachments

        Issue Links

          Activity

            People

              ys Yang Sheng
              ys Yang Sheng
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: