]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-small_fixes.patch
- we want mei to be in module
[packages/kernel.git] / kernel-small_fixes.patch
CommitLineData
08aa9d92 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
2136e199
AM
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
7e7bde06 29
28b20467
AM
30From: Dave Chinner <dchinner@redhat.com>
31
32When we do inode readahead in log recovery, we do can do the
33readahead before we've replayed the icreate transaction that stamps
34the buffer with inode cores. The inode readahead verifier catches
35this and marks the buffer as !done to indicate that it doesn't yet
36contain valid inodes.
37
38In adding buffer error notification (i.e. setting b_error = -EIO at
39the same time as as we clear the done flag) to such a readahead
40verifier failure, we can then get subsequent inode recovery failing
41with this error:
42
43XFS (dm-0): metadata I/O error: block 0xa00060 ("xlog_recover_do..(read#2)") error 5 numblks 32
44
45This occurs when readahead completion races with icreate item replay
46such 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
70At this point, we have an initialised inode buffer that is up to
71date but has an -EIO state registered against it. When we finally
72get 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
82Essentially, we need xfs_trans_get_buf_map() to clear the error status of
83the buffer when doing a lookup. This function returns uninitialised
84buffers, so the buffer returned can not be in an error state and
85none of the code that uses this function expects b_error to be set
86on return. Indeed, there is an ASSERT(!bp->b_error); in the
87transaction case in xfs_trans_get_buf_map() that would have caught
88this if log recovery used transactions....
89
90This patch firstly changes the inode readahead failure to set -EIO
91on the buffer, and secondly changes xfs_buf_get_map() to never
92return a buffer with an error state set so this first change doesn't
93cause unexpected log recovery failures.
94
95Signed-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
101diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
102index 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
131diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
132index 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+
be52b249 146 XFS_STATS_INC(target->bt_mount, xb_get);
28b20467
AM
147 trace_xfs_buf_get(bp, flags, _RET_IP_);
148 return bp;
149--
1502.5.0
151
152_______________________________________________
153xfs mailing list
154xfs@oss.sgi.com
155http://oss.sgi.com/mailman/listinfo/xfs
ea1e61a2
AM
156From: Dave Chinner <dchinner@redhat.com>
157
158When we do dquot readahead in log recovery, we do not use a verifier
159as the underlying buffer may not have dquots in it. e.g. the
160allocation operation hasn't yet been replayed. Hence we do not want
161to fail recovery because we detect an operation to be replayed has
162not been run yet. This problem was addressed for inodes in commit
163d891400 ("xfs: inode buffers may not be valid during recovery
164readahead") but the problem was not recognised to exist for dquots
165and their buffers as the dquot readahead did not have a verifier.
166
167The result of not using a verifier is that when the buffer is then
168next read to replay a dquot modification, the dquot buffer verifier
169will only be attached to the buffer if *readahead is not complete*.
170Hence we can read the buffer, replay the dquot changes and then add
171it to the delwri submission list without it having a verifier
172attached to it. This then generates warnings in xfs_buf_ioapply(),
173which catches and warns about this case.
174
175Fix this and make it handle the same readahead verifier error cases
176as for inode buffers by adding a new readahead verifier that has a
177write operation as well as a read operation that marks the buffer as
178not done if any corruption is detected. Also make sure we don't run
179readahead if the dquot buffer has been marked as cancelled by
180recovery.
181
182This will result in readahead either succeeding and the buffer
183having a valid write verifier, or readahead failing and the buffer
184state requiring the subsequent read to resubmit the IO with the new
185verifier. In either case, this will result in the buffer always
186ending up with a valid write verifier on it.
187
188Note: we also need to fix the inode buffer readahead error handling
189to mark the buffer with EIO. Brian noticed the code I copied from
190there wrong during review, so fix it at the same time. Add comments
191linking the two functions that handle readahead verifier errors
192together so we don't forget this behavioural link in future.
193
194cc: <stable@vger.kernel.org> # 3.12 - current
195Signed-off-by: Dave Chinner <dchinner@redhat.com>
28b20467
AM
196Reviewed-by: Brian Foster <bfoster@redhat.com>
197Signed-off-by: Dave Chinner <david@fromorbit.com>
ea1e61a2 198---
ea1e61a2 199 fs/xfs/libxfs/xfs_dquot_buf.c | 36 ++++++++++++++++++++++++++++++------
28b20467 200 fs/xfs/libxfs/xfs_inode_buf.c | 2 ++
ea1e61a2
AM
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 +++++++--
28b20467 204 5 files changed, 41 insertions(+), 9 deletions(-)
ea1e61a2
AM
205
206diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
207index 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+};
292diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
28b20467 293index ff17c48..1aabfda 100644
ea1e61a2
AM
294--- a/fs/xfs/libxfs/xfs_inode_buf.c
295+++ b/fs/xfs/libxfs/xfs_inode_buf.c
28b20467
AM
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.
ea1e61a2
AM
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(
ea1e61a2
AM
305diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
306index 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__ */
318diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
319index 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;
330diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
28b20467 331index c5ecaac..5991cdc 100644
ea1e61a2
AM
332--- a/fs/xfs/xfs_log_recover.c
333+++ b/fs/xfs/xfs_log_recover.c
28b20467 334@@ -3204,6 +3204,7 @@ xlog_recover_dquot_ra_pass2(
ea1e61a2
AM
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)
28b20467 342@@ -3224,8 +3225,12 @@ xlog_recover_dquot_ra_pass2(
ea1e61a2
AM
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
28b20467
AM
357--
3582.5.0
ea1e61a2
AM
359
360_______________________________________________
361xfs mailing list
362xfs@oss.sgi.com
363http://oss.sgi.com/mailman/listinfo/xfs
a56bb640
AM
364From david at fromorbit.com Tue Jan 12 23:12:48 2016
365From: david at fromorbit.com (Dave Chinner)
366Date: Wed, 13 Jan 2016 16:12:48 +1100
367Subject: [PATCH] Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"
368Message-ID: <1452661968-11482-1-git-send-email-david@fromorbit.com>
369Content-Length: 916
370Lines: 30
371
372This reverts commit 24ba16bb3d499c49974669cd8429c3e4138ab102 as it
373prevents machines from suspending. This regression occurs when the
374xfsaild is idle on entry to suspend, and so there s no activity to
375wake it from it's idle sleep and hence see that it is supposed to
376freeze. Hence the freezer times out waiting for it and suspend is
377cancelled.
378
379There is no obvious fix for this short of freezing the filesystem
380properly, so revert this change for now.
381
382Signed-off-by: Dave Chinner <david at fromorbit.com>
383---
384 fs/xfs/xfs_trans_ail.c | 1 -
385 1 file changed, 1 deletion(-)
386
387diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
388index 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--
4002.5.0
401
402
5d571d7a
AM
403From 7ca88764d45c209791e8813131c1457c2e9e51e7 Mon Sep 17 00:00:00 2001
404From: Yevgeny Pats <yevgeny@perception-point.io>
405Date: Mon, 11 Jan 2016 12:05:28 +0000
406Subject: KEYS: Fix keyring ref leak in join_session_keyring()
407
408If a thread is asked to join as a session keyring the keyring that's already
409set as its session, we leak a keyring reference.
410
411This can be tested with the following program:
412
413 #include <stddef.h>
414 #include <stdio.h>
415 #include <sys/types.h>
416 #include <keyutils.h>
417
418 int main(int argc, const char *argv[])
419 {
420 int i = 0;
421 key_serial_t serial;
422
423 serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
424 "leaked-keyring");
425 if (serial < 0) {
426 perror("keyctl");
427 return -1;
428 }
429
430 if (keyctl(KEYCTL_SETPERM, serial,
431 KEY_POS_ALL | KEY_USR_ALL) < 0) {
432 perror("keyctl");
433 return -1;
434 }
435
436 for (i = 0; i < 100; i++) {
437 serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
438 "leaked-keyring");
439 if (serial < 0) {
440 perror("keyctl");
441 return -1;
442 }
443 }
444
445 return 0;
446 }
447
448If, after the program has run, there something like the following line in
449/proc/keys:
450
4513f3d898f I--Q--- 100 perm 3f3f0000 0 0 keyring leaked-keyring: empty
452
453with a usage count of 100 * the number of times the program has been run,
454then the kernel is malfunctioning. If leaked-keyring has zero usages or
455has been garbage collected, then the problem is fixed.
456
457Reported-by: Yevgeny Pats <yevgeny@perception-point.io>
458Signed-off-by: David Howells <dhowells@redhat.com>
459---
460 security/keys/process_keys.c | 1 +
461 1 file changed, 1 insertion(+)
462
463diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
464index a3f85d2..e6d50172 100644
465--- a/security/keys/process_keys.c
466+++ b/security/keys/process_keys.c
467@@ -794,6 +794,7 @@ long join_session_keyring(const char *name)
468 ret = PTR_ERR(keyring);
469 goto error2;
470 } else if (keyring == new->session_keyring) {
471+ key_put(keyring);
472 ret = 0;
473 goto error2;
474 }
475--
4762.7.0.rc3
477
This page took 0.226144 seconds and 4 git commands to generate.