aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-24 01:48:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-24 01:48:48 -0400
commit63c04ee7d3b7c8d8e2726cb7c5f8a5f6fcc1e3b2 (patch)
tree8ead21ef2c7e84bcd30511d50925416018abd93e /fs
parent0bf0ea431f84bcf34facc5b1f792d000f5957565 (diff)
parent4ac1c17b2044a1b4b2fbed74451947e905fc2992 (diff)
Merge tag 'upstream-4.7-rc5' of git://git.infradead.org/linux-ubifs
Pull UBI/UBIFS fixes from Richard Weinberger: "This contains fixes for two critical bugs in UBI and UBIFS: - fix the possibility of losing data upon a power cut when UBI tries to recover from a write error - fix page migration on UBIFS. It turned out that the default page migration function is not suitable for UBIFS" * tag 'upstream-4.7-rc5' of git://git.infradead.org/linux-ubifs: UBIFS: Implement ->migratepage() mm: Export migrate_page_move_mapping and migrate_page_copy ubi: Make recover_peb power cut aware gpio: make library immune to error pointers gpio: make sure gpiod_to_irq() returns negative on NULL desc gpio: 104-idi-48: Fix missing spin_lock_init for ack_lock
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/file.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 08316972ff93..7bbf420d1289 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -52,6 +52,7 @@
52#include "ubifs.h" 52#include "ubifs.h"
53#include <linux/mount.h> 53#include <linux/mount.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/migrate.h>
55 56
56static int read_block(struct inode *inode, void *addr, unsigned int block, 57static int read_block(struct inode *inode, void *addr, unsigned int block,
57 struct ubifs_data_node *dn) 58 struct ubifs_data_node *dn)
@@ -1452,6 +1453,26 @@ static int ubifs_set_page_dirty(struct page *page)
1452 return ret; 1453 return ret;
1453} 1454}
1454 1455
1456#ifdef CONFIG_MIGRATION
1457static int ubifs_migrate_page(struct address_space *mapping,
1458 struct page *newpage, struct page *page, enum migrate_mode mode)
1459{
1460 int rc;
1461
1462 rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
1463 if (rc != MIGRATEPAGE_SUCCESS)
1464 return rc;
1465
1466 if (PagePrivate(page)) {
1467 ClearPagePrivate(page);
1468 SetPagePrivate(newpage);
1469 }
1470
1471 migrate_page_copy(newpage, page);
1472 return MIGRATEPAGE_SUCCESS;
1473}
1474#endif
1475
1455static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) 1476static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
1456{ 1477{
1457 /* 1478 /*
@@ -1591,6 +1612,9 @@ const struct address_space_operations ubifs_file_address_operations = {
1591 .write_end = ubifs_write_end, 1612 .write_end = ubifs_write_end,
1592 .invalidatepage = ubifs_invalidatepage, 1613 .invalidatepage = ubifs_invalidatepage,
1593 .set_page_dirty = ubifs_set_page_dirty, 1614 .set_page_dirty = ubifs_set_page_dirty,
1615#ifdef CONFIG_MIGRATION
1616 .migratepage = ubifs_migrate_page,
1617#endif
1594 .releasepage = ubifs_releasepage, 1618 .releasepage = ubifs_releasepage,
1595}; 1619};
1596 1620