]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
- xfs: don't eat ram on quotacheck
[packages/kernel.git] / kernel-small_fixes.patch
1 --- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
2 +++ linux-2.6.33/scripts/mod/modpost.c  2010-03-07 14:26:47.242168558 +0100
3 @@ -15,7 +15,8 @@
4  #include <stdio.h>
5  #include <ctype.h>
6  #include "modpost.h"
7 -#include "../../include/generated/autoconf.h"
8 +// PLD architectures don't use CONFIG_SYMBOL_PREFIX
9 +//#include "../../include/generated/autoconf.h"
10  #include "../../include/linux/license.h"
11  
12  /* Some toolchains use a `_' prefix for all user symbols. */
13
14 --- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~       2011-07-22 04:17:23.000000000 +0200
15 +++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh        2011-08-25 21:26:04.799150642 +0200
16 @@ -9,6 +9,12 @@
17                         $cc -print-file-name=lib${lib}.${ext} | grep -q /
18                         if [ $? -eq 0 ]; then
19                                 echo "-l${lib}"
20 +                               for libt in tinfow tinfo ; do
21 +                                       $cc -print-file-name=lib${libt}.${ext} | grep -q /
22 +                                       if [ $? -eq 0 ]; then
23 +                                               echo "-l${libt}"
24 +                                       fi
25 +                               done
26                                 exit
27                         fi
28                 done
29
30 From:   Eric Sandeen <sandeen@redhat.com>
31 Subject: [PATCH] xfs: don't wrap ID in xfs_dq_get_next_id
32 Message-ID: <f52de68d-abe6-1960-c0ef-1d199346f689@redhat.com>
33 Date:   Fri, 16 Dec 2016 18:05:20 -0600
34
35 The GETNEXTQOTA ioctl takes whatever ID is sent in,
36 and looks for the next active quota for an user
37 equal or higher to that ID.
38
39 But if we are at the maximum ID and then ask for the "next"
40 one, we may wrap back to zero.  In this case, userspace
41 may loop forever, because it will start querying again
42 at zero.
43
44 We'll fix this in userspace as well, but for the kernel,
45 return -ENOENT if we ask for the next quota ID
46 past UINT_MAX so the caller knows to stop.
47
48 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
49 ---
50
51 diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
52 index 7a30b8f..dbeddd9 100644
53 --- a/fs/xfs/xfs_dquot.c
54 +++ b/fs/xfs/xfs_dquot.c
55 @@ -710,6 +710,10 @@
56         /* Simple advance */
57         next_id = *id + 1;
58  
59 +       /* If we'd wrap past the max ID, stop */
60 +       if (next_id < *id)
61 +               return -ENOENT;
62 +
63         /* If new ID is within the current chunk, advancing it sufficed */
64         if (next_id % mp->m_quotainfo->qi_dqperchunk) {
65                 *id = next_id;
66
67 From:   Brian Foster <bfoster@redhat.com>
68 Subject: [PATCH] xfs: prevent quotacheck from overloading inode lru
69
70 Quotacheck runs at mount time in situations where quota accounting must
71 be recalculated. In doing so, it uses bulkstat to visit every inode in
72 the filesystem. Historically, every inode processed during quotacheck
73 was released and immediately tagged for reclaim because quotacheck runs
74 before the superblock is marked active by the VFS. In other words,
75 the final iput() lead to an immediate ->destroy_inode() call, which
76 allowed the XFS background reclaim worker to start reclaiming inodes.
77
78 Commit 17c12bcd3 ("xfs: when replaying bmap operations, don't let
79 unlinked inodes get reaped") marks the XFS superblock active sooner as
80 part of the mount process to support caching inodes processed during log
81 recovery. This occurs before quotacheck and thus means all inodes
82 processed by quotacheck are inserted to the LRU on release.  The
83 s_umount lock is held until the mount has completed and thus prevents
84 the shrinkers from operating on the sb. This means that quotacheck can
85 excessively populate the inode LRU and lead to OOM conditions on systems
86 without sufficient RAM.
87
88 Update the quotacheck bulkstat handler to set XFS_IGET_DONTCACHE on
89 inodes processed by quotacheck. This causes ->drop_inode() to return 1
90 and in turn causes iput_final() to evict the inode. This preserves the
91 original quotacheck behavior and prevents it from overloading the LRU
92 and running out of memory.
93
94 CC: stable@vger.kernel.org # v4.9
95 Reported-by: Martin Svec <martin.svec@zoner.cz>
96 Signed-off-by: Brian Foster <bfoster@redhat.com>
97 ---
98  fs/xfs/xfs_qm.c | 3 ++-
99  1 file changed, 2 insertions(+), 1 deletion(-)
100
101 diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
102 index 45e50ea..b669b12 100644
103 --- a/fs/xfs/xfs_qm.c
104 +++ b/fs/xfs/xfs_qm.c
105 @@ -1177,7 +1177,8 @@ xfs_qm_dqusage_adjust(
106          * the case in all other instances. It's OK that we do this because
107          * quotacheck is done only at mount time.
108          */
109 -       error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_EXCL, &ip);
110 +       error = xfs_iget(mp, NULL, ino, XFS_IGET_DONTCACHE, XFS_ILOCK_EXCL,
111 +                        &ip);
112         if (error) {
113                 *res = BULKSTAT_RV_NOTHING;
114                 return error;
115 -- 
116 2.7.4
117
This page took 0.640217 seconds and 4 git commands to generate.