]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.1/mbox
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.1 / mbox
1 From linux@linux.site Thu Dec 10 21:25:40 2009
2 Message-Id: <20091211052540.442199443@linux.site>
3 User-Agent: quilt/0.47-14.9
4 Date: Thu, 10 Dec 2009 21:23:13 -0800
5 From: Greg KH <gregkh@suse.de>
6 To: linux-kernel@vger.kernel.org,
7 stable@kernel.org
8 Cc: stable-review@kernel.org,
9 torvalds@linux-foundation.org,
10 akpm@linux-foundation.org,
11 alan@lxorguk.ukuu.org.uk,
12 Sebastian Andrzej Siewior <sebastian@breakpoint.cc>,
13 Oleg Nesterov <oleg@redhat.com>,
14 Roland McGrath <roland@redhat.com>,
15 Kyle McMartin <kyle@mcmartin.ca>,
16 Thomas Gleixner <tglx@linutronix.de>,
17 Greg Kroah-Hartman <gregkh@suse.de>
18 Subject: [01/34] signal: Fix alternate signal stack check
19 References: <20091211052312.805428372@linux.site>
20 Content-Disposition: inline; filename=signal-fix-alternate-signal-stack-check.patch
21 Content-Length: 2919
22 Lines: 83
23
24 2.6.32-stable review patch. If anyone has any objections, please let us know.
25
26 ------------------
27
28 From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
29
30 commit 2a855dd01bc1539111adb7233f587c5c468732ac upstream.
31
32 All architectures in the kernel increment/decrement the stack pointer
33 before storing values on the stack.
34
35 On architectures which have the stack grow down sas_ss_sp == sp is not
36 on the alternate signal stack while sas_ss_sp + sas_ss_size == sp is
37 on the alternate signal stack.
38
39 On architectures which have the stack grow up sas_ss_sp == sp is on
40 the alternate signal stack while sas_ss_sp + sas_ss_size == sp is not
41 on the alternate signal stack.
42
43 The current implementation fails for architectures which have the
44 stack grow down on the corner case where sas_ss_sp == sp.This was
45 reported as Debian bug #544905 on AMD64.
46 Simplified test case: http://download.breakpoint.cc/tc-sig-stack.c
47
48 The test case creates the following stack scenario:
49 0xn0300 stack top
50 0xn0200 alt stack pointer top (when switching to alt stack)
51 0xn01ff alt stack end
52 0xn0100 alt stack start == stack pointer
53
54 If the signal is sent the stack pointer is pointing to the base
55 address of the alt stack and the kernel erroneously decides that it
56 has already switched to the alternate stack because of the current
57 check for "sp - sas_ss_sp < sas_ss_size"
58
59 On parisc (stack grows up) the scenario would be:
60 0xn0200 stack pointer
61 0xn01ff alt stack end
62 0xn0100 alt stack start = alt stack pointer base
63 (when switching to alt stack)
64 0xn0000 stack base
65
66 This is handled correctly by the current implementation.
67
68 [ tglx: Modified for archs which have the stack grow up (parisc) which
69 would fail with the correct implementation for stack grows
70 down. Added a check for sp >= current->sas_ss_sp which is
71 strictly not necessary but makes the code symetric for both
72 variants ]
73
74 Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
75 Cc: Oleg Nesterov <oleg@redhat.com>
76 Cc: Roland McGrath <roland@redhat.com>
77 Cc: Kyle McMartin <kyle@mcmartin.ca>
78 LKML-Reference: <20091025143758.GA6653@Chamillionaire.breakpoint.cc>
79 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
80 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
81
82 ---
83 include/linux/sched.h | 13 ++++++++++---
84 1 file changed, 10 insertions(+), 3 deletions(-)
85
86 --- a/include/linux/sched.h
87 +++ b/include/linux/sched.h
88 @@ -2086,11 +2086,18 @@ static inline int is_si_special(const st
89 return info <= SEND_SIG_FORCED;
90 }
91
92 -/* True if we are on the alternate signal stack. */
93 -
94 +/*
95 + * True if we are on the alternate signal stack.
96 + */
97 static inline int on_sig_stack(unsigned long sp)
98 {
99 - return (sp - current->sas_ss_sp < current->sas_ss_size);
100 +#ifdef CONFIG_STACK_GROWSUP
101 + return sp >= current->sas_ss_sp &&
102 + sp - current->sas_ss_sp < current->sas_ss_size;
103 +#else
104 + return sp > current->sas_ss_sp &&
105 + sp - current->sas_ss_sp <= current->sas_ss_size;
106 +#endif
107 }
108
109 static inline int sas_ss_flags(unsigned long sp)
110
111
112 From linux@linux.site Thu Dec 10 21:25:41 2009
113 Message-Id: <20091211052540.941627509@linux.site>
114 User-Agent: quilt/0.47-14.9
115 Date: Thu, 10 Dec 2009 21:23:14 -0800
116 From: Greg KH <gregkh@suse.de>
117 To: linux-kernel@vger.kernel.org,
118 stable@kernel.org
119 Cc: stable-review@kernel.org,
120 torvalds@linux-foundation.org,
121 akpm@linux-foundation.org,
122 alan@lxorguk.ukuu.org.uk,
123 James Smart <james.smart@emulex.com>,
124 James Bottomley <James.Bottomley@suse.de>,
125 Greg Kroah-Hartman <gregkh@suse.de>
126 Subject: [02/34] SCSI: scsi_lib_dma: fix bug with dma maps on nested scsi objects
127 References: <20091211052312.805428372@linux.site>
128 Content-Disposition: inline; filename=scsi-scsi_lib_dma-fix-bug-with-dma-maps-on-nested-scsi-objects.patch
129 Content-Length: 5210
130 Lines: 149
131
132 2.6.32-stable review patch. If anyone has any objections, please let us know.
133
134 ------------------
135
136 From: James Bottomley <James.Bottomley@suse.de>
137
138 commit d139b9bd0e52dda14fd13412e7096e68b56d0076 upstream.
139
140 Some of our virtual SCSI hosts don't have a proper bus parent at the
141 top, which can be a problem for doing DMA on them
142
143 This patch makes the host device cache a pointer to the physical bus
144 device and provides an extra API for setting it (the normal API picks
145 it up from the parent). This patch also modifies the qla2xxx and lpfc
146 vport logic to use the new DMA host setting API.
147
148 Acked-By: James Smart <james.smart@emulex.com>
149 Signed-off-by: James Bottomley <James.Bottomley@suse.de>
150 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
151
152 ---
153 drivers/scsi/hosts.c | 13 ++++++++++---
154 drivers/scsi/lpfc/lpfc_init.c | 2 +-
155 drivers/scsi/qla2xxx/qla_attr.c | 3 ++-
156 drivers/scsi/scsi_lib_dma.c | 4 ++--
157 include/scsi/scsi_host.h | 16 +++++++++++++++-
158 5 files changed, 30 insertions(+), 8 deletions(-)
159
160 --- a/drivers/scsi/hosts.c
161 +++ b/drivers/scsi/hosts.c
162 @@ -180,14 +180,20 @@ void scsi_remove_host(struct Scsi_Host *
163 EXPORT_SYMBOL(scsi_remove_host);
164
165 /**
166 - * scsi_add_host - add a scsi host
167 + * scsi_add_host_with_dma - add a scsi host with dma device
168 * @shost: scsi host pointer to add
169 * @dev: a struct device of type scsi class
170 + * @dma_dev: dma device for the host
171 + *
172 + * Note: You rarely need to worry about this unless you're in a
173 + * virtualised host environments, so use the simpler scsi_add_host()
174 + * function instead.
175 *
176 * Return value:
177 * 0 on success / != 0 for error
178 **/
179 -int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
180 +int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
181 + struct device *dma_dev)
182 {
183 struct scsi_host_template *sht = shost->hostt;
184 int error = -EINVAL;
185 @@ -207,6 +213,7 @@ int scsi_add_host(struct Scsi_Host *shos
186
187 if (!shost->shost_gendev.parent)
188 shost->shost_gendev.parent = dev ? dev : &platform_bus;
189 + shost->dma_dev = dma_dev;
190
191 error = device_add(&shost->shost_gendev);
192 if (error)
193 @@ -262,7 +269,7 @@ int scsi_add_host(struct Scsi_Host *shos
194 fail:
195 return error;
196 }
197 -EXPORT_SYMBOL(scsi_add_host);
198 +EXPORT_SYMBOL(scsi_add_host_with_dma);
199
200 static void scsi_host_dev_release(struct device *dev)
201 {
202 --- a/drivers/scsi/lpfc/lpfc_init.c
203 +++ b/drivers/scsi/lpfc/lpfc_init.c
204 @@ -2408,7 +2408,7 @@ lpfc_create_port(struct lpfc_hba *phba,
205 vport->els_tmofunc.function = lpfc_els_timeout;
206 vport->els_tmofunc.data = (unsigned long)vport;
207
208 - error = scsi_add_host(shost, dev);
209 + error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev);
210 if (error)
211 goto out_put_shost;
212
213 --- a/drivers/scsi/qla2xxx/qla_attr.c
214 +++ b/drivers/scsi/qla2xxx/qla_attr.c
215 @@ -1654,7 +1654,8 @@ qla24xx_vport_create(struct fc_vport *fc
216 fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
217 }
218
219 - if (scsi_add_host(vha->host, &fc_vport->dev)) {
220 + if (scsi_add_host_with_dma(vha->host, &fc_vport->dev,
221 + &ha->pdev->dev)) {
222 DEBUG15(printk("scsi(%ld): scsi_add_host failure for VP[%d].\n",
223 vha->host_no, vha->vp_idx));
224 goto vport_create_failed_2;
225 --- a/drivers/scsi/scsi_lib_dma.c
226 +++ b/drivers/scsi/scsi_lib_dma.c
227 @@ -23,7 +23,7 @@ int scsi_dma_map(struct scsi_cmnd *cmd)
228 int nseg = 0;
229
230 if (scsi_sg_count(cmd)) {
231 - struct device *dev = cmd->device->host->shost_gendev.parent;
232 + struct device *dev = cmd->device->host->dma_dev;
233
234 nseg = dma_map_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
235 cmd->sc_data_direction);
236 @@ -41,7 +41,7 @@ EXPORT_SYMBOL(scsi_dma_map);
237 void scsi_dma_unmap(struct scsi_cmnd *cmd)
238 {
239 if (scsi_sg_count(cmd)) {
240 - struct device *dev = cmd->device->host->shost_gendev.parent;
241 + struct device *dev = cmd->device->host->dma_dev;
242
243 dma_unmap_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
244 cmd->sc_data_direction);
245 --- a/include/scsi/scsi_host.h
246 +++ b/include/scsi/scsi_host.h
247 @@ -677,6 +677,12 @@ struct Scsi_Host {
248 void *shost_data;
249
250 /*
251 + * Points to the physical bus device we'd use to do DMA
252 + * Needed just in case we have virtual hosts.
253 + */
254 + struct device *dma_dev;
255 +
256 + /*
257 * We should ensure that this is aligned, both for better performance
258 * and also because some compilers (m68k) don't automatically force
259 * alignment to a long boundary.
260 @@ -720,7 +726,9 @@ extern int scsi_queue_work(struct Scsi_H
261 extern void scsi_flush_work(struct Scsi_Host *);
262
263 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
264 -extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
265 +extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
266 + struct device *,
267 + struct device *);
268 extern void scsi_scan_host(struct Scsi_Host *);
269 extern void scsi_rescan_device(struct device *);
270 extern void scsi_remove_host(struct Scsi_Host *);
271 @@ -731,6 +739,12 @@ extern const char *scsi_host_state_name(
272
273 extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
274
275 +static inline int __must_check scsi_add_host(struct Scsi_Host *host,
276 + struct device *dev)
277 +{
278 + return scsi_add_host_with_dma(host, dev, dev);
279 +}
280 +
281 static inline struct device *scsi_get_device(struct Scsi_Host *shost)
282 {
283 return shost->shost_gendev.parent;
284
285
286 From linux@linux.site Thu Dec 10 21:25:42 2009
287 Message-Id: <20091211052541.550415868@linux.site>
288 User-Agent: quilt/0.47-14.9
289 Date: Thu, 10 Dec 2009 21:23:15 -0800
290 From: Greg KH <gregkh@suse.de>
291 To: linux-kernel@vger.kernel.org,
292 stable@kernel.org
293 Cc: stable-review@kernel.org,
294 torvalds@linux-foundation.org,
295 akpm@linux-foundation.org,
296 alan@lxorguk.ukuu.org.uk,
297 Martin Michlmayr <tbm@cyrius.com>,
298 Boaz Harrosh <bharrosh@panasas.com>,
299 James Bottomley <James.Bottomley@suse.de>,
300 Greg Kroah-Hartman <gregkh@suse.de>
301 Subject: [03/34] SCSI: osd_protocol.h: Add missing #include
302 References: <20091211052312.805428372@linux.site>
303 Content-Disposition: inline; filename=scsi-osd_protocol.h-add-missing-include.patch
304 Content-Length: 708
305 Lines: 24
306
307 2.6.32-stable review patch. If anyone has any objections, please let us know.
308
309 ------------------
310
311 From: Martin Michlmayr <tbm@cyrius.com>
312
313 commit 0899638688f223fd9e9fee60d662665e11693d12 upstream.
314
315 include/scsi/osd_protocol.h uses ALIGN() without an #include
316 <linux/kernel.h>, leading to:
317 | include/scsi/osd_protocol.h:362: error: implicit declaration of function 'ALIGN'
318
319 Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
320 Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
321 Signed-off-by: James Bottomley <James.Bottomley@suse.de>
322 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
323
324 --- a/include/scsi/osd_protocol.h
325 +++ b/include/scsi/osd_protocol.h
326 @@ -17,6 +17,7 @@
327 #define __OSD_PROTOCOL_H__
328
329 #include <linux/types.h>
330 +#include <linux/kernel.h>
331 #include <asm/unaligned.h>
332 #include <scsi/scsi.h>
333
334
335
336 From linux@linux.site Thu Dec 10 21:25:42 2009
337 Message-Id: <20091211052542.045664905@linux.site>
338 User-Agent: quilt/0.47-14.9
339 Date: Thu, 10 Dec 2009 21:23:16 -0800
340 From: Greg KH <gregkh@suse.de>
341 To: linux-kernel@vger.kernel.org,
342 stable@kernel.org
343 Cc: stable-review@kernel.org,
344 torvalds@linux-foundation.org,
345 akpm@linux-foundation.org,
346 alan@lxorguk.ukuu.org.uk,
347 James Bottomley <James.Bottomley@suse.de>,
348 Greg Kroah-Hartman <gregkh@suse.de>
349 Subject: [04/34] SCSI: megaraid_sas: fix 64 bit sense pointer truncation
350 References: <20091211052312.805428372@linux.site>
351 Content-Disposition: inline; filename=scsi-megaraid_sas-fix-64-bit-sense-pointer-truncation.patch
352 Content-Length: 1456
353 Lines: 47
354
355 2.6.32-stable review patch. If anyone has any objections, please let us know.
356
357 ------------------
358
359 From: Yang, Bo <Bo.Yang@lsi.com>
360
361 commit 7b2519afa1abd1b9f63aa1e90879307842422dae upstream.
362
363 The current sense pointer is cast to a u32 pointer, which can truncate
364 on 64 bits. Fix by using unsigned long instead.
365
366 Signed-off-by Bo Yang<bo.yang@lsi.com>
367 Signed-off-by: James Bottomley <James.Bottomley@suse.de>
368 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
369
370 ---
371 drivers/scsi/megaraid/megaraid_sas.c | 8 ++++----
372 1 file changed, 4 insertions(+), 4 deletions(-)
373
374 --- a/drivers/scsi/megaraid/megaraid_sas.c
375 +++ b/drivers/scsi/megaraid/megaraid_sas.c
376 @@ -3032,7 +3032,7 @@ megasas_mgmt_fw_ioctl(struct megasas_ins
377 int error = 0, i;
378 void *sense = NULL;
379 dma_addr_t sense_handle;
380 - u32 *sense_ptr;
381 + unsigned long *sense_ptr;
382
383 memset(kbuff_arr, 0, sizeof(kbuff_arr));
384
385 @@ -3109,7 +3109,7 @@ megasas_mgmt_fw_ioctl(struct megasas_ins
386 }
387
388 sense_ptr =
389 - (u32 *) ((unsigned long)cmd->frame + ioc->sense_off);
390 + (unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off);
391 *sense_ptr = sense_handle;
392 }
393
394 @@ -3140,8 +3140,8 @@ megasas_mgmt_fw_ioctl(struct megasas_ins
395 * sense_ptr points to the location that has the user
396 * sense buffer address
397 */
398 - sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw +
399 - ioc->sense_off);
400 + sense_ptr = (unsigned long *) ((unsigned long)ioc->frame.raw +
401 + ioc->sense_off);
402
403 if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
404 sense, ioc->sense_len)) {
405
406
407 From linux@linux.site Thu Dec 10 21:25:43 2009
408 Message-Id: <20091211052542.664737460@linux.site>
409 User-Agent: quilt/0.47-14.9
410 Date: Thu, 10 Dec 2009 21:23:17 -0800
411 From: Greg KH <gregkh@suse.de>
412 To: linux-kernel@vger.kernel.org,
413 stable@kernel.org
414 Cc: stable-review@kernel.org,
415 torvalds@linux-foundation.org,
416 akpm@linux-foundation.org,
417 alan@lxorguk.ukuu.org.uk,
418 "Theodore Tso" <tytso@mit.edu>,
419 Curt Wohlgemuth <curtw@google.com>,
420 Greg Kroah-Hartman <gregkh@suse.de>
421 Subject: [05/34] ext4: fix potential buffer head leak when add_dirent_to_buf() returns ENOSPC
422 References: <20091211052312.805428372@linux.site>
423 Content-Disposition: inline; filename=0001-ext4-fix-potential-buffer-head-leak-when-add_dirent_.patch
424 Content-Length: 3833
425 Lines: 118
426
427 2.6.32-stable review patch. If anyone has any objections, please let us know.
428
429 ------------------
430
431 (cherry picked from commit 2de770a406b06dfc619faabbf5d85c835ed3f2e1)
432
433 Previously add_dirent_to_buf() did not free its passed-in buffer head
434 in the case of ENOSPC, since in some cases the caller still needed it.
435 However, this led to potential buffer head leaks since not all callers
436 dealt with this correctly. Fix this by making simplifying the freeing
437 convention; now add_dirent_to_buf() *never* frees the passed-in buffer
438 head, and leaves that to the responsibility of its caller. This makes
439 things cleaner and easier to prove that the code is neither leaking
440 buffer heads or calling brelse() one time too many.
441
442 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
443 Cc: Curt Wohlgemuth <curtw@google.com>
444 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
445 ---
446 fs/ext4/namei.c | 30 ++++++++++++------------------
447 1 file changed, 12 insertions(+), 18 deletions(-)
448
449 --- a/fs/ext4/namei.c
450 +++ b/fs/ext4/namei.c
451 @@ -1292,9 +1292,6 @@ errout:
452 * add_dirent_to_buf will attempt search the directory block for
453 * space. It will return -ENOSPC if no space is available, and -EIO
454 * and -EEXIST if directory entry already exists.
455 - *
456 - * NOTE! bh is NOT released in the case where ENOSPC is returned. In
457 - * all other cases bh is released.
458 */
459 static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
460 struct inode *inode, struct ext4_dir_entry_2 *de,
461 @@ -1315,14 +1312,10 @@ static int add_dirent_to_buf(handle_t *h
462 top = bh->b_data + blocksize - reclen;
463 while ((char *) de <= top) {
464 if (!ext4_check_dir_entry("ext4_add_entry", dir, de,
465 - bh, offset)) {
466 - brelse(bh);
467 + bh, offset))
468 return -EIO;
469 - }
470 - if (ext4_match(namelen, name, de)) {
471 - brelse(bh);
472 + if (ext4_match(namelen, name, de))
473 return -EEXIST;
474 - }
475 nlen = EXT4_DIR_REC_LEN(de->name_len);
476 rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
477 if ((de->inode? rlen - nlen: rlen) >= reclen)
478 @@ -1337,7 +1330,6 @@ static int add_dirent_to_buf(handle_t *h
479 err = ext4_journal_get_write_access(handle, bh);
480 if (err) {
481 ext4_std_error(dir->i_sb, err);
482 - brelse(bh);
483 return err;
484 }
485
486 @@ -1377,7 +1369,6 @@ static int add_dirent_to_buf(handle_t *h
487 err = ext4_handle_dirty_metadata(handle, dir, bh);
488 if (err)
489 ext4_std_error(dir->i_sb, err);
490 - brelse(bh);
491 return 0;
492 }
493
494 @@ -1471,7 +1462,9 @@ static int make_indexed_dir(handle_t *ha
495 if (!(de))
496 return retval;
497
498 - return add_dirent_to_buf(handle, dentry, inode, de, bh);
499 + retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
500 + brelse(bh);
501 + return retval;
502 }
503
504 /*
505 @@ -1514,8 +1507,10 @@ static int ext4_add_entry(handle_t *hand
506 if(!bh)
507 return retval;
508 retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
509 - if (retval != -ENOSPC)
510 + if (retval != -ENOSPC) {
511 + brelse(bh);
512 return retval;
513 + }
514
515 if (blocks == 1 && !dx_fallback &&
516 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
517 @@ -1528,7 +1523,9 @@ static int ext4_add_entry(handle_t *hand
518 de = (struct ext4_dir_entry_2 *) bh->b_data;
519 de->inode = 0;
520 de->rec_len = ext4_rec_len_to_disk(blocksize, blocksize);
521 - return add_dirent_to_buf(handle, dentry, inode, de, bh);
522 + retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
523 + brelse(bh);
524 + return retval;
525 }
526
527 /*
528 @@ -1561,10 +1558,8 @@ static int ext4_dx_add_entry(handle_t *h
529 goto journal_error;
530
531 err = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
532 - if (err != -ENOSPC) {
533 - bh = NULL;
534 + if (err != -ENOSPC)
535 goto cleanup;
536 - }
537
538 /* Block full, should compress but for now just split */
539 dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
540 @@ -1657,7 +1652,6 @@ static int ext4_dx_add_entry(handle_t *h
541 if (!de)
542 goto cleanup;
543 err = add_dirent_to_buf(handle, dentry, inode, de, bh);
544 - bh = NULL;
545 goto cleanup;
546
547 journal_error:
548
549
550 From linux@linux.site Thu Dec 10 21:25:43 2009
551 Message-Id: <20091211052543.277851362@linux.site>
552 User-Agent: quilt/0.47-14.9
553 Date: Thu, 10 Dec 2009 21:23:18 -0800
554 From: Greg KH <gregkh@suse.de>
555 To: linux-kernel@vger.kernel.org,
556 stable@kernel.org
557 Cc: stable-review@kernel.org,
558 torvalds@linux-foundation.org,
559 akpm@linux-foundation.org,
560 alan@lxorguk.ukuu.org.uk,
561 "Theodore Tso" <tytso@mit.edu>,
562 Greg Kroah-Hartman <gregkh@suse.de>
563 Subject: [06/34] ext4: avoid divide by zero when trying to mount a corrupted file system
564 References: <20091211052312.805428372@linux.site>
565 Content-Disposition: inline; filename=0002-ext4-avoid-divide-by-zero-when-trying-to-mount-a-cor.patch
566 Content-Length: 1267
567 Lines: 39
568
569 2.6.32-stable review patch. If anyone has any objections, please let us know.
570
571 ------------------
572
573 (cherry picked from commit 503358ae01b70ce6909d19dd01287093f6b6271c)
574
575 If s_log_groups_per_flex is greater than 31, then groups_per_flex will
576 will overflow and cause a divide by zero error. This can cause kernel
577 BUG if such a file system is mounted.
578
579 Thanks to Nageswara R Sastry for analyzing the failure and providing
580 an initial patch.
581
582 http://bugzilla.kernel.org/show_bug.cgi?id=14287
583
584 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
585 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
586 ---
587 fs/ext4/super.c | 8 ++++----
588 1 file changed, 4 insertions(+), 4 deletions(-)
589
590 --- a/fs/ext4/super.c
591 +++ b/fs/ext4/super.c
592 @@ -1673,14 +1673,14 @@ static int ext4_fill_flex_info(struct su
593 size_t size;
594 int i;
595
596 - if (!sbi->s_es->s_log_groups_per_flex) {
597 + sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
598 + groups_per_flex = 1 << sbi->s_log_groups_per_flex;
599 +
600 + if (groups_per_flex < 2) {
601 sbi->s_log_groups_per_flex = 0;
602 return 1;
603 }
604
605 - sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
606 - groups_per_flex = 1 << sbi->s_log_groups_per_flex;
607 -
608 /* We allocate both existing and potentially added groups */
609 flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
610 ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
611
612
613 From linux@linux.site Thu Dec 10 21:25:44 2009
614 Message-Id: <20091211052543.772152436@linux.site>
615 User-Agent: quilt/0.47-14.9
616 Date: Thu, 10 Dec 2009 21:23:19 -0800
617 From: Greg KH <gregkh@suse.de>
618 To: linux-kernel@vger.kernel.org,
619 stable@kernel.org
620 Cc: stable-review@kernel.org,
621 torvalds@linux-foundation.org,
622 akpm@linux-foundation.org,
623 alan@lxorguk.ukuu.org.uk,
624 Akira Fujita <a-fujita@rs.jp.nec.com>,
625 "Theodore Tso" <tytso@mit.edu>,
626 Greg Kroah-Hartman <gregkh@suse.de>
627 Subject: [07/34] ext4: fix the returned block count if EXT4_IOC_MOVE_EXT fails
628 References: <20091211052312.805428372@linux.site>
629 Content-Disposition: inline; filename=0003-ext4-fix-the-returned-block-count-if-EXT4_IOC_MOVE_E.patch
630 Content-Length: 10970
631 Lines: 349
632
633 2.6.32-stable review patch. If anyone has any objections, please let us know.
634
635 ------------------
636
637 (cherry picked from commit f868a48d06f8886cb0367568a12367fa4f21ea0d)
638
639 If the EXT4_IOC_MOVE_EXT ioctl fails, the number of blocks that were
640 exchanged before the failure should be returned to the userspace
641 caller. Unfortunately, currently if the block size is not the same as
642 the page size, the returned block count that is returned is the
643 page-aligned block count instead of the actual block count. This
644 commit addresses this bug.
645
646 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
647 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
648 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
649 ---
650 fs/ext4/move_extent.c | 139 ++++++++++++++++++++++++++------------------------
651 1 file changed, 73 insertions(+), 66 deletions(-)
652
653 --- a/fs/ext4/move_extent.c
654 +++ b/fs/ext4/move_extent.c
655 @@ -661,6 +661,7 @@ mext_calc_swap_extents(struct ext4_exten
656 * @donor_inode: donor inode
657 * @from: block offset of orig_inode
658 * @count: block count to be replaced
659 + * @err: pointer to save return value
660 *
661 * Replace original inode extents and donor inode extents page by page.
662 * We implement this replacement in the following three steps:
663 @@ -671,19 +672,18 @@ mext_calc_swap_extents(struct ext4_exten
664 * 3. Change the block information of donor inode to point at the saved
665 * original inode blocks in the dummy extents.
666 *
667 - * Return 0 on success, or a negative error value on failure.
668 + * Return replaced block count.
669 */
670 static int
671 mext_replace_branches(handle_t *handle, struct inode *orig_inode,
672 struct inode *donor_inode, ext4_lblk_t from,
673 - ext4_lblk_t count)
674 + ext4_lblk_t count, int *err)
675 {
676 struct ext4_ext_path *orig_path = NULL;
677 struct ext4_ext_path *donor_path = NULL;
678 struct ext4_extent *oext, *dext;
679 struct ext4_extent tmp_dext, tmp_oext;
680 ext4_lblk_t orig_off = from, donor_off = from;
681 - int err = 0;
682 int depth;
683 int replaced_count = 0;
684 int dext_alen;
685 @@ -691,13 +691,13 @@ mext_replace_branches(handle_t *handle,
686 mext_double_down_write(orig_inode, donor_inode);
687
688 /* Get the original extent for the block "orig_off" */
689 - err = get_ext_path(orig_inode, orig_off, &orig_path);
690 - if (err)
691 + *err = get_ext_path(orig_inode, orig_off, &orig_path);
692 + if (*err)
693 goto out;
694
695 /* Get the donor extent for the head */
696 - err = get_ext_path(donor_inode, donor_off, &donor_path);
697 - if (err)
698 + *err = get_ext_path(donor_inode, donor_off, &donor_path);
699 + if (*err)
700 goto out;
701 depth = ext_depth(orig_inode);
702 oext = orig_path[depth].p_ext;
703 @@ -707,9 +707,9 @@ mext_replace_branches(handle_t *handle,
704 dext = donor_path[depth].p_ext;
705 tmp_dext = *dext;
706
707 - err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
708 + *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
709 donor_off, count);
710 - if (err)
711 + if (*err)
712 goto out;
713
714 /* Loop for the donor extents */
715 @@ -718,7 +718,7 @@ mext_replace_branches(handle_t *handle,
716 if (!dext) {
717 ext4_error(donor_inode->i_sb, __func__,
718 "The extent for donor must be found");
719 - err = -EIO;
720 + *err = -EIO;
721 goto out;
722 } else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) {
723 ext4_error(donor_inode->i_sb, __func__,
724 @@ -726,20 +726,20 @@ mext_replace_branches(handle_t *handle,
725 "extent(%u) should be equal",
726 donor_off,
727 le32_to_cpu(tmp_dext.ee_block));
728 - err = -EIO;
729 + *err = -EIO;
730 goto out;
731 }
732
733 /* Set donor extent to orig extent */
734 - err = mext_leaf_block(handle, orig_inode,
735 + *err = mext_leaf_block(handle, orig_inode,
736 orig_path, &tmp_dext, &orig_off);
737 - if (err < 0)
738 + if (*err)
739 goto out;
740
741 /* Set orig extent to donor extent */
742 - err = mext_leaf_block(handle, donor_inode,
743 + *err = mext_leaf_block(handle, donor_inode,
744 donor_path, &tmp_oext, &donor_off);
745 - if (err < 0)
746 + if (*err)
747 goto out;
748
749 dext_alen = ext4_ext_get_actual_len(&tmp_dext);
750 @@ -753,35 +753,25 @@ mext_replace_branches(handle_t *handle,
751
752 if (orig_path)
753 ext4_ext_drop_refs(orig_path);
754 - err = get_ext_path(orig_inode, orig_off, &orig_path);
755 - if (err)
756 + *err = get_ext_path(orig_inode, orig_off, &orig_path);
757 + if (*err)
758 goto out;
759 depth = ext_depth(orig_inode);
760 oext = orig_path[depth].p_ext;
761 - if (le32_to_cpu(oext->ee_block) +
762 - ext4_ext_get_actual_len(oext) <= orig_off) {
763 - err = 0;
764 - goto out;
765 - }
766 tmp_oext = *oext;
767
768 if (donor_path)
769 ext4_ext_drop_refs(donor_path);
770 - err = get_ext_path(donor_inode, donor_off, &donor_path);
771 - if (err)
772 + *err = get_ext_path(donor_inode, donor_off, &donor_path);
773 + if (*err)
774 goto out;
775 depth = ext_depth(donor_inode);
776 dext = donor_path[depth].p_ext;
777 - if (le32_to_cpu(dext->ee_block) +
778 - ext4_ext_get_actual_len(dext) <= donor_off) {
779 - err = 0;
780 - goto out;
781 - }
782 tmp_dext = *dext;
783
784 - err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
785 + *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
786 donor_off, count - replaced_count);
787 - if (err)
788 + if (*err)
789 goto out;
790 }
791
792 @@ -796,7 +786,7 @@ out:
793 }
794
795 mext_double_up_write(orig_inode, donor_inode);
796 - return err;
797 + return replaced_count;
798 }
799
800 /**
801 @@ -808,16 +798,17 @@ out:
802 * @data_offset_in_page: block index where data swapping starts
803 * @block_len_in_page: the number of blocks to be swapped
804 * @uninit: orig extent is uninitialized or not
805 + * @err: pointer to save return value
806 *
807 * Save the data in original inode blocks and replace original inode extents
808 * with donor inode extents by calling mext_replace_branches().
809 - * Finally, write out the saved data in new original inode blocks. Return 0
810 - * on success, or a negative error value on failure.
811 + * Finally, write out the saved data in new original inode blocks. Return
812 + * replaced block count.
813 */
814 static int
815 move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
816 pgoff_t orig_page_offset, int data_offset_in_page,
817 - int block_len_in_page, int uninit)
818 + int block_len_in_page, int uninit, int *err)
819 {
820 struct inode *orig_inode = o_filp->f_dentry->d_inode;
821 struct address_space *mapping = orig_inode->i_mapping;
822 @@ -829,9 +820,11 @@ move_extent_per_page(struct file *o_filp
823 long long offs = orig_page_offset << PAGE_CACHE_SHIFT;
824 unsigned long blocksize = orig_inode->i_sb->s_blocksize;
825 unsigned int w_flags = 0;
826 - unsigned int tmp_data_len, data_len;
827 + unsigned int tmp_data_size, data_size, replaced_size;
828 void *fsdata;
829 - int ret, i, jblocks;
830 + int i, jblocks;
831 + int err2 = 0;
832 + int replaced_count = 0;
833 int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
834
835 /*
836 @@ -841,8 +834,8 @@ move_extent_per_page(struct file *o_filp
837 jblocks = ext4_writepage_trans_blocks(orig_inode) * 2;
838 handle = ext4_journal_start(orig_inode, jblocks);
839 if (IS_ERR(handle)) {
840 - ret = PTR_ERR(handle);
841 - return ret;
842 + *err = PTR_ERR(handle);
843 + return 0;
844 }
845
846 if (segment_eq(get_fs(), KERNEL_DS))
847 @@ -858,9 +851,9 @@ move_extent_per_page(struct file *o_filp
848 * Just swap data blocks between orig and donor.
849 */
850 if (uninit) {
851 - ret = mext_replace_branches(handle, orig_inode,
852 - donor_inode, orig_blk_offset,
853 - block_len_in_page);
854 + replaced_count = mext_replace_branches(handle, orig_inode,
855 + donor_inode, orig_blk_offset,
856 + block_len_in_page, err);
857
858 /* Clear the inode cache not to refer to the old data */
859 ext4_ext_invalidate_cache(orig_inode);
860 @@ -870,27 +863,28 @@ move_extent_per_page(struct file *o_filp
861
862 offs = (long long)orig_blk_offset << orig_inode->i_blkbits;
863
864 - /* Calculate data_len */
865 + /* Calculate data_size */
866 if ((orig_blk_offset + block_len_in_page - 1) ==
867 ((orig_inode->i_size - 1) >> orig_inode->i_blkbits)) {
868 /* Replace the last block */
869 - tmp_data_len = orig_inode->i_size & (blocksize - 1);
870 + tmp_data_size = orig_inode->i_size & (blocksize - 1);
871 /*
872 - * If data_len equal zero, it shows data_len is multiples of
873 + * If data_size equal zero, it shows data_size is multiples of
874 * blocksize. So we set appropriate value.
875 */
876 - if (tmp_data_len == 0)
877 - tmp_data_len = blocksize;
878 + if (tmp_data_size == 0)
879 + tmp_data_size = blocksize;
880
881 - data_len = tmp_data_len +
882 + data_size = tmp_data_size +
883 ((block_len_in_page - 1) << orig_inode->i_blkbits);
884 - } else {
885 - data_len = block_len_in_page << orig_inode->i_blkbits;
886 - }
887 + } else
888 + data_size = block_len_in_page << orig_inode->i_blkbits;
889 +
890 + replaced_size = data_size;
891
892 - ret = a_ops->write_begin(o_filp, mapping, offs, data_len, w_flags,
893 + *err = a_ops->write_begin(o_filp, mapping, offs, data_size, w_flags,
894 &page, &fsdata);
895 - if (unlikely(ret < 0))
896 + if (unlikely(*err < 0))
897 goto out;
898
899 if (!PageUptodate(page)) {
900 @@ -911,10 +905,17 @@ move_extent_per_page(struct file *o_filp
901 /* Release old bh and drop refs */
902 try_to_release_page(page, 0);
903
904 - ret = mext_replace_branches(handle, orig_inode, donor_inode,
905 - orig_blk_offset, block_len_in_page);
906 - if (ret < 0)
907 - goto out;
908 + replaced_count = mext_replace_branches(handle, orig_inode, donor_inode,
909 + orig_blk_offset, block_len_in_page,
910 + &err2);
911 + if (err2) {
912 + if (replaced_count) {
913 + block_len_in_page = replaced_count;
914 + replaced_size =
915 + block_len_in_page << orig_inode->i_blkbits;
916 + } else
917 + goto out;
918 + }
919
920 /* Clear the inode cache not to refer to the old data */
921 ext4_ext_invalidate_cache(orig_inode);
922 @@ -928,16 +929,16 @@ move_extent_per_page(struct file *o_filp
923 bh = bh->b_this_page;
924
925 for (i = 0; i < block_len_in_page; i++) {
926 - ret = ext4_get_block(orig_inode,
927 + *err = ext4_get_block(orig_inode,
928 (sector_t)(orig_blk_offset + i), bh, 0);
929 - if (ret < 0)
930 + if (*err < 0)
931 goto out;
932
933 if (bh->b_this_page != NULL)
934 bh = bh->b_this_page;
935 }
936
937 - ret = a_ops->write_end(o_filp, mapping, offs, data_len, data_len,
938 + *err = a_ops->write_end(o_filp, mapping, offs, data_size, replaced_size,
939 page, fsdata);
940 page = NULL;
941
942 @@ -951,7 +952,10 @@ out:
943 out2:
944 ext4_journal_stop(handle);
945
946 - return ret < 0 ? ret : 0;
947 + if (err2)
948 + *err = err2;
949 +
950 + return replaced_count;
951 }
952
953 /**
954 @@ -1367,15 +1371,17 @@ ext4_move_extents(struct file *o_filp, s
955 while (orig_page_offset <= seq_end_page) {
956
957 /* Swap original branches with new branches */
958 - ret1 = move_extent_per_page(o_filp, donor_inode,
959 + block_len_in_page = move_extent_per_page(
960 + o_filp, donor_inode,
961 orig_page_offset,
962 data_offset_in_page,
963 - block_len_in_page, uninit);
964 - if (ret1 < 0)
965 - goto out;
966 - orig_page_offset++;
967 + block_len_in_page, uninit,
968 + &ret1);
969 +
970 /* Count how many blocks we have exchanged */
971 *moved_len += block_len_in_page;
972 + if (ret1 < 0)
973 + goto out;
974 if (*moved_len > len) {
975 ext4_error(orig_inode->i_sb, __func__,
976 "We replaced blocks too much! "
977 @@ -1385,6 +1391,7 @@ ext4_move_extents(struct file *o_filp, s
978 goto out;
979 }
980
981 + orig_page_offset++;
982 data_offset_in_page = 0;
983 rest_blocks -= block_len_in_page;
984 if (rest_blocks > blocks_per_page)
985
986
987 From linux@linux.site Thu Dec 10 21:25:44 2009
988 Message-Id: <20091211052544.287395070@linux.site>
989 User-Agent: quilt/0.47-14.9
990 Date: Thu, 10 Dec 2009 21:23:20 -0800
991 From: Greg KH <gregkh@suse.de>
992 To: linux-kernel@vger.kernel.org,
993 stable@kernel.org
994 Cc: stable-review@kernel.org,
995 torvalds@linux-foundation.org,
996 akpm@linux-foundation.org,
997 alan@lxorguk.ukuu.org.uk,
998 Akira Fujita <a-fujita@rs.jp.nec.com>,
999 "Theodore Tso" <tytso@mit.edu>,
1000 Greg Kroah-Hartman <gregkh@suse.de>
1001 Subject: [08/34] ext4: fix lock order problem in ext4_move_extents()
1002 References: <20091211052312.805428372@linux.site>
1003 Content-Disposition: inline; filename=0004-ext4-fix-lock-order-problem-in-ext4_move_extents.patch
1004 Content-Length: 10372
1005 Lines: 310
1006
1007 2.6.32-stable review patch. If anyone has any objections, please let us know.
1008
1009 ------------------
1010
1011 (cherry picked from commit fc04cb49a898c372a22b21fffc47f299d8710801)
1012
1013 ext4_move_extents() checks the logical block contiguousness
1014 of original file with ext4_find_extent() and mext_next_extent().
1015 Therefore the extent which ext4_ext_path structure indicates
1016 must not be changed between above functions.
1017
1018 But in current implementation, there is no i_data_sem protection
1019 between ext4_ext_find_extent() and mext_next_extent(). So the extent
1020 which ext4_ext_path structure indicates may be overwritten by
1021 delalloc. As a result, ext4_move_extents() will exchange wrong blocks
1022 between original and donor files. I change the place where
1023 acquire/release i_data_sem to solve this problem.
1024
1025 Moreover, I changed move_extent_per_page() to start transaction first,
1026 and then acquire i_data_sem. Without this change, there is a
1027 possibility of the deadlock between mmap() and ext4_move_extents():
1028
1029 * NOTE: "A", "B" and "C" mean different processes
1030
1031 A-1: ext4_ext_move_extents() acquires i_data_sem of two inodes.
1032
1033 B: do_page_fault() starts the transaction (T),
1034 and then tries to acquire i_data_sem.
1035 But process "A" is already holding it, so it is kept waiting.
1036
1037 C: While "A" and "B" running, kjournald2 tries to commit transaction (T)
1038 but it is under updating, so kjournald2 waits for it.
1039
1040 A-2: Call ext4_journal_start with holding i_data_sem,
1041 but transaction (T) is locked.
1042
1043 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
1044 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1045 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1046 ---
1047 fs/ext4/move_extent.c | 117 ++++++++++++++++++++++----------------------------
1048 1 file changed, 53 insertions(+), 64 deletions(-)
1049
1050 --- a/fs/ext4/move_extent.c
1051 +++ b/fs/ext4/move_extent.c
1052 @@ -77,12 +77,14 @@ static int
1053 mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
1054 struct ext4_extent **extent)
1055 {
1056 + struct ext4_extent_header *eh;
1057 int ppos, leaf_ppos = path->p_depth;
1058
1059 ppos = leaf_ppos;
1060 if (EXT_LAST_EXTENT(path[ppos].p_hdr) > path[ppos].p_ext) {
1061 /* leaf block */
1062 *extent = ++path[ppos].p_ext;
1063 + path[ppos].p_block = ext_pblock(path[ppos].p_ext);
1064 return 0;
1065 }
1066
1067 @@ -119,9 +121,18 @@ mext_next_extent(struct inode *inode, st
1068 ext_block_hdr(path[cur_ppos+1].p_bh);
1069 }
1070
1071 + path[leaf_ppos].p_ext = *extent = NULL;
1072 +
1073 + eh = path[leaf_ppos].p_hdr;
1074 + if (le16_to_cpu(eh->eh_entries) == 0)
1075 + /* empty leaf is found */
1076 + return -ENODATA;
1077 +
1078 /* leaf block */
1079 path[leaf_ppos].p_ext = *extent =
1080 EXT_FIRST_EXTENT(path[leaf_ppos].p_hdr);
1081 + path[leaf_ppos].p_block =
1082 + ext_pblock(path[leaf_ppos].p_ext);
1083 return 0;
1084 }
1085 }
1086 @@ -155,40 +166,15 @@ mext_check_null_inode(struct inode *inod
1087 }
1088
1089 /**
1090 - * mext_double_down_read - Acquire two inodes' read semaphore
1091 - *
1092 - * @orig_inode: original inode structure
1093 - * @donor_inode: donor inode structure
1094 - * Acquire read semaphore of the two inodes (orig and donor) by i_ino order.
1095 - */
1096 -static void
1097 -mext_double_down_read(struct inode *orig_inode, struct inode *donor_inode)
1098 -{
1099 - struct inode *first = orig_inode, *second = donor_inode;
1100 -
1101 - /*
1102 - * Use the inode number to provide the stable locking order instead
1103 - * of its address, because the C language doesn't guarantee you can
1104 - * compare pointers that don't come from the same array.
1105 - */
1106 - if (donor_inode->i_ino < orig_inode->i_ino) {
1107 - first = donor_inode;
1108 - second = orig_inode;
1109 - }
1110 -
1111 - down_read(&EXT4_I(first)->i_data_sem);
1112 - down_read(&EXT4_I(second)->i_data_sem);
1113 -}
1114 -
1115 -/**
1116 - * mext_double_down_write - Acquire two inodes' write semaphore
1117 + * double_down_write_data_sem - Acquire two inodes' write lock of i_data_sem
1118 *
1119 * @orig_inode: original inode structure
1120 * @donor_inode: donor inode structure
1121 - * Acquire write semaphore of the two inodes (orig and donor) by i_ino order.
1122 + * Acquire write lock of i_data_sem of the two inodes (orig and donor) by
1123 + * i_ino order.
1124 */
1125 static void
1126 -mext_double_down_write(struct inode *orig_inode, struct inode *donor_inode)
1127 +double_down_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
1128 {
1129 struct inode *first = orig_inode, *second = donor_inode;
1130
1131 @@ -207,28 +193,14 @@ mext_double_down_write(struct inode *ori
1132 }
1133
1134 /**
1135 - * mext_double_up_read - Release two inodes' read semaphore
1136 + * double_up_write_data_sem - Release two inodes' write lock of i_data_sem
1137 *
1138 * @orig_inode: original inode structure to be released its lock first
1139 * @donor_inode: donor inode structure to be released its lock second
1140 - * Release read semaphore of two inodes (orig and donor).
1141 + * Release write lock of i_data_sem of two inodes (orig and donor).
1142 */
1143 static void
1144 -mext_double_up_read(struct inode *orig_inode, struct inode *donor_inode)
1145 -{
1146 - up_read(&EXT4_I(orig_inode)->i_data_sem);
1147 - up_read(&EXT4_I(donor_inode)->i_data_sem);
1148 -}
1149 -
1150 -/**
1151 - * mext_double_up_write - Release two inodes' write semaphore
1152 - *
1153 - * @orig_inode: original inode structure to be released its lock first
1154 - * @donor_inode: donor inode structure to be released its lock second
1155 - * Release write semaphore of two inodes (orig and donor).
1156 - */
1157 -static void
1158 -mext_double_up_write(struct inode *orig_inode, struct inode *donor_inode)
1159 +double_up_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
1160 {
1161 up_write(&EXT4_I(orig_inode)->i_data_sem);
1162 up_write(&EXT4_I(donor_inode)->i_data_sem);
1163 @@ -688,8 +660,6 @@ mext_replace_branches(handle_t *handle,
1164 int replaced_count = 0;
1165 int dext_alen;
1166
1167 - mext_double_down_write(orig_inode, donor_inode);
1168 -
1169 /* Get the original extent for the block "orig_off" */
1170 *err = get_ext_path(orig_inode, orig_off, &orig_path);
1171 if (*err)
1172 @@ -785,7 +755,6 @@ out:
1173 kfree(donor_path);
1174 }
1175
1176 - mext_double_up_write(orig_inode, donor_inode);
1177 return replaced_count;
1178 }
1179
1180 @@ -851,6 +820,11 @@ move_extent_per_page(struct file *o_filp
1181 * Just swap data blocks between orig and donor.
1182 */
1183 if (uninit) {
1184 + /*
1185 + * Protect extent trees against block allocations
1186 + * via delalloc
1187 + */
1188 + double_down_write_data_sem(orig_inode, donor_inode);
1189 replaced_count = mext_replace_branches(handle, orig_inode,
1190 donor_inode, orig_blk_offset,
1191 block_len_in_page, err);
1192 @@ -858,6 +832,7 @@ move_extent_per_page(struct file *o_filp
1193 /* Clear the inode cache not to refer to the old data */
1194 ext4_ext_invalidate_cache(orig_inode);
1195 ext4_ext_invalidate_cache(donor_inode);
1196 + double_up_write_data_sem(orig_inode, donor_inode);
1197 goto out2;
1198 }
1199
1200 @@ -905,6 +880,8 @@ move_extent_per_page(struct file *o_filp
1201 /* Release old bh and drop refs */
1202 try_to_release_page(page, 0);
1203
1204 + /* Protect extent trees against block allocations via delalloc */
1205 + double_down_write_data_sem(orig_inode, donor_inode);
1206 replaced_count = mext_replace_branches(handle, orig_inode, donor_inode,
1207 orig_blk_offset, block_len_in_page,
1208 &err2);
1209 @@ -913,14 +890,18 @@ move_extent_per_page(struct file *o_filp
1210 block_len_in_page = replaced_count;
1211 replaced_size =
1212 block_len_in_page << orig_inode->i_blkbits;
1213 - } else
1214 + } else {
1215 + double_up_write_data_sem(orig_inode, donor_inode);
1216 goto out;
1217 + }
1218 }
1219
1220 /* Clear the inode cache not to refer to the old data */
1221 ext4_ext_invalidate_cache(orig_inode);
1222 ext4_ext_invalidate_cache(donor_inode);
1223
1224 + double_up_write_data_sem(orig_inode, donor_inode);
1225 +
1226 if (!page_has_buffers(page))
1227 create_empty_buffers(page, 1 << orig_inode->i_blkbits, 0);
1228
1229 @@ -1236,16 +1217,16 @@ ext4_move_extents(struct file *o_filp, s
1230 return -EINVAL;
1231 }
1232
1233 - /* protect orig and donor against a truncate */
1234 + /* Protect orig and donor inodes against a truncate */
1235 ret1 = mext_inode_double_lock(orig_inode, donor_inode);
1236 if (ret1 < 0)
1237 return ret1;
1238
1239 - mext_double_down_read(orig_inode, donor_inode);
1240 + /* Protect extent tree against block allocations via delalloc */
1241 + double_down_write_data_sem(orig_inode, donor_inode);
1242 /* Check the filesystem environment whether move_extent can be done */
1243 ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start,
1244 donor_start, &len, *moved_len);
1245 - mext_double_up_read(orig_inode, donor_inode);
1246 if (ret1)
1247 goto out;
1248
1249 @@ -1308,6 +1289,10 @@ ext4_move_extents(struct file *o_filp, s
1250 ext4_ext_get_actual_len(ext_cur), block_end + 1) -
1251 max(le32_to_cpu(ext_cur->ee_block), block_start);
1252
1253 + /* Discard preallocations of two inodes */
1254 + ext4_discard_preallocations(orig_inode);
1255 + ext4_discard_preallocations(donor_inode);
1256 +
1257 while (!last_extent && le32_to_cpu(ext_cur->ee_block) <= block_end) {
1258 seq_blocks += add_blocks;
1259
1260 @@ -1359,14 +1344,14 @@ ext4_move_extents(struct file *o_filp, s
1261 seq_start = le32_to_cpu(ext_cur->ee_block);
1262 rest_blocks = seq_blocks;
1263
1264 - /* Discard preallocations of two inodes */
1265 - down_write(&EXT4_I(orig_inode)->i_data_sem);
1266 - ext4_discard_preallocations(orig_inode);
1267 - up_write(&EXT4_I(orig_inode)->i_data_sem);
1268 -
1269 - down_write(&EXT4_I(donor_inode)->i_data_sem);
1270 - ext4_discard_preallocations(donor_inode);
1271 - up_write(&EXT4_I(donor_inode)->i_data_sem);
1272 + /*
1273 + * Up semaphore to avoid following problems:
1274 + * a. transaction deadlock among ext4_journal_start,
1275 + * ->write_begin via pagefault, and jbd2_journal_commit
1276 + * b. racing with ->readpage, ->write_begin, and ext4_get_block
1277 + * in move_extent_per_page
1278 + */
1279 + double_up_write_data_sem(orig_inode, donor_inode);
1280
1281 while (orig_page_offset <= seq_end_page) {
1282
1283 @@ -1381,14 +1366,14 @@ ext4_move_extents(struct file *o_filp, s
1284 /* Count how many blocks we have exchanged */
1285 *moved_len += block_len_in_page;
1286 if (ret1 < 0)
1287 - goto out;
1288 + break;
1289 if (*moved_len > len) {
1290 ext4_error(orig_inode->i_sb, __func__,
1291 "We replaced blocks too much! "
1292 "sum of replaced: %llu requested: %llu",
1293 *moved_len, len);
1294 ret1 = -EIO;
1295 - goto out;
1296 + break;
1297 }
1298
1299 orig_page_offset++;
1300 @@ -1400,6 +1385,10 @@ ext4_move_extents(struct file *o_filp, s
1301 block_len_in_page = rest_blocks;
1302 }
1303
1304 + double_down_write_data_sem(orig_inode, donor_inode);
1305 + if (ret1 < 0)
1306 + break;
1307 +
1308 /* Decrease buffer counter */
1309 if (holecheck_path)
1310 ext4_ext_drop_refs(holecheck_path);
1311 @@ -1429,7 +1418,7 @@ out:
1312 ext4_ext_drop_refs(holecheck_path);
1313 kfree(holecheck_path);
1314 }
1315 -
1316 + double_up_write_data_sem(orig_inode, donor_inode);
1317 ret2 = mext_inode_double_unlock(orig_inode, donor_inode);
1318
1319 if (ret1)
1320
1321
1322 From linux@linux.site Thu Dec 10 21:25:45 2009
1323 Message-Id: <20091211052544.890897126@linux.site>
1324 User-Agent: quilt/0.47-14.9
1325 Date: Thu, 10 Dec 2009 21:23:21 -0800
1326 From: Greg KH <gregkh@suse.de>
1327 To: linux-kernel@vger.kernel.org,
1328 stable@kernel.org
1329 Cc: stable-review@kernel.org,
1330 torvalds@linux-foundation.org,
1331 akpm@linux-foundation.org,
1332 alan@lxorguk.ukuu.org.uk,
1333 Akira Fujita <a-fujita@rs.jp.nec.com>,
1334 "Theodore Tso" <tytso@mit.edu>,
1335 Greg Kroah-Hartman <gregkh@suse.de>
1336 Subject: [09/34] ext4: fix possible recursive locking warning in EXT4_IOC_MOVE_EXT
1337 References: <20091211052312.805428372@linux.site>
1338 Content-Disposition: inline; filename=0005-ext4-fix-possible-recursive-locking-warning-in-EXT4_.patch
1339 Content-Length: 1075
1340 Lines: 32
1341
1342 2.6.32-stable review patch. If anyone has any objections, please let us know.
1343
1344 ------------------
1345
1346 (cherry picked from commit 49bd22bc4d603a2a4fc2a6a60e156cbea52eb494)
1347
1348 If CONFIG_PROVE_LOCKING is enabled, the double_down_write_data_sem()
1349 will trigger a false-positive warning of a recursive lock. Since we
1350 take i_data_sem for the two inodes ordered by their inode numbers,
1351 this isn't a problem. Use of down_write_nested() will notify the lock
1352 dependency checker machinery that there is no problem here.
1353
1354 This problem was reported by Brian Rogers:
1355
1356 http://marc.info/?l=linux-ext4&m=125115356928011&w=1
1357
1358 Reported-by: Brian Rogers <brian@xyzw.org>
1359 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
1360 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1361 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1362 ---
1363 fs/ext4/move_extent.c | 2 +-
1364 1 file changed, 1 insertion(+), 1 deletion(-)
1365
1366 --- a/fs/ext4/move_extent.c
1367 +++ b/fs/ext4/move_extent.c
1368 @@ -189,7 +189,7 @@ double_down_write_data_sem(struct inode
1369 }
1370
1371 down_write(&EXT4_I(first)->i_data_sem);
1372 - down_write(&EXT4_I(second)->i_data_sem);
1373 + down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
1374 }
1375
1376 /**
1377
1378
1379 From linux@linux.site Thu Dec 10 21:25:45 2009
1380 Message-Id: <20091211052545.443549269@linux.site>
1381 User-Agent: quilt/0.47-14.9
1382 Date: Thu, 10 Dec 2009 21:23:22 -0800
1383 From: Greg KH <gregkh@suse.de>
1384 To: linux-kernel@vger.kernel.org,
1385 stable@kernel.org
1386 Cc: stable-review@kernel.org,
1387 torvalds@linux-foundation.org,
1388 akpm@linux-foundation.org,
1389 alan@lxorguk.ukuu.org.uk,
1390 "Theodore Tso" <tytso@mit.edu>,
1391 Greg Kroah-Hartman <gregkh@suse.de>
1392 Subject: [10/34] ext4: plug a buffer_head leak in an error path of ext4_iget()
1393 References: <20091211052312.805428372@linux.site>
1394 Content-Disposition: inline; filename=0006-ext4-plug-a-buffer_head-leak-in-an-error-path-of-ext.patch
1395 Content-Length: 2427
1396 Lines: 82
1397
1398 2.6.32-stable review patch. If anyone has any objections, please let us know.
1399
1400 ------------------
1401
1402 (cherry picked from commit 567f3e9a70d71e5c9be03701b8578be77857293b)
1403
1404 One of the invalid error paths in ext4_iget() forgot to brelse() the
1405 inode buffer head. Fix it by adding a brelse() in the common error
1406 return path, which also simplifies function.
1407
1408 Thanks to Andi Kleen <ak@linux.intel.com> reporting the problem.
1409
1410 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1411 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1412 ---
1413 fs/ext4/inode.c | 11 +++--------
1414 1 file changed, 3 insertions(+), 8 deletions(-)
1415
1416 --- a/fs/ext4/inode.c
1417 +++ b/fs/ext4/inode.c
1418 @@ -4781,7 +4781,6 @@ struct inode *ext4_iget(struct super_blo
1419 struct ext4_iloc iloc;
1420 struct ext4_inode *raw_inode;
1421 struct ext4_inode_info *ei;
1422 - struct buffer_head *bh;
1423 struct inode *inode;
1424 long ret;
1425 int block;
1426 @@ -4793,11 +4792,11 @@ struct inode *ext4_iget(struct super_blo
1427 return inode;
1428
1429 ei = EXT4_I(inode);
1430 + iloc.bh = 0;
1431
1432 ret = __ext4_get_inode_loc(inode, &iloc, 0);
1433 if (ret < 0)
1434 goto bad_inode;
1435 - bh = iloc.bh;
1436 raw_inode = ext4_raw_inode(&iloc);
1437 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
1438 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
1439 @@ -4820,7 +4819,6 @@ struct inode *ext4_iget(struct super_blo
1440 if (inode->i_mode == 0 ||
1441 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) {
1442 /* this inode is deleted */
1443 - brelse(bh);
1444 ret = -ESTALE;
1445 goto bad_inode;
1446 }
1447 @@ -4852,7 +4850,6 @@ struct inode *ext4_iget(struct super_blo
1448 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
1449 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
1450 EXT4_INODE_SIZE(inode->i_sb)) {
1451 - brelse(bh);
1452 ret = -EIO;
1453 goto bad_inode;
1454 }
1455 @@ -4905,10 +4902,8 @@ struct inode *ext4_iget(struct super_blo
1456 /* Validate block references which are part of inode */
1457 ret = ext4_check_inode_blockref(inode);
1458 }
1459 - if (ret) {
1460 - brelse(bh);
1461 + if (ret)
1462 goto bad_inode;
1463 - }
1464
1465 if (S_ISREG(inode->i_mode)) {
1466 inode->i_op = &ext4_file_inode_operations;
1467 @@ -4936,7 +4931,6 @@ struct inode *ext4_iget(struct super_blo
1468 init_special_inode(inode, inode->i_mode,
1469 new_decode_dev(le32_to_cpu(raw_inode->i_block[1])));
1470 } else {
1471 - brelse(bh);
1472 ret = -EIO;
1473 ext4_error(inode->i_sb, __func__,
1474 "bogus i_mode (%o) for inode=%lu",
1475 @@ -4949,6 +4943,7 @@ struct inode *ext4_iget(struct super_blo
1476 return inode;
1477
1478 bad_inode:
1479 + brelse(iloc.bh);
1480 iget_failed(inode);
1481 return ERR_PTR(ret);
1482 }
1483
1484
1485 From linux@linux.site Thu Dec 10 21:25:46 2009
1486 Message-Id: <20091211052545.995802406@linux.site>
1487 User-Agent: quilt/0.47-14.9
1488 Date: Thu, 10 Dec 2009 21:23:23 -0800
1489 From: Greg KH <gregkh@suse.de>
1490 To: linux-kernel@vger.kernel.org,
1491 stable@kernel.org
1492 Cc: stable-review@kernel.org,
1493 torvalds@linux-foundation.org,
1494 akpm@linux-foundation.org,
1495 alan@lxorguk.ukuu.org.uk,
1496 "Theodore Tso" <tytso@mit.edu>,
1497 Greg Kroah-Hartman <gregkh@suse.de>
1498 Subject: [11/34] ext4: make sure directory and symlink blocks are revoked
1499 References: <20091211052312.805428372@linux.site>
1500 Content-Disposition: inline; filename=0007-ext4-make-sure-directory-and-symlink-blocks-are-revo.patch
1501 Content-Length: 2052
1502 Lines: 58
1503
1504 2.6.32-stable review patch. If anyone has any objections, please let us know.
1505
1506 ------------------
1507
1508 (cherry picked from commit 50689696867d95b38d9c7be640a311494a04fb86)
1509
1510 When an inode gets unlinked, the functions ext4_clear_blocks() and
1511 ext4_remove_blocks() call ext4_forget() for all the buffer heads
1512 corresponding to the deleted inode's data blocks. If the inode is a
1513 directory or a symlink, the is_metadata parameter must be non-zero so
1514 ext4_forget() will revoke them via jbd2_journal_revoke(). Otherwise,
1515 if these blocks are reused for a data file, and the system crashes
1516 before a journal checkpoint, the journal replay could end up
1517 corrupting these data blocks.
1518
1519 Thanks to Curt Wohlgemuth for pointing out potential problems in this
1520 area.
1521
1522 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1523 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1524 ---
1525 fs/ext4/extents.c | 2 +-
1526 fs/ext4/inode.c | 6 ++++--
1527 2 files changed, 5 insertions(+), 3 deletions(-)
1528
1529 --- a/fs/ext4/extents.c
1530 +++ b/fs/ext4/extents.c
1531 @@ -2074,7 +2074,7 @@ static int ext4_remove_blocks(handle_t *
1532 ext_debug("free last %u blocks starting %llu\n", num, start);
1533 for (i = 0; i < num; i++) {
1534 bh = sb_find_get_block(inode->i_sb, start + i);
1535 - ext4_forget(handle, 0, inode, bh, start + i);
1536 + ext4_forget(handle, metadata, inode, bh, start + i);
1537 }
1538 ext4_free_blocks(handle, inode, start, num, metadata);
1539 } else if (from == le32_to_cpu(ex->ee_block)
1540 --- a/fs/ext4/inode.c
1541 +++ b/fs/ext4/inode.c
1542 @@ -4120,6 +4120,8 @@ static void ext4_clear_blocks(handle_t *
1543 __le32 *last)
1544 {
1545 __le32 *p;
1546 + int is_metadata = S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode);
1547 +
1548 if (try_to_extend_transaction(handle, inode)) {
1549 if (bh) {
1550 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
1551 @@ -4150,11 +4152,11 @@ static void ext4_clear_blocks(handle_t *
1552
1553 *p = 0;
1554 tbh = sb_find_get_block(inode->i_sb, nr);
1555 - ext4_forget(handle, 0, inode, tbh, nr);
1556 + ext4_forget(handle, is_metadata, inode, tbh, nr);
1557 }
1558 }
1559
1560 - ext4_free_blocks(handle, inode, block_to_free, count, 0);
1561 + ext4_free_blocks(handle, inode, block_to_free, count, is_metadata);
1562 }
1563
1564 /**
1565
1566
1567 From linux@linux.site Thu Dec 10 21:25:47 2009
1568 Message-Id: <20091211052546.544464652@linux.site>
1569 User-Agent: quilt/0.47-14.9
1570 Date: Thu, 10 Dec 2009 21:23:24 -0800
1571 From: Greg KH <gregkh@suse.de>
1572 To: linux-kernel@vger.kernel.org,
1573 stable@kernel.org
1574 Cc: stable-review@kernel.org,
1575 torvalds@linux-foundation.org,
1576 akpm@linux-foundation.org,
1577 alan@lxorguk.ukuu.org.uk,
1578 Julia Lawall <julia@diku.dk>,
1579 "Theodore Tso" <tytso@mit.edu>,
1580 Greg Kroah-Hartman <gregkh@suse.de>
1581 Subject: [12/34] ext4: fix i_flags access in ext4_da_writepages_trans_blocks()
1582 References: <20091211052312.805428372@linux.site>
1583 Content-Disposition: inline; filename=0008-ext4-fix-i_flags-access-in-ext4_da_writepages_trans_.patch
1584 Content-Length: 846
1585 Lines: 25
1586
1587 2.6.32-stable review patch. If anyone has any objections, please let us know.
1588
1589 ------------------
1590
1591 (cherry picked from commit 30c6e07a92ea4cb87160d32ffa9bce172576ae4c)
1592
1593 We need to be testing the i_flags field in the ext4 specific portion
1594 of the inode, instead of the (confusingly aliased) i_flags field in
1595 the generic struct inode.
1596
1597 Signed-off-by: Julia Lawall <julia@diku.dk>
1598 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1599 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1600 ---
1601 fs/ext4/inode.c | 2 +-
1602 1 file changed, 1 insertion(+), 1 deletion(-)
1603
1604 --- a/fs/ext4/inode.c
1605 +++ b/fs/ext4/inode.c
1606 @@ -2788,7 +2788,7 @@ static int ext4_da_writepages_trans_bloc
1607 * number of contiguous block. So we will limit
1608 * number of contiguous block to a sane value
1609 */
1610 - if (!(inode->i_flags & EXT4_EXTENTS_FL) &&
1611 + if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) &&
1612 (max_blocks > EXT4_MAX_TRANS_DATA))
1613 max_blocks = EXT4_MAX_TRANS_DATA;
1614
1615
1616
1617 From linux@linux.site Thu Dec 10 21:25:47 2009
1618 Message-Id: <20091211052547.065677730@linux.site>
1619 User-Agent: quilt/0.47-14.9
1620 Date: Thu, 10 Dec 2009 21:23:25 -0800
1621 From: Greg KH <gregkh@suse.de>
1622 To: linux-kernel@vger.kernel.org,
1623 stable@kernel.org
1624 Cc: stable-review@kernel.org,
1625 torvalds@linux-foundation.org,
1626 akpm@linux-foundation.org,
1627 alan@lxorguk.ukuu.org.uk,
1628 Eric Sandeen <sandeen@redhat.com>,
1629 "Theodore Tso" <tytso@mit.edu>,
1630 Greg Kroah-Hartman <gregkh@suse.de>
1631 Subject: [13/34] ext4: journal all modifications in ext4_xattr_set_handle
1632 References: <20091211052312.805428372@linux.site>
1633 Content-Disposition: inline; filename=0009-ext4-journal-all-modifications-in-ext4_xattr_set_han.patch
1634 Content-Length: 1254
1635 Lines: 39
1636
1637 2.6.32-stable review patch. If anyone has any objections, please let us know.
1638
1639 ------------------
1640
1641 (cherry picked from commit 86ebfd08a1930ccedb8eac0aeb1ed4b8b6a41dbc)
1642
1643 ext4_xattr_set_handle() was zeroing out an inode outside
1644 of journaling constraints; this is one of the accesses that
1645 was causing the crc errors in journal replay as seen in
1646 kernel.org bugzilla #14354.
1647
1648 Reviewed-by: Andreas Dilger <adilger@sun.com>
1649 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
1650 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1651 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1652 ---
1653 fs/ext4/xattr.c | 7 ++++---
1654 1 file changed, 4 insertions(+), 3 deletions(-)
1655
1656 --- a/fs/ext4/xattr.c
1657 +++ b/fs/ext4/xattr.c
1658 @@ -988,6 +988,10 @@ ext4_xattr_set_handle(handle_t *handle,
1659 if (error)
1660 goto cleanup;
1661
1662 + error = ext4_journal_get_write_access(handle, is.iloc.bh);
1663 + if (error)
1664 + goto cleanup;
1665 +
1666 if (EXT4_I(inode)->i_state & EXT4_STATE_NEW) {
1667 struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc);
1668 memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
1669 @@ -1013,9 +1017,6 @@ ext4_xattr_set_handle(handle_t *handle,
1670 if (flags & XATTR_CREATE)
1671 goto cleanup;
1672 }
1673 - error = ext4_journal_get_write_access(handle, is.iloc.bh);
1674 - if (error)
1675 - goto cleanup;
1676 if (!value) {
1677 if (!is.s.not_found)
1678 error = ext4_xattr_ibody_set(handle, inode, &i, &is);
1679
1680
1681 From linux@linux.site Thu Dec 10 21:25:48 2009
1682 Message-Id: <20091211052547.644399594@linux.site>
1683 User-Agent: quilt/0.47-14.9
1684 Date: Thu, 10 Dec 2009 21:23:26 -0800
1685 From: Greg KH <gregkh@suse.de>
1686 To: linux-kernel@vger.kernel.org,
1687 stable@kernel.org
1688 Cc: stable-review@kernel.org,
1689 torvalds@linux-foundation.org,
1690 akpm@linux-foundation.org,
1691 alan@lxorguk.ukuu.org.uk,
1692 "Theodore Tso" <tytso@mit.edu>,
1693 Greg Kroah-Hartman <gregkh@suse.de>
1694 Subject: [14/34] ext4: dont update the superblock in ext4_statfs()
1695 References: <20091211052312.805428372@linux.site>
1696 Content-Disposition: inline; filename=0010-ext4-don-t-update-the-superblock-in-ext4_statfs.patch
1697 Content-Length: 1341
1698 Lines: 31
1699
1700 2.6.32-stable review patch. If anyone has any objections, please let us know.
1701
1702 ------------------
1703
1704 (cherry picked from commit 3f8fb9490efbd300887470a2a880a64e04dcc3f5)
1705
1706 commit a71ce8c6c9bf269b192f352ea555217815cf027e updated ext4_statfs()
1707 to update the on-disk superblock counters, but modified this buffer
1708 directly without any journaling of the change. This is one of the
1709 accesses that was causing the crc errors in journal replay as seen in
1710 kernel.org bugzilla #14354.
1711
1712 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1713 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1714 ---
1715 fs/ext4/super.c | 2 --
1716 1 file changed, 2 deletions(-)
1717
1718 --- a/fs/ext4/super.c
1719 +++ b/fs/ext4/super.c
1720 @@ -3668,13 +3668,11 @@ static int ext4_statfs(struct dentry *de
1721 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
1722 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter) -
1723 percpu_counter_sum_positive(&sbi->s_dirtyblocks_counter);
1724 - ext4_free_blocks_count_set(es, buf->f_bfree);
1725 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
1726 if (buf->f_bfree < ext4_r_blocks_count(es))
1727 buf->f_bavail = 0;
1728 buf->f_files = le32_to_cpu(es->s_inodes_count);
1729 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
1730 - es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
1731 buf->f_namelen = EXT4_NAME_LEN;
1732 fsid = le64_to_cpup((void *)es->s_uuid) ^
1733 le64_to_cpup((void *)es->s_uuid + sizeof(u64));
1734
1735
1736 From linux@linux.site Thu Dec 10 21:25:48 2009
1737 Message-Id: <20091211052548.201782286@linux.site>
1738 User-Agent: quilt/0.47-14.9
1739 Date: Thu, 10 Dec 2009 21:23:27 -0800
1740 From: Greg KH <gregkh@suse.de>
1741 To: linux-kernel@vger.kernel.org,
1742 stable@kernel.org
1743 Cc: stable-review@kernel.org,
1744 torvalds@linux-foundation.org,
1745 akpm@linux-foundation.org,
1746 alan@lxorguk.ukuu.org.uk,
1747 "Theodore Tso" <tytso@mit.edu>,
1748 Greg Kroah-Hartman <gregkh@suse.de>
1749 Subject: [15/34] ext4: fix uninit block bitmap initialization when s_meta_first_bg is non-zero
1750 References: <20091211052312.805428372@linux.site>
1751 Content-Disposition: inline; filename=0011-ext4-fix-uninit-block-bitmap-initialization-when-s_m.patch
1752 Content-Length: 875
1753 Lines: 29
1754
1755 2.6.32-stable review patch. If anyone has any objections, please let us know.
1756
1757 ------------------
1758
1759 (cherry picked from commit 8dadb198cb70ef811916668fe67eeec82e8858dd)
1760
1761 The number of old-style block group descriptor blocks is
1762 s_meta_first_bg when the meta_bg feature flag is set.
1763
1764 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1765 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1766 ---
1767 fs/ext4/balloc.c | 8 +++++++-
1768 1 file changed, 7 insertions(+), 1 deletion(-)
1769
1770 --- a/fs/ext4/balloc.c
1771 +++ b/fs/ext4/balloc.c
1772 @@ -761,7 +761,13 @@ static unsigned long ext4_bg_num_gdb_met
1773 static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
1774 ext4_group_t group)
1775 {
1776 - return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
1777 + if (!ext4_bg_has_super(sb, group))
1778 + return 0;
1779 +
1780 + if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
1781 + return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
1782 + else
1783 + return EXT4_SB(sb)->s_gdb_count;
1784 }
1785
1786 /**
1787
1788
1789 From linux@linux.site Thu Dec 10 21:25:49 2009
1790 Message-Id: <20091211052548.726431621@linux.site>
1791 User-Agent: quilt/0.47-14.9
1792 Date: Thu, 10 Dec 2009 21:23:28 -0800
1793 From: Greg KH <gregkh@suse.de>
1794 To: linux-kernel@vger.kernel.org,
1795 stable@kernel.org
1796 Cc: stable-review@kernel.org,
1797 torvalds@linux-foundation.org,
1798 akpm@linux-foundation.org,
1799 alan@lxorguk.ukuu.org.uk,
1800 "Theodore Tso" <tytso@mit.edu>,
1801 Greg Kroah-Hartman <gregkh@suse.de>
1802 Subject: [16/34] ext4: fix block validity checks so they work correctly with meta_bg
1803 References: <20091211052312.805428372@linux.site>
1804 Content-Disposition: inline; filename=0012-ext4-fix-block-validity-checks-so-they-work-correctl.patch
1805 Content-Length: 1411
1806 Lines: 39
1807
1808 2.6.32-stable review patch. If anyone has any objections, please let us know.
1809
1810 ------------------
1811
1812 (cherry picked from commit 1032988c71f3f85483b2b4319684d1205a704c02)
1813
1814 The block validity checks used by ext4_data_block_valid() wasn't
1815 correctly written to check file systems with the meta_bg feature. Fix
1816 this.
1817
1818 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1819 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1820 ---
1821 fs/ext4/block_validity.c | 2 +-
1822 fs/ext4/inode.c | 5 +----
1823 2 files changed, 2 insertions(+), 5 deletions(-)
1824
1825 --- a/fs/ext4/block_validity.c
1826 +++ b/fs/ext4/block_validity.c
1827 @@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_
1828 if (ext4_bg_has_super(sb, i) &&
1829 ((i < 5) || ((i % flex_size) == 0)))
1830 add_system_zone(sbi, ext4_group_first_block_no(sb, i),
1831 - sbi->s_gdb_count + 1);
1832 + ext4_bg_num_gdb(sb, i) + 1);
1833 gdp = ext4_get_group_desc(sb, i, NULL);
1834 ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1);
1835 if (ret)
1836 --- a/fs/ext4/inode.c
1837 +++ b/fs/ext4/inode.c
1838 @@ -4883,10 +4883,7 @@ struct inode *ext4_iget(struct super_blo
1839
1840 ret = 0;
1841 if (ei->i_file_acl &&
1842 - ((ei->i_file_acl <
1843 - (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
1844 - EXT4_SB(sb)->s_gdb_count)) ||
1845 - (ei->i_file_acl >= ext4_blocks_count(EXT4_SB(sb)->s_es)))) {
1846 + !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
1847 ext4_error(sb, __func__,
1848 "bad extended attribute block %llu in inode #%lu",
1849 ei->i_file_acl, inode->i_ino);
1850
1851
1852 From linux@linux.site Thu Dec 10 21:25:49 2009
1853 Message-Id: <20091211052549.341684525@linux.site>
1854 User-Agent: quilt/0.47-14.9
1855 Date: Thu, 10 Dec 2009 21:23:29 -0800
1856 From: Greg KH <gregkh@suse.de>
1857 To: linux-kernel@vger.kernel.org,
1858 stable@kernel.org
1859 Cc: stable-review@kernel.org,
1860 torvalds@linux-foundation.org,
1861 akpm@linux-foundation.org,
1862 alan@lxorguk.ukuu.org.uk,
1863 "Theodore Tso" <tytso@mit.edu>,
1864 Jan Kara <jack@suse.cz>,
1865 Greg Kroah-Hartman <gregkh@suse.de>
1866 Subject: [17/34] ext4: avoid issuing unnecessary barriers
1867 References: <20091211052312.805428372@linux.site>
1868 Content-Disposition: inline; filename=0013-ext4-avoid-issuing-unnecessary-barriers.patch
1869 Content-Length: 1115
1870 Lines: 37
1871
1872 2.6.32-stable review patch. If anyone has any objections, please let us know.
1873
1874 ------------------
1875
1876 (cherry picked from commit 6b17d902fdd241adfa4ce780df20547b28bf5801)
1877
1878 We don't to issue an I/O barrier on an error or if we force commit
1879 because we are doing data journaling.
1880
1881 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1882 Cc: Jan Kara <jack@suse.cz>
1883 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1884 ---
1885 fs/ext4/fsync.c | 8 +++-----
1886 1 file changed, 3 insertions(+), 5 deletions(-)
1887
1888 --- a/fs/ext4/fsync.c
1889 +++ b/fs/ext4/fsync.c
1890 @@ -60,7 +60,7 @@ int ext4_sync_file(struct file *file, st
1891
1892 ret = flush_aio_dio_completed_IO(inode);
1893 if (ret < 0)
1894 - goto out;
1895 + return ret;
1896 /*
1897 * data=writeback:
1898 * The caller's filemap_fdatawrite()/wait will sync the data.
1899 @@ -79,10 +79,8 @@ int ext4_sync_file(struct file *file, st
1900 * (they were dirtied by commit). But that's OK - the blocks are
1901 * safe in-journal, which is all fsync() needs to ensure.
1902 */
1903 - if (ext4_should_journal_data(inode)) {
1904 - ret = ext4_force_commit(inode->i_sb);
1905 - goto out;
1906 - }
1907 + if (ext4_should_journal_data(inode))
1908 + return ext4_force_commit(inode->i_sb);
1909
1910 if (!journal)
1911 ret = sync_mapping_buffers(inode->i_mapping);
1912
1913
1914 From linux@linux.site Thu Dec 10 21:25:50 2009
1915 Message-Id: <20091211052549.883933582@linux.site>
1916 User-Agent: quilt/0.47-14.9
1917 Date: Thu, 10 Dec 2009 21:23:30 -0800
1918 From: Greg KH <gregkh@suse.de>
1919 To: linux-kernel@vger.kernel.org,
1920 stable@kernel.org
1921 Cc: stable-review@kernel.org,
1922 torvalds@linux-foundation.org,
1923 akpm@linux-foundation.org,
1924 alan@lxorguk.ukuu.org.uk,
1925 Jan Kara <jack@suse.cz>,
1926 "Theodore Tso" <tytso@mit.edu>,
1927 Greg Kroah-Hartman <gregkh@suse.de>
1928 Subject: [18/34] ext4: fix error handling in ext4_ind_get_blocks()
1929 References: <20091211052312.805428372@linux.site>
1930 Content-Disposition: inline; filename=0014-ext4-fix-error-handling-in-ext4_ind_get_blocks.patch
1931 Content-Length: 733
1932 Lines: 25
1933
1934 2.6.32-stable review patch. If anyone has any objections, please let us know.
1935
1936 ------------------
1937
1938 (cherry picked from commit 2bba702d4f88d7b010ec37e2527b552588404ae7)
1939
1940 When an error happened in ext4_splice_branch we failed to notice that
1941 in ext4_ind_get_blocks and mapped the buffer anyway. Fix the problem
1942 by checking for error properly.
1943
1944 Signed-off-by: Jan Kara <jack@suse.cz>
1945 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1946 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1947 ---
1948 fs/ext4/inode.c | 2 +-
1949 1 file changed, 1 insertion(+), 1 deletion(-)
1950
1951 --- a/fs/ext4/inode.c
1952 +++ b/fs/ext4/inode.c
1953 @@ -1021,7 +1021,7 @@ static int ext4_ind_get_blocks(handle_t
1954 if (!err)
1955 err = ext4_splice_branch(handle, inode, iblock,
1956 partial, indirect_blks, count);
1957 - else
1958 + if (err)
1959 goto cleanup;
1960
1961 set_buffer_new(bh_result);
1962
1963
1964 From linux@linux.site Thu Dec 10 21:25:50 2009
1965 Message-Id: <20091211052550.441771142@linux.site>
1966 User-Agent: quilt/0.47-14.9
1967 Date: Thu, 10 Dec 2009 21:23:31 -0800
1968 From: Greg KH <gregkh@suse.de>
1969 To: linux-kernel@vger.kernel.org,
1970 stable@kernel.org
1971 Cc: stable-review@kernel.org,
1972 torvalds@linux-foundation.org,
1973 akpm@linux-foundation.org,
1974 alan@lxorguk.ukuu.org.uk,
1975 Eric Sandeen <sandeen@redhat.com>,
1976 "Theodore Tso" <tytso@mit.edu>,
1977 Greg Kroah-Hartman <gregkh@suse.de>
1978 Subject: [19/34] ext4: make trim/discard optional (and off by default)
1979 References: <20091211052312.805428372@linux.site>
1980 Content-Disposition: inline; filename=0015-ext4-make-trim-discard-optional-and-off-by-default.patch
1981 Content-Length: 4275
1982 Lines: 124
1983
1984 2.6.32-stable review patch. If anyone has any objections, please let us know.
1985
1986 ------------------
1987
1988 (cherry picked from commit 5328e635315734d42080de9a5a1ee87bf4cae0a4)
1989
1990 It is anticipated that when sb_issue_discard starts doing
1991 real work on trim-capable devices, we may see issues. Make
1992 this mount-time optional, and default it to off until we know
1993 that things are working out OK.
1994
1995 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
1996 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1997 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1998 ---
1999 Documentation/filesystems/ext4.txt | 6 ++++++
2000 fs/ext4/ext4.h | 1 +
2001 fs/ext4/mballoc.c | 21 +++++++++++++--------
2002 fs/ext4/super.c | 14 +++++++++++++-
2003 4 files changed, 33 insertions(+), 9 deletions(-)
2004
2005 --- a/Documentation/filesystems/ext4.txt
2006 +++ b/Documentation/filesystems/ext4.txt
2007 @@ -353,6 +353,12 @@ noauto_da_alloc replacing existing file
2008 system crashes before the delayed allocation
2009 blocks are forced to disk.
2010
2011 +discard Controls whether ext4 should issue discard/TRIM
2012 +nodiscard(*) commands to the underlying block device when
2013 + blocks are freed. This is useful for SSD devices
2014 + and sparse/thinly-provisioned LUNs, but it is off
2015 + by default until sufficient testing has been done.
2016 +
2017 Data Mode
2018 =========
2019 There are 3 different data modes:
2020 --- a/fs/ext4/ext4.h
2021 +++ b/fs/ext4/ext4.h
2022 @@ -750,6 +750,7 @@ struct ext4_inode_info {
2023 #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
2024 #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
2025 #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
2026 +#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */
2027
2028 #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
2029 #define set_opt(o, opt) o |= EXT4_MOUNT_##opt
2030 --- a/fs/ext4/mballoc.c
2031 +++ b/fs/ext4/mballoc.c
2032 @@ -2529,7 +2529,6 @@ static void release_blocks_on_commit(jou
2033 struct ext4_group_info *db;
2034 int err, count = 0, count2 = 0;
2035 struct ext4_free_data *entry;
2036 - ext4_fsblk_t discard_block;
2037 struct list_head *l, *ltmp;
2038
2039 list_for_each_safe(l, ltmp, &txn->t_private_list) {
2040 @@ -2559,13 +2558,19 @@ static void release_blocks_on_commit(jou
2041 page_cache_release(e4b.bd_bitmap_page);
2042 }
2043 ext4_unlock_group(sb, entry->group);
2044 - discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb)
2045 - + entry->start_blk
2046 - + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
2047 - trace_ext4_discard_blocks(sb, (unsigned long long)discard_block,
2048 - entry->count);
2049 - sb_issue_discard(sb, discard_block, entry->count);
2050 -
2051 + if (test_opt(sb, DISCARD)) {
2052 + ext4_fsblk_t discard_block;
2053 + struct ext4_super_block *es = EXT4_SB(sb)->s_es;
2054 +
2055 + discard_block = (ext4_fsblk_t)entry->group *
2056 + EXT4_BLOCKS_PER_GROUP(sb)
2057 + + entry->start_blk
2058 + + le32_to_cpu(es->s_first_data_block);
2059 + trace_ext4_discard_blocks(sb,
2060 + (unsigned long long)discard_block,
2061 + entry->count);
2062 + sb_issue_discard(sb, discard_block, entry->count);
2063 + }
2064 kmem_cache_free(ext4_free_ext_cachep, entry);
2065 ext4_mb_release_desc(&e4b);
2066 }
2067 --- a/fs/ext4/super.c
2068 +++ b/fs/ext4/super.c
2069 @@ -899,6 +899,9 @@ static int ext4_show_options(struct seq_
2070 if (test_opt(sb, NO_AUTO_DA_ALLOC))
2071 seq_puts(seq, ",noauto_da_alloc");
2072
2073 + if (test_opt(sb, DISCARD))
2074 + seq_puts(seq, ",discard");
2075 +
2076 ext4_show_quota_options(seq, sb);
2077
2078 return 0;
2079 @@ -1079,7 +1082,8 @@ enum {
2080 Opt_usrquota, Opt_grpquota, Opt_i_version,
2081 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
2082 Opt_block_validity, Opt_noblock_validity,
2083 - Opt_inode_readahead_blks, Opt_journal_ioprio
2084 + Opt_inode_readahead_blks, Opt_journal_ioprio,
2085 + Opt_discard, Opt_nodiscard,
2086 };
2087
2088 static const match_table_t tokens = {
2089 @@ -1144,6 +1148,8 @@ static const match_table_t tokens = {
2090 {Opt_auto_da_alloc, "auto_da_alloc=%u"},
2091 {Opt_auto_da_alloc, "auto_da_alloc"},
2092 {Opt_noauto_da_alloc, "noauto_da_alloc"},
2093 + {Opt_discard, "discard"},
2094 + {Opt_nodiscard, "nodiscard"},
2095 {Opt_err, NULL},
2096 };
2097
2098 @@ -1565,6 +1571,12 @@ set_qf_format:
2099 else
2100 set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
2101 break;
2102 + case Opt_discard:
2103 + set_opt(sbi->s_mount_opt, DISCARD);
2104 + break;
2105 + case Opt_nodiscard:
2106 + clear_opt(sbi->s_mount_opt, DISCARD);
2107 + break;
2108 default:
2109 ext4_msg(sb, KERN_ERR,
2110 "Unrecognized mount option \"%s\" "
2111
2112
2113 From linux@linux.site Thu Dec 10 21:25:51 2009
2114 Message-Id: <20091211052551.004437667@linux.site>
2115 User-Agent: quilt/0.47-14.9
2116 Date: Thu, 10 Dec 2009 21:23:32 -0800
2117 From: Greg KH <gregkh@suse.de>
2118 To: linux-kernel@vger.kernel.org,
2119 stable@kernel.org
2120 Cc: stable-review@kernel.org,
2121 torvalds@linux-foundation.org,
2122 akpm@linux-foundation.org,
2123 alan@lxorguk.ukuu.org.uk,
2124 Eric Sandeen <sandeen@redhat.com>,
2125 "Theodore Tso" <tytso@mit.edu>,
2126 Greg Kroah-Hartman <gregkh@suse.de>
2127 Subject: [20/34] ext4: make "norecovery" an alias for "noload"
2128 References: <20091211052312.805428372@linux.site>
2129 Content-Disposition: inline; filename=0016-ext4-make-norecovery-an-alias-for-noload.patch
2130 Content-Length: 1856
2131 Lines: 53
2132
2133 2.6.32-stable review patch. If anyone has any objections, please let us know.
2134
2135 ------------------
2136
2137 (cherry picked from commit e3bb52ae2bb9573e84c17b8e3560378d13a5c798)
2138
2139 Users on the linux-ext4 list recently complained about differences
2140 across filesystems w.r.t. how to mount without a journal replay.
2141
2142 In the discussion it was noted that xfs's "norecovery" option is
2143 perhaps more descriptively accurate than "noload," so let's make
2144 that an alias for ext4.
2145
2146 Also show this status in /proc/mounts
2147
2148 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2149 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2150 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2151 ---
2152 Documentation/filesystems/ext4.txt | 4 ++--
2153 fs/ext4/super.c | 4 ++++
2154 2 files changed, 6 insertions(+), 2 deletions(-)
2155
2156 --- a/Documentation/filesystems/ext4.txt
2157 +++ b/Documentation/filesystems/ext4.txt
2158 @@ -153,8 +153,8 @@ journal_dev=devnum When the external jou
2159 identified through its new major/minor numbers encoded
2160 in devnum.
2161
2162 -noload Don't load the journal on mounting. Note that
2163 - if the filesystem was not unmounted cleanly,
2164 +norecovery Don't load the journal on mounting. Note that
2165 +noload if the filesystem was not unmounted cleanly,
2166 skipping the journal replay will lead to the
2167 filesystem containing inconsistencies that can
2168 lead to any number of problems.
2169 --- a/fs/ext4/super.c
2170 +++ b/fs/ext4/super.c
2171 @@ -902,6 +902,9 @@ static int ext4_show_options(struct seq_
2172 if (test_opt(sb, DISCARD))
2173 seq_puts(seq, ",discard");
2174
2175 + if (test_opt(sb, NOLOAD))
2176 + seq_puts(seq, ",norecovery");
2177 +
2178 ext4_show_quota_options(seq, sb);
2179
2180 return 0;
2181 @@ -1108,6 +1111,7 @@ static const match_table_t tokens = {
2182 {Opt_acl, "acl"},
2183 {Opt_noacl, "noacl"},
2184 {Opt_noload, "noload"},
2185 + {Opt_noload, "norecovery"},
2186 {Opt_nobh, "nobh"},
2187 {Opt_bh, "bh"},
2188 {Opt_commit, "commit=%u"},
2189
2190
2191 From linux@linux.site Thu Dec 10 21:25:52 2009
2192 Message-Id: <20091211052551.564396025@linux.site>
2193 User-Agent: quilt/0.47-14.9
2194 Date: Thu, 10 Dec 2009 21:23:33 -0800
2195 From: Greg KH <gregkh@suse.de>
2196 To: linux-kernel@vger.kernel.org,
2197 stable@kernel.org
2198 Cc: stable-review@kernel.org,
2199 torvalds@linux-foundation.org,
2200 akpm@linux-foundation.org,
2201 alan@lxorguk.ukuu.org.uk,
2202 Akira Fujita <a-fujita@rs.jp.nec.com>,
2203 "Theodore Tso" <tytso@mit.edu>,
2204 Greg Kroah-Hartman <gregkh@suse.de>
2205 Subject: [21/34] ext4: Fix double-free of blocks with EXT4_IOC_MOVE_EXT
2206 References: <20091211052312.805428372@linux.site>
2207 Content-Disposition: inline; filename=0017-ext4-Fix-double-free-of-blocks-with-EXT4_IOC_MOVE_EX.patch
2208 Content-Length: 2565
2209 Lines: 75
2210
2211 2.6.32-stable review patch. If anyone has any objections, please let us know.
2212
2213 ------------------
2214
2215 (cherry picked from commit 94d7c16cbbbd0e03841fcf272bcaf0620ad39618)
2216
2217 At the beginning of ext4_move_extent(), we call
2218 ext4_discard_preallocations() to discard inode PAs of orig and donor
2219 inodes. But in the following case, blocks can be double freed, so
2220 move ext4_discard_preallocations() to the end of ext4_move_extents().
2221
2222 1. Discard inode PAs of orig and donor inodes with
2223 ext4_discard_preallocations() in ext4_move_extents().
2224
2225 orig : [ DATA1 ]
2226 donor: [ DATA2 ]
2227
2228 2. While data blocks are exchanging between orig and donor inodes, new
2229 inode PAs is created to orig by other process's block allocation.
2230 (Since there are semaphore gaps in ext4_move_extents().) And new
2231 inode PAs is used partially (2-1).
2232
2233 2-1 Create new inode PAs to orig inode
2234 orig : [ DATA1 | used PA1 | free PA1 ]
2235 donor: [ DATA2 ]
2236
2237 3. Donor inode which has old orig inode's blocks is deleted after
2238 EXT4_IOC_MOVE_EXT finished (3-1, 3-2). So the block bitmap
2239 corresponds to old orig inode's blocks are freed.
2240
2241 3-1 After EXT4_IOC_MOVE_EXT finished
2242 orig : [ DATA2 | free PA1 ]
2243 donor: [ DATA1 | used PA1 ]
2244
2245 3-2 Delete donor inode
2246 orig : [ DATA2 | free PA1 ]
2247 donor: [ FREE SPACE(DATA1) | FREE SPACE(used PA1) ]
2248
2249 4. The double-free of blocks is occurred, when close() is called to
2250 orig inode. Because ext4_discard_preallocations() for orig inode
2251 frees used PA1 and free PA1, though used PA1 is already freed in 3.
2252
2253 4-1 Double-free of blocks is occurred
2254 orig : [ DATA2 | FREE SPACE(free PA1) ]
2255 donor: [ FREE SPACE(DATA1) | DOUBLE FREE(used PA1) ]
2256
2257 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
2258 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2259 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2260 ---
2261 fs/ext4/move_extent.c | 9 +++++----
2262 1 file changed, 5 insertions(+), 4 deletions(-)
2263
2264 --- a/fs/ext4/move_extent.c
2265 +++ b/fs/ext4/move_extent.c
2266 @@ -1289,10 +1289,6 @@ ext4_move_extents(struct file *o_filp, s
2267 ext4_ext_get_actual_len(ext_cur), block_end + 1) -
2268 max(le32_to_cpu(ext_cur->ee_block), block_start);
2269
2270 - /* Discard preallocations of two inodes */
2271 - ext4_discard_preallocations(orig_inode);
2272 - ext4_discard_preallocations(donor_inode);
2273 -
2274 while (!last_extent && le32_to_cpu(ext_cur->ee_block) <= block_end) {
2275 seq_blocks += add_blocks;
2276
2277 @@ -1410,6 +1406,11 @@ ext4_move_extents(struct file *o_filp, s
2278
2279 }
2280 out:
2281 + if (*moved_len) {
2282 + ext4_discard_preallocations(orig_inode);
2283 + ext4_discard_preallocations(donor_inode);
2284 + }
2285 +
2286 if (orig_path) {
2287 ext4_ext_drop_refs(orig_path);
2288 kfree(orig_path);
2289
2290
2291 From linux@linux.site Thu Dec 10 21:25:52 2009
2292 Message-Id: <20091211052552.134440580@linux.site>
2293 User-Agent: quilt/0.47-14.9
2294 Date: Thu, 10 Dec 2009 21:23:34 -0800
2295 From: Greg KH <gregkh@suse.de>
2296 To: linux-kernel@vger.kernel.org,
2297 stable@kernel.org
2298 Cc: stable-review@kernel.org,
2299 torvalds@linux-foundation.org,
2300 akpm@linux-foundation.org,
2301 alan@lxorguk.ukuu.org.uk,
2302 Kazuya Mio <k-mio@sx.jp.nec.com>,
2303 Akira Fujita <a-fujita@rs.jp.nec.com>,
2304 "Theodore Tso" <tytso@mit.edu>,
2305 Greg Kroah-Hartman <gregkh@suse.de>
2306 Subject: [22/34] ext4: initialize moved_len before calling ext4_move_extents()
2307 References: <20091211052312.805428372@linux.site>
2308 Content-Disposition: inline; filename=0018-ext4-initialize-moved_len-before-calling-ext4_move_e.patch
2309 Content-Length: 2439
2310 Lines: 72
2311
2312 2.6.32-stable review patch. If anyone has any objections, please let us know.
2313
2314 ------------------
2315
2316 (cherry picked from commit 446aaa6e7e993b38a6f21c6acfa68f3f1af3dbe3)
2317
2318 The move_extent.moved_len is used to pass back the number of exchanged
2319 blocks count to user space. Currently the caller must clear this
2320 field; but we spend more code space checking for this requirement than
2321 simply zeroing the field ourselves, so let's just make life easier for
2322 everyone all around.
2323
2324 Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
2325 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
2326 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2327 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2328 ---
2329 fs/ext4/ioctl.c | 1 +
2330 fs/ext4/move_extent.c | 14 +++-----------
2331 2 files changed, 4 insertions(+), 11 deletions(-)
2332
2333 --- a/fs/ext4/ioctl.c
2334 +++ b/fs/ext4/ioctl.c
2335 @@ -239,6 +239,7 @@ setversion_out:
2336 }
2337 }
2338
2339 + me.moved_len = 0;
2340 err = ext4_move_extents(filp, donor_filp, me.orig_start,
2341 me.donor_start, me.len, &me.moved_len);
2342 fput(donor_filp);
2343 --- a/fs/ext4/move_extent.c
2344 +++ b/fs/ext4/move_extent.c
2345 @@ -947,7 +947,6 @@ out2:
2346 * @orig_start: logical start offset in block for orig
2347 * @donor_start: logical start offset in block for donor
2348 * @len: the number of blocks to be moved
2349 - * @moved_len: moved block length
2350 *
2351 * Check the arguments of ext4_move_extents() whether the files can be
2352 * exchanged with each other.
2353 @@ -955,8 +954,8 @@ out2:
2354 */
2355 static int
2356 mext_check_arguments(struct inode *orig_inode,
2357 - struct inode *donor_inode, __u64 orig_start,
2358 - __u64 donor_start, __u64 *len, __u64 moved_len)
2359 + struct inode *donor_inode, __u64 orig_start,
2360 + __u64 donor_start, __u64 *len)
2361 {
2362 ext4_lblk_t orig_blocks, donor_blocks;
2363 unsigned int blkbits = orig_inode->i_blkbits;
2364 @@ -1010,13 +1009,6 @@ mext_check_arguments(struct inode *orig_
2365 return -EINVAL;
2366 }
2367
2368 - if (moved_len) {
2369 - ext4_debug("ext4 move extent: moved_len should be 0 "
2370 - "[ino:orig %lu, donor %lu]\n", orig_inode->i_ino,
2371 - donor_inode->i_ino);
2372 - return -EINVAL;
2373 - }
2374 -
2375 if ((orig_start > EXT_MAX_BLOCK) ||
2376 (donor_start > EXT_MAX_BLOCK) ||
2377 (*len > EXT_MAX_BLOCK) ||
2378 @@ -1226,7 +1218,7 @@ ext4_move_extents(struct file *o_filp, s
2379 double_down_write_data_sem(orig_inode, donor_inode);
2380 /* Check the filesystem environment whether move_extent can be done */
2381 ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start,
2382 - donor_start, &len, *moved_len);
2383 + donor_start, &len);
2384 if (ret1)
2385 goto out;
2386
2387
2388
2389 From linux@linux.site Thu Dec 10 21:25:53 2009
2390 Message-Id: <20091211052552.682377360@linux.site>
2391 User-Agent: quilt/0.47-14.9
2392 Date: Thu, 10 Dec 2009 21:23:35 -0800
2393 From: Greg KH <gregkh@suse.de>
2394 To: linux-kernel@vger.kernel.org,
2395 stable@kernel.org
2396 Cc: stable-review@kernel.org,
2397 torvalds@linux-foundation.org,
2398 akpm@linux-foundation.org,
2399 alan@lxorguk.ukuu.org.uk,
2400 Akira Fujita <a-fujita@rs.jp.nec.com>,
2401 "Theodore Tso" <tytso@mit.edu>,
2402 Greg Kroah-Hartman <gregkh@suse.de>
2403 Subject: [23/34] ext4: move_extent_per_page() cleanup
2404 References: <20091211052312.805428372@linux.site>
2405 Content-Disposition: inline; filename=0019-ext4-move_extent_per_page-cleanup.patch
2406 Content-Length: 2733
2407 Lines: 87
2408
2409 2.6.32-stable review patch. If anyone has any objections, please let us know.
2410
2411 ------------------
2412
2413 (cherry picked from commit ac48b0a1d068887141581bea8285de5fcab182b0)
2414
2415 Integrate duplicate lines (acquire/release semaphore and invalidate
2416 extent cache in move_extent_per_page()) into mext_replace_branches(),
2417 to reduce source and object code size.
2418
2419 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
2420 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2421 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2422 ---
2423 fs/ext4/move_extent.c | 30 +++++++++---------------------
2424 1 file changed, 9 insertions(+), 21 deletions(-)
2425
2426 --- a/fs/ext4/move_extent.c
2427 +++ b/fs/ext4/move_extent.c
2428 @@ -660,6 +660,9 @@ mext_replace_branches(handle_t *handle,
2429 int replaced_count = 0;
2430 int dext_alen;
2431
2432 + /* Protect extent trees against block allocations via delalloc */
2433 + double_down_write_data_sem(orig_inode, donor_inode);
2434 +
2435 /* Get the original extent for the block "orig_off" */
2436 *err = get_ext_path(orig_inode, orig_off, &orig_path);
2437 if (*err)
2438 @@ -755,6 +758,11 @@ out:
2439 kfree(donor_path);
2440 }
2441
2442 + ext4_ext_invalidate_cache(orig_inode);
2443 + ext4_ext_invalidate_cache(donor_inode);
2444 +
2445 + double_up_write_data_sem(orig_inode, donor_inode);
2446 +
2447 return replaced_count;
2448 }
2449
2450 @@ -820,19 +828,9 @@ move_extent_per_page(struct file *o_filp
2451 * Just swap data blocks between orig and donor.
2452 */
2453 if (uninit) {
2454 - /*
2455 - * Protect extent trees against block allocations
2456 - * via delalloc
2457 - */
2458 - double_down_write_data_sem(orig_inode, donor_inode);
2459 replaced_count = mext_replace_branches(handle, orig_inode,
2460 donor_inode, orig_blk_offset,
2461 block_len_in_page, err);
2462 -
2463 - /* Clear the inode cache not to refer to the old data */
2464 - ext4_ext_invalidate_cache(orig_inode);
2465 - ext4_ext_invalidate_cache(donor_inode);
2466 - double_up_write_data_sem(orig_inode, donor_inode);
2467 goto out2;
2468 }
2469
2470 @@ -880,8 +878,6 @@ move_extent_per_page(struct file *o_filp
2471 /* Release old bh and drop refs */
2472 try_to_release_page(page, 0);
2473
2474 - /* Protect extent trees against block allocations via delalloc */
2475 - double_down_write_data_sem(orig_inode, donor_inode);
2476 replaced_count = mext_replace_branches(handle, orig_inode, donor_inode,
2477 orig_blk_offset, block_len_in_page,
2478 &err2);
2479 @@ -890,18 +886,10 @@ move_extent_per_page(struct file *o_filp
2480 block_len_in_page = replaced_count;
2481 replaced_size =
2482 block_len_in_page << orig_inode->i_blkbits;
2483 - } else {
2484 - double_up_write_data_sem(orig_inode, donor_inode);
2485 + } else
2486 goto out;
2487 - }
2488 }
2489
2490 - /* Clear the inode cache not to refer to the old data */
2491 - ext4_ext_invalidate_cache(orig_inode);
2492 - ext4_ext_invalidate_cache(donor_inode);
2493 -
2494 - double_up_write_data_sem(orig_inode, donor_inode);
2495 -
2496 if (!page_has_buffers(page))
2497 create_empty_buffers(page, 1 << orig_inode->i_blkbits, 0);
2498
2499
2500
2501 From linux@linux.site Thu Dec 10 21:25:53 2009
2502 Message-Id: <20091211052553.196951652@linux.site>
2503 User-Agent: quilt/0.47-14.9
2504 Date: Thu, 10 Dec 2009 21:23:36 -0800
2505 From: Greg KH <gregkh@suse.de>
2506 To: linux-kernel@vger.kernel.org,
2507 stable@kernel.org
2508 Cc: stable-review@kernel.org,
2509 torvalds@linux-foundation.org,
2510 akpm@linux-foundation.org,
2511 alan@lxorguk.ukuu.org.uk,
2512 "Theodore Tso" <tytso@mit.edu>,
2513 Greg Kroah-Hartman <gregkh@suse.de>
2514 Subject: [24/34] jbd2: Add ENOMEM checking in and for jbd2_journal_write_metadata_buffer()
2515 References: <20091211052312.805428372@linux.site>
2516 Content-Disposition: inline; filename=0020-jbd2-Add-ENOMEM-checking-in-and-for-jbd2_journal_wri.patch
2517 Content-Length: 1035
2518 Lines: 38
2519
2520 2.6.32-stable review patch. If anyone has any objections, please let us know.
2521
2522 ------------------
2523
2524 (cherry picked from commit e6ec116b67f46e0e7808276476554727b2e6240b)
2525
2526 OOM happens.
2527
2528 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2529 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2530 ---
2531 fs/jbd2/commit.c | 4 ++++
2532 fs/jbd2/journal.c | 4 ++++
2533 2 files changed, 8 insertions(+)
2534
2535 --- a/fs/jbd2/commit.c
2536 +++ b/fs/jbd2/commit.c
2537 @@ -636,6 +636,10 @@ void jbd2_journal_commit_transaction(jou
2538 JBUFFER_TRACE(jh, "ph3: write metadata");
2539 flags = jbd2_journal_write_metadata_buffer(commit_transaction,
2540 jh, &new_jh, blocknr);
2541 + if (flags < 0) {
2542 + jbd2_journal_abort(journal, flags);
2543 + continue;
2544 + }
2545 set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
2546 wbuf[bufs++] = jh2bh(new_jh);
2547
2548 --- a/fs/jbd2/journal.c
2549 +++ b/fs/jbd2/journal.c
2550 @@ -358,6 +358,10 @@ repeat:
2551
2552 jbd_unlock_bh_state(bh_in);
2553 tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
2554 + if (!tmp) {
2555 + jbd2_journal_put_journal_head(new_jh);
2556 + return -ENOMEM;
2557 + }
2558 jbd_lock_bh_state(bh_in);
2559 if (jh_in->b_frozen_data) {
2560 jbd2_free(tmp, bh_in->b_size);
2561
2562
2563 From linux@linux.site Thu Dec 10 21:25:54 2009
2564 Message-Id: <20091211052553.749907435@linux.site>
2565 User-Agent: quilt/0.47-14.9
2566 Date: Thu, 10 Dec 2009 21:23:37 -0800
2567 From: Greg KH <gregkh@suse.de>
2568 To: linux-kernel@vger.kernel.org,
2569 stable@kernel.org
2570 Cc: stable-review@kernel.org,
2571 torvalds@linux-foundation.org,
2572 akpm@linux-foundation.org,
2573 alan@lxorguk.ukuu.org.uk,
2574 Roel Kluin <roel.kluin@gmail.com>,
2575 "Theodore Tso" <tytso@mit.edu>,
2576 Greg Kroah-Hartman <gregkh@suse.de>
2577 Subject: [25/34] ext4: Return the PTR_ERR of the correct pointer in setup_new_group_blocks()
2578 References: <20091211052312.805428372@linux.site>
2579 Content-Disposition: inline; filename=0021-ext4-Return-the-PTR_ERR-of-the-correct-pointer-in-se.patch
2580 Content-Length: 595
2581 Lines: 21
2582
2583 2.6.32-stable review patch. If anyone has any objections, please let us know.
2584
2585 ------------------
2586
2587 (cherry picked from commit c09eef305dd43846360944ad072f051f964fa383)
2588
2589 Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
2590 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2591 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2592 ---
2593 fs/ext4/resize.c | 2 +-
2594 1 file changed, 1 insertion(+), 1 deletion(-)
2595
2596 --- a/fs/ext4/resize.c
2597 +++ b/fs/ext4/resize.c
2598 @@ -247,7 +247,7 @@ static int setup_new_group_blocks(struct
2599 goto exit_bh;
2600
2601 if (IS_ERR(gdb = bclean(handle, sb, block))) {
2602 - err = PTR_ERR(bh);
2603 + err = PTR_ERR(gdb);
2604 goto exit_bh;
2605 }
2606 ext4_handle_dirty_metadata(handle, NULL, gdb);
2607
2608
2609 From linux@linux.site Thu Dec 10 21:25:54 2009
2610 Message-Id: <20091211052554.355331485@linux.site>
2611 User-Agent: quilt/0.47-14.9
2612 Date: Thu, 10 Dec 2009 21:23:38 -0800
2613 From: Greg KH <gregkh@suse.de>
2614 To: linux-kernel@vger.kernel.org,
2615 stable@kernel.org
2616 Cc: stable-review@kernel.org,
2617 torvalds@linux-foundation.org,
2618 akpm@linux-foundation.org,
2619 alan@lxorguk.ukuu.org.uk,
2620 Jan Kara <jack@suse.cz>,
2621 "Theodore Tso" <tytso@mit.edu>,
2622 Greg Kroah-Hartman <gregkh@suse.de>
2623 Subject: [26/34] ext4: Avoid data / filesystem corruption when write fails to copy data
2624 References: <20091211052312.805428372@linux.site>
2625 Content-Disposition: inline; filename=0022-ext4-Avoid-data-filesystem-corruption-when-write-fai.patch
2626 Content-Length: 2923
2627 Lines: 84
2628
2629 2.6.32-stable review patch. If anyone has any objections, please let us know.
2630
2631 ------------------
2632
2633 (cherry picked from commit b9a4207d5e911b938f73079a83cc2ae10524ec7f)
2634
2635 When ext4_write_begin fails after allocating some blocks or
2636 generic_perform_write fails to copy data to write, we truncate blocks
2637 already instantiated beyond i_size. Although these blocks were never
2638 inside i_size, we have to truncate the pagecache of these blocks so
2639 that corresponding buffers get unmapped. Otherwise subsequent
2640 __block_prepare_write (called because we are retrying the write) will
2641 find the buffers mapped, not call ->get_block, and thus the page will
2642 be backed by already freed blocks leading to filesystem and data
2643 corruption.
2644
2645 Signed-off-by: Jan Kara <jack@suse.cz>
2646 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2647 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2648 ---
2649 fs/ext4/inode.c | 20 +++++++++++++++-----
2650 1 file changed, 15 insertions(+), 5 deletions(-)
2651
2652 --- a/fs/ext4/inode.c
2653 +++ b/fs/ext4/inode.c
2654 @@ -1534,6 +1534,16 @@ static int do_journal_get_write_access(h
2655 return ext4_journal_get_write_access(handle, bh);
2656 }
2657
2658 +/*
2659 + * Truncate blocks that were not used by write. We have to truncate the
2660 + * pagecache as well so that corresponding buffers get properly unmapped.
2661 + */
2662 +static void ext4_truncate_failed_write(struct inode *inode)
2663 +{
2664 + truncate_inode_pages(inode->i_mapping, inode->i_size);
2665 + ext4_truncate(inode);
2666 +}
2667 +
2668 static int ext4_write_begin(struct file *file, struct address_space *mapping,
2669 loff_t pos, unsigned len, unsigned flags,
2670 struct page **pagep, void **fsdata)
2671 @@ -1599,7 +1609,7 @@ retry:
2672
2673 ext4_journal_stop(handle);
2674 if (pos + len > inode->i_size) {
2675 - ext4_truncate(inode);
2676 + ext4_truncate_failed_write(inode);
2677 /*
2678 * If truncate failed early the inode might
2679 * still be on the orphan list; we need to
2680 @@ -1709,7 +1719,7 @@ static int ext4_ordered_write_end(struct
2681 ret = ret2;
2682
2683 if (pos + len > inode->i_size) {
2684 - ext4_truncate(inode);
2685 + ext4_truncate_failed_write(inode);
2686 /*
2687 * If truncate failed early the inode might still be
2688 * on the orphan list; we need to make sure the inode
2689 @@ -1751,7 +1761,7 @@ static int ext4_writeback_write_end(stru
2690 ret = ret2;
2691
2692 if (pos + len > inode->i_size) {
2693 - ext4_truncate(inode);
2694 + ext4_truncate_failed_write(inode);
2695 /*
2696 * If truncate failed early the inode might still be
2697 * on the orphan list; we need to make sure the inode
2698 @@ -1814,7 +1824,7 @@ static int ext4_journalled_write_end(str
2699 if (!ret)
2700 ret = ret2;
2701 if (pos + len > inode->i_size) {
2702 - ext4_truncate(inode);
2703 + ext4_truncate_failed_write(inode);
2704 /*
2705 * If truncate failed early the inode might still be
2706 * on the orphan list; we need to make sure the inode
2707 @@ -3091,7 +3101,7 @@ retry:
2708 * i_size_read because we hold i_mutex.
2709 */
2710 if (pos + len > inode->i_size)
2711 - ext4_truncate(inode);
2712 + ext4_truncate_failed_write(inode);
2713 }
2714
2715 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
2716
2717
2718 From linux@linux.site Thu Dec 10 21:25:55 2009
2719 Message-Id: <20091211052554.925382177@linux.site>
2720 User-Agent: quilt/0.47-14.9
2721 Date: Thu, 10 Dec 2009 21:23:39 -0800
2722 From: Greg KH <gregkh@suse.de>
2723 To: linux-kernel@vger.kernel.org,
2724 stable@kernel.org
2725 Cc: stable-review@kernel.org,
2726 torvalds@linux-foundation.org,
2727 akpm@linux-foundation.org,
2728 alan@lxorguk.ukuu.org.uk,
2729 Josef Bacik <josef@redhat.com>,
2730 "Theodore Tso" <tytso@mit.edu>,
2731 Greg Kroah-Hartman <gregkh@suse.de>
2732 Subject: [27/34] ext4: wait for log to commit when umounting
2733 References: <20091211052312.805428372@linux.site>
2734 Content-Disposition: inline; filename=0023-ext4-wait-for-log-to-commit-when-umounting.patch
2735 Content-Length: 1540
2736 Lines: 46
2737
2738 2.6.32-stable review patch. If anyone has any objections, please let us know.
2739
2740 ------------------
2741
2742 (cherry picked from commit d4edac314e9ad0b21ba20ba8bc61b61f186f79e1)
2743
2744 There is a potential race when a transaction is committing right when
2745 the file system is being umounting. This could reduce in a race
2746 because EXT4_SB(sb)->s_group_info could be freed in ext4_put_super
2747 before the commit code calls a callback so the mballoc code can
2748 release freed blocks in the transaction, resulting in a panic trying
2749 to access the freed s_group_info.
2750
2751 The fix is to wait for the transaction to finish committing before we
2752 shutdown the multiblock allocator.
2753
2754 Signed-off-by: Josef Bacik <josef@redhat.com>
2755 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2756 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2757 ---
2758 fs/ext4/super.c | 10 ++++++----
2759 1 file changed, 6 insertions(+), 4 deletions(-)
2760
2761 --- a/fs/ext4/super.c
2762 +++ b/fs/ext4/super.c
2763 @@ -603,10 +603,6 @@ static void ext4_put_super(struct super_
2764 if (sb->s_dirt)
2765 ext4_commit_super(sb, 1);
2766
2767 - ext4_release_system_zone(sb);
2768 - ext4_mb_release(sb);
2769 - ext4_ext_release(sb);
2770 - ext4_xattr_put_super(sb);
2771 if (sbi->s_journal) {
2772 err = jbd2_journal_destroy(sbi->s_journal);
2773 sbi->s_journal = NULL;
2774 @@ -614,6 +610,12 @@ static void ext4_put_super(struct super_
2775 ext4_abort(sb, __func__,
2776 "Couldn't clean up the journal");
2777 }
2778 +
2779 + ext4_release_system_zone(sb);
2780 + ext4_mb_release(sb);
2781 + ext4_ext_release(sb);
2782 + ext4_xattr_put_super(sb);
2783 +
2784 if (!(sb->s_flags & MS_RDONLY)) {
2785 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
2786 es->s_state = cpu_to_le16(sbi->s_mount_state);
2787
2788
2789 From linux@linux.site Thu Dec 10 21:25:55 2009
2790 Message-Id: <20091211052555.487338959@linux.site>
2791 User-Agent: quilt/0.47-14.9
2792 Date: Thu, 10 Dec 2009 21:23:40 -0800
2793 From: Greg KH <gregkh@suse.de>
2794 To: linux-kernel@vger.kernel.org,
2795 stable@kernel.org
2796 Cc: stable-review@kernel.org,
2797 torvalds@linux-foundation.org,
2798 akpm@linux-foundation.org,
2799 alan@lxorguk.ukuu.org.uk,
2800 Curt Wohlgemuth <curtw@google.com>,
2801 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
2802 "Theodore Tso" <tytso@mit.edu>,
2803 Greg Kroah-Hartman <gregkh@suse.de>
2804 Subject: [28/34] ext4: remove blocks from inode prealloc list on failure
2805 References: <20091211052312.805428372@linux.site>
2806 Content-Disposition: inline; filename=0024-ext4-remove-blocks-from-inode-prealloc-list-on-failu.patch
2807 Content-Length: 1476
2808 Lines: 49
2809
2810 2.6.32-stable review patch. If anyone has any objections, please let us know.
2811
2812 ------------------
2813
2814 (cherry picked from commit b844167edc7fcafda9623955c05e4c1b3c32ebc7)
2815
2816 This fixes a leak of blocks in an inode prealloc list if device failures
2817 cause ext4_mb_mark_diskspace_used() to fail.
2818
2819 Signed-off-by: Curt Wohlgemuth <curtw@google.com>
2820 Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2821 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2822 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2823 ---
2824 fs/ext4/mballoc.c | 19 +++++++++++++++++++
2825 1 file changed, 19 insertions(+)
2826
2827 --- a/fs/ext4/mballoc.c
2828 +++ b/fs/ext4/mballoc.c
2829 @@ -3011,6 +3011,24 @@ static void ext4_mb_collect_stats(struct
2830 }
2831
2832 /*
2833 + * Called on failure; free up any blocks from the inode PA for this
2834 + * context. We don't need this for MB_GROUP_PA because we only change
2835 + * pa_free in ext4_mb_release_context(), but on failure, we've already
2836 + * zeroed out ac->ac_b_ex.fe_len, so group_pa->pa_free is not changed.
2837 + */
2838 +static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
2839 +{
2840 + struct ext4_prealloc_space *pa = ac->ac_pa;
2841 + int len;
2842 +
2843 + if (pa && pa->pa_type == MB_INODE_PA) {
2844 + len = ac->ac_b_ex.fe_len;
2845 + pa->pa_free += len;
2846 + }
2847 +
2848 +}
2849 +
2850 +/*
2851 * use blocks preallocated to inode
2852 */
2853 static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac,
2854 @@ -4295,6 +4313,7 @@ repeat:
2855 ac->ac_status = AC_STATUS_CONTINUE;
2856 goto repeat;
2857 } else if (*errp) {
2858 + ext4_discard_allocated_blocks(ac);
2859 ac->ac_b_ex.fe_len = 0;
2860 ar->len = 0;
2861 ext4_mb_show_ac(ac);
2862
2863
2864 From linux@linux.site Thu Dec 10 21:25:56 2009
2865 Message-Id: <20091211052556.043172197@linux.site>
2866 User-Agent: quilt/0.47-14.9
2867 Date: Thu, 10 Dec 2009 21:23:41 -0800
2868 From: Greg KH <gregkh@suse.de>
2869 To: linux-kernel@vger.kernel.org,
2870 stable@kernel.org
2871 Cc: stable-review@kernel.org,
2872 torvalds@linux-foundation.org,
2873 akpm@linux-foundation.org,
2874 alan@lxorguk.ukuu.org.uk,
2875 Dmitry Monakhov <dmonakhov@openvz.org>,
2876 Mingming Cao <cmm@us.ibm.com>,
2877 "Theodore Tso" <tytso@mit.edu>,
2878 Greg Kroah-Hartman <gregkh@suse.de>
2879 Subject: [29/34] ext4: ext4_get_reserved_space() must return bytes instead of blocks
2880 References: <20091211052312.805428372@linux.site>
2881 Content-Disposition: inline; filename=0025-ext4-ext4_get_reserved_space-must-return-bytes-inste.patch
2882 Content-Length: 718
2883 Lines: 23
2884
2885 2.6.32-stable review patch. If anyone has any objections, please let us know.
2886
2887 ------------------
2888
2889 (cherry picked from commit 8aa6790f876e81f5a2211fe1711a5fe3fe2d7b20)
2890
2891 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
2892 Reviewed-by: Eric Sandeen <sandeen@redhat.com>
2893 Acked-by: Mingming Cao <cmm@us.ibm.com>
2894 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2895 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2896 ---
2897 fs/ext4/inode.c | 2 +-
2898 1 file changed, 1 insertion(+), 1 deletion(-)
2899
2900 --- a/fs/ext4/inode.c
2901 +++ b/fs/ext4/inode.c
2902 @@ -1052,7 +1052,7 @@ qsize_t ext4_get_reserved_space(struct i
2903 EXT4_I(inode)->i_reserved_meta_blocks;
2904 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
2905
2906 - return total;
2907 + return (total << inode->i_blkbits);
2908 }
2909 /*
2910 * Calculate the number of metadata blocks need to reserve
2911
2912
2913 From linux@linux.site Thu Dec 10 21:25:57 2009
2914 Message-Id: <20091211052556.560487193@linux.site>
2915 User-Agent: quilt/0.47-14.9
2916 Date: Thu, 10 Dec 2009 21:23:42 -0800
2917 From: Greg KH <gregkh@suse.de>
2918 To: linux-kernel@vger.kernel.org,
2919 stable@kernel.org
2920 Cc: stable-review@kernel.org,
2921 torvalds@linux-foundation.org,
2922 akpm@linux-foundation.org,
2923 alan@lxorguk.ukuu.org.uk,
2924 Dmitry Monakhov <dmonakhov@openvz.org>,
2925 Mingming Cao <cmm@us.ibm.com>,
2926 "Theodore Tso" <tytso@mit.edu>,
2927 Greg Kroah-Hartman <gregkh@suse.de>
2928 Subject: [30/34] ext4: quota macros cleanup
2929 References: <20091211052312.805428372@linux.site>
2930 Content-Disposition: inline; filename=0026-ext4-quota-macros-cleanup.patch
2931 Content-Length: 5167
2932 Lines: 138
2933
2934 2.6.32-stable review patch. If anyone has any objections, please let us know.
2935
2936 ------------------
2937
2938 (cherry picked from commit 5aca07eb7d8f14d90c740834d15ca15277f4820c)
2939
2940 Currently all quota block reservation macros contains hard-coded "2"
2941 aka MAXQUOTAS value. This is no good because in some places it is not
2942 obvious to understand what does this digit represent. Let's introduce
2943 new macro with self descriptive name.
2944
2945 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
2946 Acked-by: Mingming Cao <cmm@us.ibm.com>
2947 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2948 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2949 ---
2950 fs/ext4/ext4_jbd2.h | 8 ++++++--
2951 fs/ext4/extents.c | 2 +-
2952 fs/ext4/inode.c | 2 +-
2953 fs/ext4/migrate.c | 4 ++--
2954 fs/ext4/namei.c | 8 ++++----
2955 5 files changed, 14 insertions(+), 10 deletions(-)
2956
2957 --- a/fs/ext4/ext4_jbd2.h
2958 +++ b/fs/ext4/ext4_jbd2.h
2959 @@ -49,7 +49,7 @@
2960
2961 #define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
2962 EXT4_XATTR_TRANS_BLOCKS - 2 + \
2963 - 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
2964 + EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
2965
2966 /*
2967 * Define the number of metadata blocks we need to account to modify data.
2968 @@ -57,7 +57,7 @@
2969 * This include super block, inode block, quota blocks and xattr blocks
2970 */
2971 #define EXT4_META_TRANS_BLOCKS(sb) (EXT4_XATTR_TRANS_BLOCKS + \
2972 - 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
2973 + EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
2974
2975 /* Delete operations potentially hit one directory's namespace plus an
2976 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
2977 @@ -92,6 +92,7 @@
2978 * but inode, sb and group updates are done only once */
2979 #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
2980 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
2981 +
2982 #define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
2983 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
2984 #else
2985 @@ -99,6 +100,9 @@
2986 #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
2987 #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
2988 #endif
2989 +#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
2990 +#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
2991 +#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
2992
2993 int
2994 ext4_mark_iloc_dirty(handle_t *handle,
2995 --- a/fs/ext4/extents.c
2996 +++ b/fs/ext4/extents.c
2997 @@ -2167,7 +2167,7 @@ ext4_ext_rm_leaf(handle_t *handle, struc
2998 correct_index = 1;
2999 credits += (ext_depth(inode)) + 1;
3000 }
3001 - credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
3002 + credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
3003
3004 err = ext4_ext_truncate_extend_restart(handle, inode, credits);
3005 if (err)
3006 --- a/fs/ext4/inode.c
3007 +++ b/fs/ext4/inode.c
3008 @@ -5231,7 +5231,7 @@ int ext4_setattr(struct dentry *dentry,
3009
3010 /* (user+group)*(old+new) structure, inode write (sb,
3011 * inode block, ? - but truncate inode update has it) */
3012 - handle = ext4_journal_start(inode, 2*(EXT4_QUOTA_INIT_BLOCKS(inode->i_sb)+
3013 + handle = ext4_journal_start(inode, (EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+
3014 EXT4_QUOTA_DEL_BLOCKS(inode->i_sb))+3);
3015 if (IS_ERR(handle)) {
3016 error = PTR_ERR(handle);
3017 --- a/fs/ext4/migrate.c
3018 +++ b/fs/ext4/migrate.c
3019 @@ -238,7 +238,7 @@ static int extend_credit_for_blkdel(hand
3020 * So allocate a credit of 3. We may update
3021 * quota (user and group).
3022 */
3023 - needed = 3 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
3024 + needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
3025
3026 if (ext4_journal_extend(handle, needed) != 0)
3027 retval = ext4_journal_restart(handle, needed);
3028 @@ -477,7 +477,7 @@ int ext4_ext_migrate(struct inode *inode
3029 handle = ext4_journal_start(inode,
3030 EXT4_DATA_TRANS_BLOCKS(inode->i_sb) +
3031 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
3032 - 2 * EXT4_QUOTA_INIT_BLOCKS(inode->i_sb)
3033 + EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)
3034 + 1);
3035 if (IS_ERR(handle)) {
3036 retval = PTR_ERR(handle);
3037 --- a/fs/ext4/namei.c
3038 +++ b/fs/ext4/namei.c
3039 @@ -1769,7 +1769,7 @@ static int ext4_create(struct inode *dir
3040 retry:
3041 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
3042 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
3043 - 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
3044 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
3045 if (IS_ERR(handle))
3046 return PTR_ERR(handle);
3047
3048 @@ -1803,7 +1803,7 @@ static int ext4_mknod(struct inode *dir,
3049 retry:
3050 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
3051 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
3052 - 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
3053 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
3054 if (IS_ERR(handle))
3055 return PTR_ERR(handle);
3056
3057 @@ -1840,7 +1840,7 @@ static int ext4_mkdir(struct inode *dir,
3058 retry:
3059 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
3060 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
3061 - 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
3062 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
3063 if (IS_ERR(handle))
3064 return PTR_ERR(handle);
3065
3066 @@ -2253,7 +2253,7 @@ static int ext4_symlink(struct inode *di
3067 retry:
3068 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
3069 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 5 +
3070 - 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
3071 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
3072 if (IS_ERR(handle))
3073 return PTR_ERR(handle);
3074
3075
3076
3077 From linux@linux.site Thu Dec 10 21:25:57 2009
3078 Message-Id: <20091211052557.153813326@linux.site>
3079 User-Agent: quilt/0.47-14.9
3080 Date: Thu, 10 Dec 2009 21:23:43 -0800
3081 From: Greg KH <gregkh@suse.de>
3082 To: linux-kernel@vger.kernel.org,
3083 stable@kernel.org
3084 Cc: stable-review@kernel.org,
3085 torvalds@linux-foundation.org,
3086 akpm@linux-foundation.org,
3087 alan@lxorguk.ukuu.org.uk,
3088 Dmitry Monakhov <dmonakhov@openvz.org>,
3089 "Theodore Tso" <tytso@mit.edu>,
3090 Greg Kroah-Hartman <gregkh@suse.de>
3091 Subject: [31/34] ext4: fix incorrect block reservation on quota transfer.
3092 References: <20091211052312.805428372@linux.site>
3093 Content-Disposition: inline; filename=0027-ext4-fix-incorrect-block-reservation-on-quota-transf.patch
3094 Content-Length: 1036
3095 Lines: 27
3096
3097 2.6.32-stable review patch. If anyone has any objections, please let us know.
3098
3099 ------------------
3100
3101 (cherry picked from commit 194074acacebc169ded90a4657193f5180015051)
3102
3103 Inside ->setattr() call both ATTR_UID and ATTR_GID may be valid
3104 This means that we may end-up with transferring all quotas. Add
3105 we have to reserve QUOTA_DEL_BLOCKS for all quotas, as we do in
3106 case of QUOTA_INIT_BLOCKS.
3107
3108 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
3109 Reviewed-by: Mingming Cao <cmm@us.ibm.com>
3110 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
3111 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3112 ---
3113 fs/ext4/inode.c | 2 +-
3114 1 file changed, 1 insertion(+), 1 deletion(-)
3115
3116 --- a/fs/ext4/inode.c
3117 +++ b/fs/ext4/inode.c
3118 @@ -5232,7 +5232,7 @@ int ext4_setattr(struct dentry *dentry,
3119 /* (user+group)*(old+new) structure, inode write (sb,
3120 * inode block, ? - but truncate inode update has it) */
3121 handle = ext4_journal_start(inode, (EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+
3122 - EXT4_QUOTA_DEL_BLOCKS(inode->i_sb))+3);
3123 + EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb))+3);
3124 if (IS_ERR(handle)) {
3125 error = PTR_ERR(handle);
3126 goto err_out;
3127
3128
3129 From linux@linux.site Thu Dec 10 21:25:58 2009
3130 Message-Id: <20091211052557.723287400@linux.site>
3131 User-Agent: quilt/0.47-14.9
3132 Date: Thu, 10 Dec 2009 21:23:44 -0800
3133 From: Greg KH <gregkh@suse.de>
3134 To: linux-kernel@vger.kernel.org,
3135 stable@kernel.org
3136 Cc: stable-review@kernel.org,
3137 torvalds@linux-foundation.org,
3138 akpm@linux-foundation.org,
3139 alan@lxorguk.ukuu.org.uk,
3140 Jan Kara <jack@suse.cz>,
3141 "Theodore Tso" <tytso@mit.edu>,
3142 Greg Kroah-Hartman <gregkh@suse.de>
3143 Subject: [32/34] ext4: Wait for proper transaction commit on fsync
3144 References: <20091211052312.805428372@linux.site>
3145 Content-Disposition: inline; filename=0028-ext4-Wait-for-proper-transaction-commit-on-fsync.patch
3146 Content-Length: 7849
3147 Lines: 252
3148
3149 2.6.32-stable review patch. If anyone has any objections, please let us know.
3150
3151 ------------------
3152
3153 (cherry picked from commit b436b9bef84de6893e86346d8fbf7104bc520645)
3154
3155 We cannot rely on buffer dirty bits during fsync because pdflush can come
3156 before fsync is called and clear dirty bits without forcing a transaction
3157 commit. What we do is that we track which transaction has last changed
3158 the inode and which transaction last changed allocation and force it to
3159 disk on fsync.
3160
3161 Signed-off-by: Jan Kara <jack@suse.cz>
3162 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
3163 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3164 ---
3165 fs/ext4/ext4.h | 7 +++++++
3166 fs/ext4/ext4_jbd2.h | 13 +++++++++++++
3167 fs/ext4/extents.c | 14 ++++++++++++--
3168 fs/ext4/fsync.c | 46 +++++++++++++++++-----------------------------
3169 fs/ext4/inode.c | 29 +++++++++++++++++++++++++++++
3170 fs/ext4/super.c | 2 ++
3171 fs/jbd2/journal.c | 1 +
3172 7 files changed, 81 insertions(+), 31 deletions(-)
3173
3174 --- a/fs/ext4/ext4.h
3175 +++ b/fs/ext4/ext4.h
3176 @@ -703,6 +703,13 @@ struct ext4_inode_info {
3177 struct list_head i_aio_dio_complete_list;
3178 /* current io_end structure for async DIO write*/
3179 ext4_io_end_t *cur_aio_dio;
3180 +
3181 + /*
3182 + * Transactions that contain inode's metadata needed to complete
3183 + * fsync and fdatasync, respectively.
3184 + */
3185 + tid_t i_sync_tid;
3186 + tid_t i_datasync_tid;
3187 };
3188
3189 /*
3190 --- a/fs/ext4/ext4_jbd2.h
3191 +++ b/fs/ext4/ext4_jbd2.h
3192 @@ -258,6 +258,19 @@ static inline int ext4_jbd2_file_inode(h
3193 return 0;
3194 }
3195
3196 +static inline void ext4_update_inode_fsync_trans(handle_t *handle,
3197 + struct inode *inode,
3198 + int datasync)
3199 +{
3200 + struct ext4_inode_info *ei = EXT4_I(inode);
3201 +
3202 + if (ext4_handle_valid(handle)) {
3203 + ei->i_sync_tid = handle->h_transaction->t_tid;
3204 + if (datasync)
3205 + ei->i_datasync_tid = handle->h_transaction->t_tid;
3206 + }
3207 +}
3208 +
3209 /* super.c */
3210 int ext4_force_commit(struct super_block *sb);
3211
3212 --- a/fs/ext4/extents.c
3213 +++ b/fs/ext4/extents.c
3214 @@ -3064,6 +3064,8 @@ ext4_ext_handle_uninitialized_extents(ha
3215 if (flags == EXT4_GET_BLOCKS_DIO_CONVERT_EXT) {
3216 ret = ext4_convert_unwritten_extents_dio(handle, inode,
3217 path);
3218 + if (ret >= 0)
3219 + ext4_update_inode_fsync_trans(handle, inode, 1);
3220 goto out2;
3221 }
3222 /* buffered IO case */
3223 @@ -3091,6 +3093,8 @@ ext4_ext_handle_uninitialized_extents(ha
3224 ret = ext4_ext_convert_to_initialized(handle, inode,
3225 path, iblock,
3226 max_blocks);
3227 + if (ret >= 0)
3228 + ext4_update_inode_fsync_trans(handle, inode, 1);
3229 out:
3230 if (ret <= 0) {
3231 err = ret;
3232 @@ -3329,10 +3333,16 @@ int ext4_ext_get_blocks(handle_t *handle
3233 allocated = ext4_ext_get_actual_len(&newex);
3234 set_buffer_new(bh_result);
3235
3236 - /* Cache only when it is _not_ an uninitialized extent */
3237 - if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0)
3238 + /*
3239 + * Cache the extent and update transaction to commit on fdatasync only
3240 + * when it is _not_ an uninitialized extent.
3241 + */
3242 + if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0) {
3243 ext4_ext_put_in_cache(inode, iblock, allocated, newblock,
3244 EXT4_EXT_CACHE_EXTENT);
3245 + ext4_update_inode_fsync_trans(handle, inode, 1);
3246 + } else
3247 + ext4_update_inode_fsync_trans(handle, inode, 0);
3248 out:
3249 if (allocated > max_blocks)
3250 allocated = max_blocks;
3251 --- a/fs/ext4/fsync.c
3252 +++ b/fs/ext4/fsync.c
3253 @@ -51,25 +51,30 @@
3254 int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
3255 {
3256 struct inode *inode = dentry->d_inode;
3257 + struct ext4_inode_info *ei = EXT4_I(inode);
3258 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
3259 - int err, ret = 0;
3260 + int ret;
3261 + tid_t commit_tid;
3262
3263 J_ASSERT(ext4_journal_current_handle() == NULL);
3264
3265 trace_ext4_sync_file(file, dentry, datasync);
3266
3267 + if (inode->i_sb->s_flags & MS_RDONLY)
3268 + return 0;
3269 +
3270 ret = flush_aio_dio_completed_IO(inode);
3271 if (ret < 0)
3272 return ret;
3273 +
3274 + if (!journal)
3275 + return simple_fsync(file, dentry, datasync);
3276 +
3277 /*
3278 - * data=writeback:
3279 + * data=writeback,ordered:
3280 * The caller's filemap_fdatawrite()/wait will sync the data.
3281 - * sync_inode() will sync the metadata
3282 - *
3283 - * data=ordered:
3284 - * The caller's filemap_fdatawrite() will write the data and
3285 - * sync_inode() will write the inode if it is dirty. Then the caller's
3286 - * filemap_fdatawait() will wait on the pages.
3287 + * Metadata is in the journal, we wait for proper transaction to
3288 + * commit here.
3289 *
3290 * data=journal:
3291 * filemap_fdatawrite won't do anything (the buffers are clean).
3292 @@ -82,27 +87,10 @@ int ext4_sync_file(struct file *file, st
3293 if (ext4_should_journal_data(inode))
3294 return ext4_force_commit(inode->i_sb);
3295
3296 - if (!journal)
3297 - ret = sync_mapping_buffers(inode->i_mapping);
3298 -
3299 - if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
3300 - goto out;
3301 -
3302 - /*
3303 - * The VFS has written the file data. If the inode is unaltered
3304 - * then we need not start a commit.
3305 - */
3306 - if (inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC)) {
3307 - struct writeback_control wbc = {
3308 - .sync_mode = WB_SYNC_ALL,
3309 - .nr_to_write = 0, /* sys_fsync did this */
3310 - };
3311 - err = sync_inode(inode, &wbc);
3312 - if (ret == 0)
3313 - ret = err;
3314 - }
3315 -out:
3316 - if (journal && (journal->j_flags & JBD2_BARRIER))
3317 + commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
3318 + if (jbd2_log_start_commit(journal, commit_tid))
3319 + jbd2_log_wait_commit(journal, commit_tid);
3320 + else if (journal->j_flags & JBD2_BARRIER)
3321 blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
3322 return ret;
3323 }
3324 --- a/fs/ext4/inode.c
3325 +++ b/fs/ext4/inode.c
3326 @@ -1025,6 +1025,8 @@ static int ext4_ind_get_blocks(handle_t
3327 goto cleanup;
3328
3329 set_buffer_new(bh_result);
3330 +
3331 + ext4_update_inode_fsync_trans(handle, inode, 1);
3332 got_it:
3333 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
3334 if (count > blocks_to_boundary)
3335 @@ -4794,6 +4796,7 @@ struct inode *ext4_iget(struct super_blo
3336 struct ext4_inode *raw_inode;
3337 struct ext4_inode_info *ei;
3338 struct inode *inode;
3339 + journal_t *journal = EXT4_SB(sb)->s_journal;
3340 long ret;
3341 int block;
3342
3343 @@ -4858,6 +4861,31 @@ struct inode *ext4_iget(struct super_blo
3344 ei->i_data[block] = raw_inode->i_block[block];
3345 INIT_LIST_HEAD(&ei->i_orphan);
3346
3347 + /*
3348 + * Set transaction id's of transactions that have to be committed
3349 + * to finish f[data]sync. We set them to currently running transaction
3350 + * as we cannot be sure that the inode or some of its metadata isn't
3351 + * part of the transaction - the inode could have been reclaimed and
3352 + * now it is reread from disk.
3353 + */
3354 + if (journal) {
3355 + transaction_t *transaction;
3356 + tid_t tid;
3357 +
3358 + spin_lock(&journal->j_state_lock);
3359 + if (journal->j_running_transaction)
3360 + transaction = journal->j_running_transaction;
3361 + else
3362 + transaction = journal->j_committing_transaction;
3363 + if (transaction)
3364 + tid = transaction->t_tid;
3365 + else
3366 + tid = journal->j_commit_sequence;
3367 + spin_unlock(&journal->j_state_lock);
3368 + ei->i_sync_tid = tid;
3369 + ei->i_datasync_tid = tid;
3370 + }
3371 +
3372 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
3373 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
3374 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
3375 @@ -5112,6 +5140,7 @@ static int ext4_do_update_inode(handle_t
3376 err = rc;
3377 ei->i_state &= ~EXT4_STATE_NEW;
3378
3379 + ext4_update_inode_fsync_trans(handle, inode, 0);
3380 out_brelse:
3381 brelse(bh);
3382 ext4_std_error(inode->i_sb, err);
3383 --- a/fs/ext4/super.c
3384 +++ b/fs/ext4/super.c
3385 @@ -706,6 +706,8 @@ static struct inode *ext4_alloc_inode(st
3386 spin_lock_init(&(ei->i_block_reservation_lock));
3387 INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
3388 ei->cur_aio_dio = NULL;
3389 + ei->i_sync_tid = 0;
3390 + ei->i_datasync_tid = 0;
3391
3392 return &ei->vfs_inode;
3393 }
3394 --- a/fs/jbd2/journal.c
3395 +++ b/fs/jbd2/journal.c
3396 @@ -78,6 +78,7 @@ EXPORT_SYMBOL(jbd2_journal_errno);
3397 EXPORT_SYMBOL(jbd2_journal_ack_err);
3398 EXPORT_SYMBOL(jbd2_journal_clear_err);
3399 EXPORT_SYMBOL(jbd2_log_wait_commit);
3400 +EXPORT_SYMBOL(jbd2_log_start_commit);
3401 EXPORT_SYMBOL(jbd2_journal_start_commit);
3402 EXPORT_SYMBOL(jbd2_journal_force_commit_nested);
3403 EXPORT_SYMBOL(jbd2_journal_wipe);
3404
3405
3406 From linux@linux.site Thu Dec 10 21:25:58 2009
3407 Message-Id: <20091211052558.272572522@linux.site>
3408 User-Agent: quilt/0.47-14.9
3409 Date: Thu, 10 Dec 2009 21:23:45 -0800
3410 From: Greg KH <gregkh@suse.de>
3411 To: linux-kernel@vger.kernel.org,
3412 stable@kernel.org
3413 Cc: stable-review@kernel.org,
3414 torvalds@linux-foundation.org,
3415 akpm@linux-foundation.org,
3416 alan@lxorguk.ukuu.org.uk,
3417 Akira Fujita <a-fujita@rs.jp.nec.com>,
3418 "Theodore Tso" <tytso@mit.edu>,
3419 Greg Kroah-Hartman <gregkh@suse.de>
3420 Subject: [33/34] ext4: Fix insufficient checks in EXT4_IOC_MOVE_EXT
3421 References: <20091211052312.805428372@linux.site>
3422 Content-Disposition: inline; filename=0029-ext4-Fix-insufficient-checks-in-EXT4_IOC_MOVE_EXT.patch
3423 Content-Length: 2732
3424 Lines: 94
3425
3426 2.6.32-stable review patch. If anyone has any objections, please let us know.
3427
3428 ------------------
3429
3430 (cherry picked from commit 4a58579b9e4e2a35d57e6c9c8483e52f6f1b7fd6)
3431
3432 This patch fixes three problems in the handling of the
3433 EXT4_IOC_MOVE_EXT ioctl:
3434
3435 1. In current EXT4_IOC_MOVE_EXT, there are read access mode checks for
3436 original and donor files, but they allow the illegal write access to
3437 donor file, since donor file is overwritten by original file data. To
3438 fix this problem, change access mode checks of original (r->r/w) and
3439 donor (r->w) files.
3440
3441 2. Disallow the use of donor files that have a setuid or setgid bits.
3442
3443 3. Call mnt_want_write() and mnt_drop_write() before and after
3444 ext4_move_extents() calling to get write access to a mount.
3445
3446 Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
3447 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
3448 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3449 ---
3450 fs/ext4/ioctl.c | 30 ++++++++++++++++++------------
3451 fs/ext4/move_extent.c | 7 +++++++
3452 2 files changed, 25 insertions(+), 12 deletions(-)
3453
3454 --- a/fs/ext4/ioctl.c
3455 +++ b/fs/ext4/ioctl.c
3456 @@ -221,32 +221,38 @@ setversion_out:
3457 struct file *donor_filp;
3458 int err;
3459
3460 + if (!(filp->f_mode & FMODE_READ) ||
3461 + !(filp->f_mode & FMODE_WRITE))
3462 + return -EBADF;
3463 +
3464 if (copy_from_user(&me,
3465 (struct move_extent __user *)arg, sizeof(me)))
3466 return -EFAULT;
3467 + me.moved_len = 0;
3468
3469 donor_filp = fget(me.donor_fd);
3470 if (!donor_filp)
3471 return -EBADF;
3472
3473 - if (!capable(CAP_DAC_OVERRIDE)) {
3474 - if ((current->real_cred->fsuid != inode->i_uid) ||
3475 - !(inode->i_mode & S_IRUSR) ||
3476 - !(donor_filp->f_dentry->d_inode->i_mode &
3477 - S_IRUSR)) {
3478 - fput(donor_filp);
3479 - return -EACCES;
3480 - }
3481 + if (!(donor_filp->f_mode & FMODE_WRITE)) {
3482 + err = -EBADF;
3483 + goto mext_out;
3484 }
3485
3486 - me.moved_len = 0;
3487 + err = mnt_want_write(filp->f_path.mnt);
3488 + if (err)
3489 + goto mext_out;
3490 +
3491 err = ext4_move_extents(filp, donor_filp, me.orig_start,
3492 me.donor_start, me.len, &me.moved_len);
3493 - fput(donor_filp);
3494 + mnt_drop_write(filp->f_path.mnt);
3495 + if (me.moved_len > 0)
3496 + file_remove_suid(donor_filp);
3497
3498 if (copy_to_user((struct move_extent *)arg, &me, sizeof(me)))
3499 - return -EFAULT;
3500 -
3501 + err = -EFAULT;
3502 +mext_out:
3503 + fput(donor_filp);
3504 return err;
3505 }
3506
3507 --- a/fs/ext4/move_extent.c
3508 +++ b/fs/ext4/move_extent.c
3509 @@ -957,6 +957,13 @@ mext_check_arguments(struct inode *orig_
3510 return -EINVAL;
3511 }
3512
3513 + if (donor_inode->i_mode & (S_ISUID|S_ISGID)) {
3514 + ext4_debug("ext4 move extent: suid or sgid is set"
3515 + " to donor file [ino:orig %lu, donor %lu]\n",
3516 + orig_inode->i_ino, donor_inode->i_ino);
3517 + return -EINVAL;
3518 + }
3519 +
3520 /* Ext4 move extent does not support swapfile */
3521 if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
3522 ext4_debug("ext4 move extent: The argument files should "
3523
3524
3525 From linux@linux.site Thu Dec 10 21:25:59 2009
3526 Message-Id: <20091211052558.863762484@linux.site>
3527 User-Agent: quilt/0.47-14.9
3528 Date: Thu, 10 Dec 2009 21:23:46 -0800
3529 From: Greg KH <gregkh@suse.de>
3530 To: linux-kernel@vger.kernel.org,
3531 stable@kernel.org
3532 Cc: stable-review@kernel.org,
3533 torvalds@linux-foundation.org,
3534 akpm@linux-foundation.org,
3535 alan@lxorguk.ukuu.org.uk,
3536 "Theodore Tso" <tytso@mit.edu>,
3537 Greg Kroah-Hartman <gregkh@suse.de>
3538 Subject: [34/34] ext4: Fix potential fiemap deadlock (mmap_sem vs. i_data_sem)
3539 References: <20091211052312.805428372@linux.site>
3540 Content-Disposition: inline; filename=0030-ext4-Fix-potential-fiemap-deadlock-mmap_sem-vs.-i_da.patch
3541 Content-Length: 5029
3542 Lines: 115
3543
3544 2.6.32-stable review patch. If anyone has any objections, please let us know.
3545
3546 ------------------
3547
3548 (cherry picked from commit fab3a549e204172236779f502eccb4f9bf0dc87d)
3549
3550 Fix the following potential circular locking dependency between
3551 mm->mmap_sem and ei->i_data_sem:
3552
3553 =======================================================
3554 [ INFO: possible circular locking dependency detected ]
3555 2.6.32-04115-gec044c5 #37
3556 -------------------------------------------------------
3557 ureadahead/1855 is trying to acquire lock:
3558 (&mm->mmap_sem){++++++}, at: [<ffffffff81107224>] might_fault+0x5c/0xac
3559
3560 but task is already holding lock:
3561 (&ei->i_data_sem){++++..}, at: [<ffffffff811be1fd>] ext4_fiemap+0x11b/0x159
3562
3563 which lock already depends on the new lock.
3564
3565 the existing dependency chain (in reverse order) is:
3566
3567 -> #1 (&ei->i_data_sem){++++..}:
3568 [<ffffffff81099bfa>] __lock_acquire+0xb67/0xd0f
3569 [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
3570 [<ffffffff81516633>] down_read+0x51/0x84
3571 [<ffffffff811a2414>] ext4_get_blocks+0x50/0x2a5
3572 [<ffffffff811a3453>] ext4_get_block+0xab/0xef
3573 [<ffffffff81154f39>] do_mpage_readpage+0x198/0x48d
3574 [<ffffffff81155360>] mpage_readpages+0xd0/0x114
3575 [<ffffffff811a104b>] ext4_readpages+0x1d/0x1f
3576 [<ffffffff810f8644>] __do_page_cache_readahead+0x12f/0x1bc
3577 [<ffffffff810f86f2>] ra_submit+0x21/0x25
3578 [<ffffffff810f0cfd>] filemap_fault+0x19f/0x32c
3579 [<ffffffff81107b97>] __do_fault+0x55/0x3a2
3580 [<ffffffff81109db0>] handle_mm_fault+0x327/0x734
3581 [<ffffffff8151aaa9>] do_page_fault+0x292/0x2aa
3582 [<ffffffff81518205>] page_fault+0x25/0x30
3583 [<ffffffff812a34d8>] clear_user+0x38/0x3c
3584 [<ffffffff81167e16>] padzero+0x20/0x31
3585 [<ffffffff81168b47>] load_elf_binary+0x8bc/0x17ed
3586 [<ffffffff81130e95>] search_binary_handler+0xc2/0x259
3587 [<ffffffff81166d64>] load_script+0x1b8/0x1cc
3588 [<ffffffff81130e95>] search_binary_handler+0xc2/0x259
3589 [<ffffffff8113255f>] do_execve+0x1ce/0x2cf
3590 [<ffffffff81027494>] sys_execve+0x43/0x5a
3591 [<ffffffff8102918a>] stub_execve+0x6a/0xc0
3592
3593 -> #0 (&mm->mmap_sem){++++++}:
3594 [<ffffffff81099aa4>] __lock_acquire+0xa11/0xd0f
3595 [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
3596 [<ffffffff81107251>] might_fault+0x89/0xac
3597 [<ffffffff81139382>] fiemap_fill_next_extent+0x95/0xda
3598 [<ffffffff811bcb43>] ext4_ext_fiemap_cb+0x138/0x157
3599 [<ffffffff811be069>] ext4_ext_walk_space+0x178/0x1f1
3600 [<ffffffff811be21e>] ext4_fiemap+0x13c/0x159
3601 [<ffffffff811390e6>] do_vfs_ioctl+0x348/0x4d6
3602 [<ffffffff811392ca>] sys_ioctl+0x56/0x79
3603 [<ffffffff81028cb2>] system_call_fastpath+0x16/0x1b
3604
3605 other info that might help us debug this:
3606
3607 1 lock held by ureadahead/1855:
3608 #0: (&ei->i_data_sem){++++..}, at: [<ffffffff811be1fd>] ext4_fiemap+0x11b/0x159
3609
3610 stack backtrace:
3611 Pid: 1855, comm: ureadahead Not tainted 2.6.32-04115-gec044c5 #37
3612 Call Trace:
3613 [<ffffffff81098c70>] print_circular_bug+0xa8/0xb7
3614 [<ffffffff81099aa4>] __lock_acquire+0xa11/0xd0f
3615 [<ffffffff8102f229>] ? sched_clock+0x9/0xd
3616 [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
3617 [<ffffffff81107224>] ? might_fault+0x5c/0xac
3618 [<ffffffff81107251>] might_fault+0x89/0xac
3619 [<ffffffff81107224>] ? might_fault+0x5c/0xac
3620 [<ffffffff81124b44>] ? __kmalloc+0x13b/0x18c
3621 [<ffffffff81139382>] fiemap_fill_next_extent+0x95/0xda
3622 [<ffffffff811bcb43>] ext4_ext_fiemap_cb+0x138/0x157
3623 [<ffffffff811bca0b>] ? ext4_ext_fiemap_cb+0x0/0x157
3624 [<ffffffff811be069>] ext4_ext_walk_space+0x178/0x1f1
3625 [<ffffffff811be21e>] ext4_fiemap+0x13c/0x159
3626 [<ffffffff81107224>] ? might_fault+0x5c/0xac
3627 [<ffffffff811390e6>] do_vfs_ioctl+0x348/0x4d6
3628 [<ffffffff8129f6d0>] ? __up_read+0x8d/0x95
3629 [<ffffffff81517fb5>] ? retint_swapgs+0x13/0x1b
3630 [<ffffffff811392ca>] sys_ioctl+0x56/0x79
3631 [<ffffffff81028cb2>] system_call_fastpath+0x16/0x1b
3632
3633 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
3634 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3635 ---
3636 fs/ext4/extents.c | 4 ++--
3637 1 file changed, 2 insertions(+), 2 deletions(-)
3638
3639 --- a/fs/ext4/extents.c
3640 +++ b/fs/ext4/extents.c
3641 @@ -1761,7 +1761,9 @@ int ext4_ext_walk_space(struct inode *in
3642 while (block < last && block != EXT_MAX_BLOCK) {
3643 num = last - block;
3644 /* find extent for this block */
3645 + down_read(&EXT4_I(inode)->i_data_sem);
3646 path = ext4_ext_find_extent(inode, block, path);
3647 + up_read(&EXT4_I(inode)->i_data_sem);
3648 if (IS_ERR(path)) {
3649 err = PTR_ERR(path);
3650 path = NULL;
3651 @@ -3730,10 +3732,8 @@ int ext4_fiemap(struct inode *inode, str
3652 * Walk the extent tree gathering extent information.
3653 * ext4_ext_fiemap_cb will push extents back to user.
3654 */
3655 - down_read(&EXT4_I(inode)->i_data_sem);
3656 error = ext4_ext_walk_space(inode, start_blk, len_blks,
3657 ext4_ext_fiemap_cb, fieinfo);
3658 - up_read(&EXT4_I(inode)->i_data_sem);
3659 }
3660
3661 return error;
3662
3663
3664 From linux@linux.site Thu Dec 10 21:25:40 2009
3665 Message-Id: <20091211052312.805428372@linux.site>
3666 User-Agent: quilt/0.47-14.9
3667 Date: Thu, 10 Dec 2009 21:23:12 -0800
3668 From: Greg KH <gregkh@suse.de>
3669 To: linux-kernel@vger.kernel.org,
3670 stable@kernel.org
3671 Cc: stable-review@kernel.org,
3672 torvalds@linux-foundation.org,
3673 akpm@linux-foundation.org,
3674 alan@lxorguk.ukuu.org.uk
3675 Subject: [00/34] 2.6.32.1-stable review
3676 Content-Length: 2372
3677 Lines: 51
3678
3679 This is the start of the stable review cycle for the 2.6.32.1 release.
3680 There are 34 patches in this series, all will be posted as a response to
3681 this one. If anyone has any issues with these being applied, please let
3682 us know. If anyone is a maintainer of the proper subsystem, and wants
3683 to add a Signed-off-by: line to the patch, please respond with it.
3684
3685 As was done with the 2.6.31.8-rc1 release, this is not all of the
3686 patches in the -stable queue, just a huge chunk of ext4 patches here,
3687 and a few scsi ones, which should all get out sooner rather than later.
3688 So note that there will be more 2.6.32-stable releases coming, this is
3689 just the first in the series.
3690
3691 Responses should be made by Sunday, Dec 13 04:00:00 UTC 2009
3692 Anything received after that time might be too late.
3693
3694 The whole patch series can be found in one patch at:
3695 kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.32.1-rc1.gz
3696 and the diffstat can be found below.
3697
3698 thanks,
3699
3700 greg k-h
3701
3702 Documentation/filesystems/ext4.txt | 10 +-
3703 Makefile | 2 +-
3704 drivers/scsi/hosts.c | 13 ++-
3705 drivers/scsi/lpfc/lpfc_init.c | 2 +-
3706 drivers/scsi/megaraid/megaraid_sas.c | 8 +-
3707 drivers/scsi/qla2xxx/qla_attr.c | 3 +-
3708 drivers/scsi/scsi_lib_dma.c | 4 +-
3709 fs/ext4/balloc.c | 8 +-
3710 fs/ext4/block_validity.c | 2 +-
3711 fs/ext4/ext4.h | 8 +
3712 fs/ext4/ext4_jbd2.h | 21 +++-
3713 fs/ext4/extents.c | 22 ++-
3714 fs/ext4/fsync.c | 54 +++----
3715 fs/ext4/inode.c | 81 +++++++---
3716 fs/ext4/ioctl.c | 29 +++--
3717 fs/ext4/mballoc.c | 40 ++++-
3718 fs/ext4/migrate.c | 4 +-
3719 fs/ext4/move_extent.c | 278 ++++++++++++++++------------------
3720 fs/ext4/namei.c | 38 ++---
3721 fs/ext4/resize.c | 2 +-
3722 fs/ext4/super.c | 40 ++++--
3723 fs/ext4/xattr.c | 7 +-
3724 fs/jbd2/commit.c | 4 +
3725 fs/jbd2/journal.c | 5 +
3726 include/linux/sched.h | 13 ++-
3727 include/scsi/osd_protocol.h | 1 +
3728 include/scsi/scsi_host.h | 16 ++-
3729 27 files changed, 424 insertions(+), 291 deletions(-)
3730