Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1326472 - deadlock in fscache code (merge error)
deadlock in fscache code (merge error)
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kernel-rt (Show other bugs)
7.2
Unspecified Unspecified
urgent Severity unspecified
: rc
: ---
Assigned To: Clark Williams
Jiri Kastner
Marie Dolezelova
: ZStream
Depends On:
Blocks: 1274397 1327073 1327730
  Show dependency treegraph
 
Reported: 2016-04-12 14:47 EDT by Rik van Riel
Modified: 2016-11-03 15:46 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In a previous code update one extra spin_lock operation was left untouched. Consequently, a deadlock could occur when looping through cache pages. With this update, the extra lock operation has been removed from the source code and the deadlock no longer occurs in the described situation.
Story Points: ---
Clone Of:
: 1327073 1327730 (view as bug list)
Environment:
Last Closed: 2016-11-03 15:46:10 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fixup fscache mis-merge (870 bytes, patch)
2016-04-12 16:19 EDT, Clark Williams
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2584 normal SHIPPED_LIVE Important: kernel-rt security, bug fix, and enhancement update 2016-11-03 08:08:49 EDT

  None (edit)
Description Rik van Riel 2016-04-12 14:47:44 EDT
Description of problem:

While auditing the diff between the normal RHEL7 kernel and the RHEL7 kernel-rt tree (git diff kernel-3.10.0-376.el7..kernel-rt-3.10.0-376.rt56.253.el7) I found this gem:

diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index e1500bda3bfc..966aa4376037 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -887,6 +887,7 @@ void fscache_invalidate_writes(struct fscache_cookie *cookie)

                for (i = n - 1; i >= 0; i--)
                        page_cache_release(results[i]);
+               spin_lock(&cookie->stores_lock);
        }

        _leave("");

This will lead to a deadlock, since normal RHEL7 kernel has also merged an
equivalent of db7a50353, and takes the spinlock as the first thing when going around the loop:

        for (;;) {
                spin_lock(&cookie->stores_lock);
                n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0,
                                               ARRAY_SIZE(results),
                                               FSCACHE_COOKIE_PENDING_TAG);
                if (n == 0) {
                        spin_unlock(&cookie->stores_lock);
                        break;
                }

                for (i = n - 1; i >= 0; i--) {
                        page = results[i];
                        radix_tree_delete(&cookie->stores, page->index);
                }

                spin_unlock(&cookie->stores_lock);

                for (i = n - 1; i >= 0; i--)
                        page_cache_release(results[i]);
                spin_lock(&cookie->stores_lock);
        }


Version-Release number of selected component (if applicable):

kernel-rt-3.10.0-376.rt56.253.el7
Comment 1 Clark Williams 2016-04-12 16:19 EDT
Created attachment 1146668 [details]
Fixup fscache mis-merge

Patch to fix merge conflict resolution mis-merge that could result in a deadlock
Comment 2 Clark Williams 2016-04-13 20:19:16 EDT
above patch went into kernel-rt-3.10.0-377.rt56.256.el7 build.
Comment 8 errata-xmlrpc 2016-11-03 15:46:10 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2584.html

Note You need to log in before you can comment on or make changes to this bug.