]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
- up to 4.4.3
[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: Dave Chinner <dchinner@redhat.com>
31
32 When we do dquot readahead in log recovery, we do not use a verifier
33 as the underlying buffer may not have dquots in it. e.g. the
34 allocation operation hasn't yet been replayed. Hence we do not want
35 to fail recovery because we detect an operation to be replayed has
36 not been run yet. This problem was addressed for inodes in commit
37 d891400 ("xfs: inode buffers may not be valid during recovery
38 readahead") but the problem was not recognised to exist for dquots
39 and their buffers as the dquot readahead did not have a verifier.
40
41 The result of not using a verifier is that when the buffer is then
42 next read to replay a dquot modification, the dquot buffer verifier
43 will only be attached to the buffer if *readahead is not complete*.
44 Hence we can read the buffer, replay the dquot changes and then add
45 it to the delwri submission list without it having a verifier
46 attached to it. This then generates warnings in xfs_buf_ioapply(),
47 which catches and warns about this case.
48
49 Fix this and make it handle the same readahead verifier error cases
50 as for inode buffers by adding a new readahead verifier that has a
51 write operation as well as a read operation that marks the buffer as
52 not done if any corruption is detected.  Also make sure we don't run
53 readahead if the dquot buffer has been marked as cancelled by
54 recovery.
55
56 This will result in readahead either succeeding and the buffer
57 having a valid write verifier, or readahead failing and the buffer
58 state requiring the subsequent read to resubmit the IO with the new
59 verifier.  In either case, this will result in the buffer always
60 ending up with a valid write verifier on it.
61
62 Note: we also need to fix the inode buffer readahead error handling
63 to mark the buffer with EIO. Brian noticed the code I copied from
64 there wrong during review, so fix it at the same time. Add comments
65 linking the two functions that handle readahead verifier errors
66 together so we don't forget this behavioural link in future.
67
68 cc: <stable@vger.kernel.org> # 3.12 - current
69 Signed-off-by: Dave Chinner <dchinner@redhat.com>
70 Reviewed-by: Brian Foster <bfoster@redhat.com>
71 Signed-off-by: Dave Chinner <david@fromorbit.com>
72 ---
73  fs/xfs/libxfs/xfs_dquot_buf.c  | 36 ++++++++++++++++++++++++++++++------
74  fs/xfs/libxfs/xfs_inode_buf.c  |  2 ++
75  fs/xfs/libxfs/xfs_quota_defs.h |  2 +-
76  fs/xfs/libxfs/xfs_shared.h     |  1 +
77  fs/xfs/xfs_log_recover.c       |  9 +++++++--
78  5 files changed, 41 insertions(+), 9 deletions(-)
79
80 diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
81 index 11cefb2..3cc3cf7 100644
82 --- a/fs/xfs/libxfs/xfs_dquot_buf.c
83 +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
84 @@ -54,7 +54,7 @@ xfs_dqcheck(
85         xfs_dqid_t       id,
86         uint             type,    /* used only when IO_dorepair is true */
87         uint             flags,
88 -       char             *str)
89 +       const char       *str)
90  {
91         xfs_dqblk_t      *d = (xfs_dqblk_t *)ddq;
92         int             errs = 0;
93 @@ -207,7 +207,8 @@ xfs_dquot_buf_verify_crc(
94  STATIC bool
95  xfs_dquot_buf_verify(
96         struct xfs_mount        *mp,
97 -       struct xfs_buf          *bp)
98 +       struct xfs_buf          *bp,
99 +       int                     warn)
100  {
101         struct xfs_dqblk        *d = (struct xfs_dqblk *)bp->b_addr;
102         xfs_dqid_t              id = 0;
103 @@ -240,8 +241,7 @@ xfs_dquot_buf_verify(
104                 if (i == 0)
105                         id = be32_to_cpu(ddq->d_id);
106  
107 -               error = xfs_dqcheck(mp, ddq, id + i, 0, XFS_QMOPT_DOWARN,
108 -                                      "xfs_dquot_buf_verify");
109 +               error = xfs_dqcheck(mp, ddq, id + i, 0, warn, __func__);
110                 if (error)
111                         return false;
112         }
113 @@ -256,7 +256,7 @@ xfs_dquot_buf_read_verify(
114  
115         if (!xfs_dquot_buf_verify_crc(mp, bp))
116                 xfs_buf_ioerror(bp, -EFSBADCRC);
117 -       else if (!xfs_dquot_buf_verify(mp, bp))
118 +       else if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN))
119                 xfs_buf_ioerror(bp, -EFSCORRUPTED);
120  
121         if (bp->b_error)
122 @@ -264,6 +264,25 @@ xfs_dquot_buf_read_verify(
123  }
124  
125  /*
126 + * readahead errors are silent and simply leave the buffer as !done so a real
127 + * read will then be run with the xfs_dquot_buf_ops verifier. See
128 + * xfs_inode_buf_verify() for why we use EIO and ~XBF_DONE here rather than
129 + * reporting the failure.
130 + */
131 +static void
132 +xfs_dquot_buf_readahead_verify(
133 +       struct xfs_buf  *bp)
134 +{
135 +       struct xfs_mount        *mp = bp->b_target->bt_mount;
136 +
137 +       if (!xfs_dquot_buf_verify_crc(mp, bp) ||
138 +           !xfs_dquot_buf_verify(mp, bp, 0)) {
139 +               xfs_buf_ioerror(bp, -EIO);
140 +               bp->b_flags &= ~XBF_DONE;
141 +       }
142 +}
143 +
144 +/*
145   * we don't calculate the CRC here as that is done when the dquot is flushed to
146   * the buffer after the update is done. This ensures that the dquot in the
147   * buffer always has an up-to-date CRC value.
148 @@ -274,7 +293,7 @@ xfs_dquot_buf_write_verify(
149  {
150         struct xfs_mount        *mp = bp->b_target->bt_mount;
151  
152 -       if (!xfs_dquot_buf_verify(mp, bp)) {
153 +       if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN)) {
154                 xfs_buf_ioerror(bp, -EFSCORRUPTED);
155                 xfs_verifier_error(bp);
156                 return;
157 @@ -287,3 +306,8 @@ const struct xfs_buf_ops xfs_dquot_buf_ops = {
158         .verify_write = xfs_dquot_buf_write_verify,
159  };
160  
161 +const struct xfs_buf_ops xfs_dquot_buf_ra_ops = {
162 +
163 +       .verify_read = xfs_dquot_buf_readahead_verify,
164 +       .verify_write = xfs_dquot_buf_write_verify,
165 +};
166 diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
167 index ff17c48..1aabfda 100644
168 --- a/fs/xfs/libxfs/xfs_inode_buf.c
169 +++ b/fs/xfs/libxfs/xfs_inode_buf.c
170 @@ -68,6 +68,8 @@ xfs_inobp_check(
171   * recovery and we don't get unnecssary panics on debug kernels. We use EIO here
172   * because all we want to do is say readahead failed; there is no-one to report
173   * the error to, so this will distinguish it from a non-ra verifier failure.
174 + * Changes to this readahead error behavour also need to be reflected in
175 + * xfs_dquot_buf_readahead_verify().
176   */
177  static void
178  xfs_inode_buf_verify(
179 diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
180 index 1b0a083..f51078f 100644
181 --- a/fs/xfs/libxfs/xfs_quota_defs.h
182 +++ b/fs/xfs/libxfs/xfs_quota_defs.h
183 @@ -153,7 +153,7 @@ typedef __uint16_t  xfs_qwarncnt_t;
184  #define XFS_QMOPT_RESBLK_MASK  (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
185  
186  extern int xfs_dqcheck(struct xfs_mount *mp, xfs_disk_dquot_t *ddq,
187 -                      xfs_dqid_t id, uint type, uint flags, char *str);
188 +                      xfs_dqid_t id, uint type, uint flags, const char *str);
189  extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
190  
191  #endif /* __XFS_QUOTA_H__ */
192 diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
193 index 5be5297..15c3ceb 100644
194 --- a/fs/xfs/libxfs/xfs_shared.h
195 +++ b/fs/xfs/libxfs/xfs_shared.h
196 @@ -49,6 +49,7 @@ extern const struct xfs_buf_ops xfs_inobt_buf_ops;
197  extern const struct xfs_buf_ops xfs_inode_buf_ops;
198  extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
199  extern const struct xfs_buf_ops xfs_dquot_buf_ops;
200 +extern const struct xfs_buf_ops xfs_dquot_buf_ra_ops;
201  extern const struct xfs_buf_ops xfs_sb_buf_ops;
202  extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
203  extern const struct xfs_buf_ops xfs_symlink_buf_ops;
204 diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
205 index c5ecaac..5991cdc 100644
206 --- a/fs/xfs/xfs_log_recover.c
207 +++ b/fs/xfs/xfs_log_recover.c
208 @@ -3204,6 +3204,7 @@ xlog_recover_dquot_ra_pass2(
209         struct xfs_disk_dquot   *recddq;
210         struct xfs_dq_logformat *dq_f;
211         uint                    type;
212 +       int                     len;
213  
214  
215         if (mp->m_qflags == 0)
216 @@ -3224,8 +3225,12 @@ xlog_recover_dquot_ra_pass2(
217         ASSERT(dq_f);
218         ASSERT(dq_f->qlf_len == 1);
219  
220 -       xfs_buf_readahead(mp->m_ddev_targp, dq_f->qlf_blkno,
221 -                         XFS_FSB_TO_BB(mp, dq_f->qlf_len), NULL);
222 +       len = XFS_FSB_TO_BB(mp, dq_f->qlf_len);
223 +       if (xlog_peek_buffer_cancelled(log, dq_f->qlf_blkno, len, 0))
224 +               return;
225 +
226 +       xfs_buf_readahead(mp->m_ddev_targp, dq_f->qlf_blkno, len,
227 +                         &xfs_dquot_buf_ra_ops);
228  }
229  
230  STATIC void
231 -- 
232 2.5.0
233
234 _______________________________________________
235 xfs mailing list
236 xfs@oss.sgi.com
237 http://oss.sgi.com/mailman/listinfo/xfs
This page took 0.059698 seconds and 4 git commands to generate.