]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
- up to 4.4.1; imq updated to linuximq.net version
[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 inode readahead in log recovery, we do can do the
33 readahead before we've replayed the icreate transaction that stamps
34 the buffer with inode cores. The inode readahead verifier catches
35 this and marks the buffer as !done to indicate that it doesn't yet
36 contain valid inodes.
37
38 In adding buffer error notification  (i.e. setting b_error = -EIO at
39 the same time as as we clear the done flag) to such a readahead
40 verifier failure, we can then get subsequent inode recovery failing
41 with this error:
42
43 XFS (dm-0): metadata I/O error: block 0xa00060 ("xlog_recover_do..(read#2)") error 5 numblks 32
44
45 This occurs when readahead completion races with icreate item replay
46 such as:
47
48         inode readahead
49                 find buffer
50                 lock buffer
51                 submit RA io
52         ....
53         icreate recovery
54             xfs_trans_get_buffer
55                 find buffer
56                 lock buffer
57                 <blocks on RA completion>
58         .....
59         <ra completion>
60                 fails verifier
61                 clear XBF_DONE
62                 set bp->b_error = -EIO
63                 release and unlock buffer
64         <icreate gains lock>
65         icreate initialises buffer
66         marks buffer as done
67         adds buffer to delayed write queue
68         releases buffer
69
70 At this point, we have an initialised inode buffer that is up to
71 date but has an -EIO state registered against it. When we finally
72 get to recovering an inode in that buffer:
73
74         inode item recovery
75             xfs_trans_read_buffer
76                 find buffer
77                 lock buffer
78                 sees XBF_DONE is set, returns buffer
79             sees bp->b_error is set
80                 fail log recovery!
81
82 Essentially, we need xfs_trans_get_buf_map() to clear the error status of
83 the buffer when doing a lookup. This function returns uninitialised
84 buffers, so the buffer returned can not be in an error state and
85 none of the code that uses this function expects b_error to be set
86 on return. Indeed, there is an ASSERT(!bp->b_error); in the
87 transaction case in xfs_trans_get_buf_map() that would have caught
88 this if log recovery used transactions....
89
90 This patch firstly changes the inode readahead failure to set -EIO
91 on the buffer, and secondly changes xfs_buf_get_map() to never
92 return a buffer with an error state set so this first change doesn't
93 cause unexpected log recovery failures.
94
95 Signed-off-by: Dave Chinner <dchinner@redhat.com>
96 ---
97  fs/xfs/libxfs/xfs_inode_buf.c | 12 +++++++-----
98  fs/xfs/xfs_buf.c              |  7 +++++++
99  2 files changed, 14 insertions(+), 5 deletions(-)
100
101 diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
102 index 1b8d98a..ff17c48 100644
103 --- a/fs/xfs/libxfs/xfs_inode_buf.c
104 +++ b/fs/xfs/libxfs/xfs_inode_buf.c
105 @@ -62,11 +62,12 @@ xfs_inobp_check(
106   * has not had the inode cores stamped into it. Hence for readahead, the buffer
107   * may be potentially invalid.
108   *
109 - * If the readahead buffer is invalid, we don't want to mark it with an error,
110 - * but we do want to clear the DONE status of the buffer so that a followup read
111 - * will re-read it from disk. This will ensure that we don't get an unnecessary
112 - * warnings during log recovery and we don't get unnecssary panics on debug
113 - * kernels.
114 + * If the readahead buffer is invalid, we need to mark it with an error and
115 + * clear the DONE status of the buffer so that a followup read will re-read it
116 + * from disk. We don't report the error otherwise to avoid warnings during log
117 + * recovery and we don't get unnecssary panics on debug kernels. We use EIO here
118 + * because all we want to do is say readahead failed; there is no-one to report
119 + * the error to, so this will distinguish it from a non-ra verifier failure.
120   */
121  static void
122  xfs_inode_buf_verify(
123 @@ -93,6 +94,7 @@ xfs_inode_buf_verify(
124                                                 XFS_RANDOM_ITOBP_INOTOBP))) {
125                         if (readahead) {
126                                 bp->b_flags &= ~XBF_DONE;
127 +                               xfs_buf_ioerror(bp, -EIO);
128                                 return;
129                         }
130  
131 diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
132 index 45a8ea7..ae86b16 100644
133 --- a/fs/xfs/xfs_buf.c
134 +++ b/fs/xfs/xfs_buf.c
135 @@ -604,6 +604,13 @@ found:
136                 }
137         }
138  
139 +       /*
140 +        * Clear b_error if this is a lookup from a caller that doesn't expect
141 +        * valid data to be found in the buffer.
142 +        */
143 +       if (!(flags & XBF_READ))
144 +               xfs_buf_ioerror(bp, 0);
145 +
146         XFS_STATS_INC(target->bt_mount, xb_get);
147         trace_xfs_buf_get(bp, flags, _RET_IP_);
148         return bp;
149 -- 
150 2.5.0
151
152 _______________________________________________
153 xfs mailing list
154 xfs@oss.sgi.com
155 http://oss.sgi.com/mailman/listinfo/xfs
156 From: Dave Chinner <dchinner@redhat.com>
157
158 When we do dquot readahead in log recovery, we do not use a verifier
159 as the underlying buffer may not have dquots in it. e.g. the
160 allocation operation hasn't yet been replayed. Hence we do not want
161 to fail recovery because we detect an operation to be replayed has
162 not been run yet. This problem was addressed for inodes in commit
163 d891400 ("xfs: inode buffers may not be valid during recovery
164 readahead") but the problem was not recognised to exist for dquots
165 and their buffers as the dquot readahead did not have a verifier.
166
167 The result of not using a verifier is that when the buffer is then
168 next read to replay a dquot modification, the dquot buffer verifier
169 will only be attached to the buffer if *readahead is not complete*.
170 Hence we can read the buffer, replay the dquot changes and then add
171 it to the delwri submission list without it having a verifier
172 attached to it. This then generates warnings in xfs_buf_ioapply(),
173 which catches and warns about this case.
174
175 Fix this and make it handle the same readahead verifier error cases
176 as for inode buffers by adding a new readahead verifier that has a
177 write operation as well as a read operation that marks the buffer as
178 not done if any corruption is detected.  Also make sure we don't run
179 readahead if the dquot buffer has been marked as cancelled by
180 recovery.
181
182 This will result in readahead either succeeding and the buffer
183 having a valid write verifier, or readahead failing and the buffer
184 state requiring the subsequent read to resubmit the IO with the new
185 verifier.  In either case, this will result in the buffer always
186 ending up with a valid write verifier on it.
187
188 Note: we also need to fix the inode buffer readahead error handling
189 to mark the buffer with EIO. Brian noticed the code I copied from
190 there wrong during review, so fix it at the same time. Add comments
191 linking the two functions that handle readahead verifier errors
192 together so we don't forget this behavioural link in future.
193
194 cc: <stable@vger.kernel.org> # 3.12 - current
195 Signed-off-by: Dave Chinner <dchinner@redhat.com>
196 Reviewed-by: Brian Foster <bfoster@redhat.com>
197 Signed-off-by: Dave Chinner <david@fromorbit.com>
198 ---
199  fs/xfs/libxfs/xfs_dquot_buf.c  | 36 ++++++++++++++++++++++++++++++------
200  fs/xfs/libxfs/xfs_inode_buf.c  |  2 ++
201  fs/xfs/libxfs/xfs_quota_defs.h |  2 +-
202  fs/xfs/libxfs/xfs_shared.h     |  1 +
203  fs/xfs/xfs_log_recover.c       |  9 +++++++--
204  5 files changed, 41 insertions(+), 9 deletions(-)
205
206 diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
207 index 11cefb2..3cc3cf7 100644
208 --- a/fs/xfs/libxfs/xfs_dquot_buf.c
209 +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
210 @@ -54,7 +54,7 @@ xfs_dqcheck(
211         xfs_dqid_t       id,
212         uint             type,    /* used only when IO_dorepair is true */
213         uint             flags,
214 -       char             *str)
215 +       const char       *str)
216  {
217         xfs_dqblk_t      *d = (xfs_dqblk_t *)ddq;
218         int             errs = 0;
219 @@ -207,7 +207,8 @@ xfs_dquot_buf_verify_crc(
220  STATIC bool
221  xfs_dquot_buf_verify(
222         struct xfs_mount        *mp,
223 -       struct xfs_buf          *bp)
224 +       struct xfs_buf          *bp,
225 +       int                     warn)
226  {
227         struct xfs_dqblk        *d = (struct xfs_dqblk *)bp->b_addr;
228         xfs_dqid_t              id = 0;
229 @@ -240,8 +241,7 @@ xfs_dquot_buf_verify(
230                 if (i == 0)
231                         id = be32_to_cpu(ddq->d_id);
232  
233 -               error = xfs_dqcheck(mp, ddq, id + i, 0, XFS_QMOPT_DOWARN,
234 -                                      "xfs_dquot_buf_verify");
235 +               error = xfs_dqcheck(mp, ddq, id + i, 0, warn, __func__);
236                 if (error)
237                         return false;
238         }
239 @@ -256,7 +256,7 @@ xfs_dquot_buf_read_verify(
240  
241         if (!xfs_dquot_buf_verify_crc(mp, bp))
242                 xfs_buf_ioerror(bp, -EFSBADCRC);
243 -       else if (!xfs_dquot_buf_verify(mp, bp))
244 +       else if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN))
245                 xfs_buf_ioerror(bp, -EFSCORRUPTED);
246  
247         if (bp->b_error)
248 @@ -264,6 +264,25 @@ xfs_dquot_buf_read_verify(
249  }
250  
251  /*
252 + * readahead errors are silent and simply leave the buffer as !done so a real
253 + * read will then be run with the xfs_dquot_buf_ops verifier. See
254 + * xfs_inode_buf_verify() for why we use EIO and ~XBF_DONE here rather than
255 + * reporting the failure.
256 + */
257 +static void
258 +xfs_dquot_buf_readahead_verify(
259 +       struct xfs_buf  *bp)
260 +{
261 +       struct xfs_mount        *mp = bp->b_target->bt_mount;
262 +
263 +       if (!xfs_dquot_buf_verify_crc(mp, bp) ||
264 +           !xfs_dquot_buf_verify(mp, bp, 0)) {
265 +               xfs_buf_ioerror(bp, -EIO);
266 +               bp->b_flags &= ~XBF_DONE;
267 +       }
268 +}
269 +
270 +/*
271   * we don't calculate the CRC here as that is done when the dquot is flushed to
272   * the buffer after the update is done. This ensures that the dquot in the
273   * buffer always has an up-to-date CRC value.
274 @@ -274,7 +293,7 @@ xfs_dquot_buf_write_verify(
275  {
276         struct xfs_mount        *mp = bp->b_target->bt_mount;
277  
278 -       if (!xfs_dquot_buf_verify(mp, bp)) {
279 +       if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN)) {
280                 xfs_buf_ioerror(bp, -EFSCORRUPTED);
281                 xfs_verifier_error(bp);
282                 return;
283 @@ -287,3 +306,8 @@ const struct xfs_buf_ops xfs_dquot_buf_ops = {
284         .verify_write = xfs_dquot_buf_write_verify,
285  };
286  
287 +const struct xfs_buf_ops xfs_dquot_buf_ra_ops = {
288 +
289 +       .verify_read = xfs_dquot_buf_readahead_verify,
290 +       .verify_write = xfs_dquot_buf_write_verify,
291 +};
292 diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
293 index ff17c48..1aabfda 100644
294 --- a/fs/xfs/libxfs/xfs_inode_buf.c
295 +++ b/fs/xfs/libxfs/xfs_inode_buf.c
296 @@ -68,6 +68,8 @@ xfs_inobp_check(
297   * recovery and we don't get unnecssary panics on debug kernels. We use EIO here
298   * because all we want to do is say readahead failed; there is no-one to report
299   * the error to, so this will distinguish it from a non-ra verifier failure.
300 + * Changes to this readahead error behavour also need to be reflected in
301 + * xfs_dquot_buf_readahead_verify().
302   */
303  static void
304  xfs_inode_buf_verify(
305 diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
306 index 1b0a083..f51078f 100644
307 --- a/fs/xfs/libxfs/xfs_quota_defs.h
308 +++ b/fs/xfs/libxfs/xfs_quota_defs.h
309 @@ -153,7 +153,7 @@ typedef __uint16_t  xfs_qwarncnt_t;
310  #define XFS_QMOPT_RESBLK_MASK  (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
311  
312  extern int xfs_dqcheck(struct xfs_mount *mp, xfs_disk_dquot_t *ddq,
313 -                      xfs_dqid_t id, uint type, uint flags, char *str);
314 +                      xfs_dqid_t id, uint type, uint flags, const char *str);
315  extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
316  
317  #endif /* __XFS_QUOTA_H__ */
318 diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
319 index 5be5297..15c3ceb 100644
320 --- a/fs/xfs/libxfs/xfs_shared.h
321 +++ b/fs/xfs/libxfs/xfs_shared.h
322 @@ -49,6 +49,7 @@ extern const struct xfs_buf_ops xfs_inobt_buf_ops;
323  extern const struct xfs_buf_ops xfs_inode_buf_ops;
324  extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
325  extern const struct xfs_buf_ops xfs_dquot_buf_ops;
326 +extern const struct xfs_buf_ops xfs_dquot_buf_ra_ops;
327  extern const struct xfs_buf_ops xfs_sb_buf_ops;
328  extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
329  extern const struct xfs_buf_ops xfs_symlink_buf_ops;
330 diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
331 index c5ecaac..5991cdc 100644
332 --- a/fs/xfs/xfs_log_recover.c
333 +++ b/fs/xfs/xfs_log_recover.c
334 @@ -3204,6 +3204,7 @@ xlog_recover_dquot_ra_pass2(
335         struct xfs_disk_dquot   *recddq;
336         struct xfs_dq_logformat *dq_f;
337         uint                    type;
338 +       int                     len;
339  
340  
341         if (mp->m_qflags == 0)
342 @@ -3224,8 +3225,12 @@ xlog_recover_dquot_ra_pass2(
343         ASSERT(dq_f);
344         ASSERT(dq_f->qlf_len == 1);
345  
346 -       xfs_buf_readahead(mp->m_ddev_targp, dq_f->qlf_blkno,
347 -                         XFS_FSB_TO_BB(mp, dq_f->qlf_len), NULL);
348 +       len = XFS_FSB_TO_BB(mp, dq_f->qlf_len);
349 +       if (xlog_peek_buffer_cancelled(log, dq_f->qlf_blkno, len, 0))
350 +               return;
351 +
352 +       xfs_buf_readahead(mp->m_ddev_targp, dq_f->qlf_blkno, len,
353 +                         &xfs_dquot_buf_ra_ops);
354  }
355  
356  STATIC void
357 -- 
358 2.5.0
359
360 _______________________________________________
361 xfs mailing list
362 xfs@oss.sgi.com
363 http://oss.sgi.com/mailman/listinfo/xfs
364 From david at fromorbit.com  Tue Jan 12 23:12:48 2016
365 From: david at fromorbit.com (Dave Chinner)
366 Date: Wed, 13 Jan 2016 16:12:48 +1100
367 Subject: [PATCH] Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"
368 Message-ID: <1452661968-11482-1-git-send-email-david@fromorbit.com>
369 Content-Length: 916
370 Lines: 30
371
372 This reverts commit 24ba16bb3d499c49974669cd8429c3e4138ab102 as it
373 prevents machines from suspending. This regression occurs when the
374 xfsaild is idle on entry to suspend, and so there s no activity to
375 wake it from it's idle sleep and hence see that it is supposed to
376 freeze. Hence the freezer times out waiting for it and suspend is
377 cancelled.
378
379 There is no obvious fix for this short of freezing the filesystem
380 properly, so revert this change for now.
381
382 Signed-off-by: Dave Chinner <david at fromorbit.com>
383 ---
384  fs/xfs/xfs_trans_ail.c | 1 -
385  1 file changed, 1 deletion(-)
386
387 diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
388 index aa67339..4f18fd9 100644
389 --- a/fs/xfs/xfs_trans_ail.c
390 +++ b/fs/xfs/xfs_trans_ail.c
391 @@ -497,7 +497,6 @@ xfsaild(
392         long            tout = 0;       /* milliseconds */
393  
394         current->flags |= PF_MEMALLOC;
395 -       set_freezable();
396  
397         while (!kthread_should_stop()) {
398                 if (tout && tout <= 20)
399 -- 
400 2.5.0
This page took 0.078518 seconds and 4 git commands to generate.