Blame SOURCES/0337-readahead-do-not-increase-nr_requests-for-root-fs-bl.patch

17b0f1
From 997778e332e9f6d3d1c42e9a222fcab8d4732c40 Mon Sep 17 00:00:00 2001
17b0f1
From: Michal Sekletar <msekleta@redhat.com>
17b0f1
Date: Fri, 27 May 2016 14:29:17 +0200
17b0f1
Subject: [PATCH] readahead: do not increase nr_requests for root fs block
17b0f1
 device
17b0f1
17b0f1
Having nr_requests can cause system lockups. Arguably, this should get
17b0f1
fixed somehow in kernel. For now we just stop changing the
17b0f1
value.
17b0f1
17b0f1
Note that not bumping a value may cause that posix_fadvise call
17b0f1
will block in case there is no room in a request queue.
17b0f1
17b0f1
See: http://article.gmane.org/gmane.linux.kernel/1072356
17b0f1
17b0f1
RHEL-only
17b0f1
Resolves: #1314559
17b0f1
---
17b0f1
 src/readahead/readahead-common.c | 64 --------------------------------
17b0f1
 src/readahead/readahead-common.h |  2 -
17b0f1
 src/readahead/readahead-replay.c |  2 -
17b0f1
 3 files changed, 68 deletions(-)
17b0f1
17b0f1
diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c
17b0f1
index 3ca48a7257..6cf33f7cfe 100644
17b0f1
--- a/src/readahead/readahead-common.c
17b0f1
+++ b/src/readahead/readahead-common.c
17b0f1
@@ -253,70 +253,6 @@ ReadaheadShared *shared_get(void) {
17b0f1
         return m;
17b0f1
 }
17b0f1
 
17b0f1
-/* We use 20K instead of the more human digestable 16K here. Why?
17b0f1
-   Simply so that it is more unlikely that users end up picking this
17b0f1
-   value too so that we can recognize better whether the user changed
17b0f1
-   the value while we had it temporarily bumped. */
17b0f1
-#define BUMP_REQUEST_NR (20*1024u)
17b0f1
-
17b0f1
-int block_bump_request_nr(const char *p) {
17b0f1
-        struct stat st;
17b0f1
-        uint64_t u;
17b0f1
-        char *ap = NULL, *line = NULL;
17b0f1
-        int r;
17b0f1
-        dev_t d;
17b0f1
-
17b0f1
-        assert(p);
17b0f1
-
17b0f1
-        if (stat(p, &st) < 0)
17b0f1
-                return -errno;
17b0f1
-
17b0f1
-        if (major(st.st_dev) == 0)
17b0f1
-                return 0;
17b0f1
-
17b0f1
-        d = st.st_dev;
17b0f1
-        block_get_whole_disk(d, &d);
17b0f1
-
17b0f1
-        if (asprintf(&ap, "/sys/dev/block/%u:%u/queue/nr_requests", major(d), minor(d)) < 0) {
17b0f1
-                r= -ENOMEM;
17b0f1
-                goto finish;
17b0f1
-        }
17b0f1
-
17b0f1
-        r = read_one_line_file(ap, &line);
17b0f1
-        if (r < 0) {
17b0f1
-                if (r == -ENOENT)
17b0f1
-                        r = 0;
17b0f1
-                goto finish;
17b0f1
-        }
17b0f1
-
17b0f1
-        r = safe_atou64(line, &u);
17b0f1
-        if (r >= 0 && u >= BUMP_REQUEST_NR) {
17b0f1
-                r = 0;
17b0f1
-                goto finish;
17b0f1
-        }
17b0f1
-
17b0f1
-        free(line);
17b0f1
-        line = NULL;
17b0f1
-
17b0f1
-        if (asprintf(&line, "%u", BUMP_REQUEST_NR) < 0) {
17b0f1
-                r = -ENOMEM;
17b0f1
-                goto finish;
17b0f1
-        }
17b0f1
-
17b0f1
-        r = write_string_file(ap, line);
17b0f1
-        if (r < 0)
17b0f1
-                goto finish;
17b0f1
-
17b0f1
-        log_info("Bumped block_nr parameter of %u:%u to %u. This is a temporary hack and should be removed one day.", major(d), minor(d), BUMP_REQUEST_NR);
17b0f1
-        r = 1;
17b0f1
-
17b0f1
-finish:
17b0f1
-        free(ap);
17b0f1
-        free(line);
17b0f1
-
17b0f1
-        return r;
17b0f1
-}
17b0f1
-
17b0f1
 int block_get_readahead(const char *p, uint64_t *bytes) {
17b0f1
         struct stat st;
17b0f1
         char *ap = NULL, *line = NULL;
17b0f1
diff --git a/src/readahead/readahead-common.h b/src/readahead/readahead-common.h
17b0f1
index b34f3aadd7..cc2ea81a9d 100644
17b0f1
--- a/src/readahead/readahead-common.h
17b0f1
+++ b/src/readahead/readahead-common.h
17b0f1
@@ -51,8 +51,6 @@ typedef struct ReadaheadShared {
17b0f1
 
17b0f1
 ReadaheadShared *shared_get(void);
17b0f1
 
17b0f1
-int block_bump_request_nr(const char *p);
17b0f1
-
17b0f1
 int block_get_readahead(const char *p, uint64_t *bytes);
17b0f1
 int block_set_readahead(const char *p, uint64_t bytes);
17b0f1
 
17b0f1
diff --git a/src/readahead/readahead-replay.c b/src/readahead/readahead-replay.c
17b0f1
index f81e0fe55d..c2e281687a 100644
17b0f1
--- a/src/readahead/readahead-replay.c
17b0f1
+++ b/src/readahead/readahead-replay.c
17b0f1
@@ -134,8 +134,6 @@ static int replay(const char *root) {
17b0f1
 
17b0f1
         assert(root);
17b0f1
 
17b0f1
-        block_bump_request_nr(root);
17b0f1
-
17b0f1
         if (asprintf(&pack_fn, "%s/.readahead", root) < 0)
17b0f1
                 return log_oom();
17b0f1