]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Mar 2016 18:31:23 +0000 (10:31 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Mar 2016 18:31:23 +0000 (10:31 -0800)
added patches:
btrfs-add-missing-brelse-when-superblock-checksum-fails.patch
btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch
btrfs-igrab-inode-in-writepage.patch
btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch

queue-3.10/btrfs-add-missing-brelse-when-superblock-checksum-fails.patch [new file with mode: 0644]
queue-3.10/btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch [new file with mode: 0644]
queue-3.10/btrfs-igrab-inode-in-writepage.patch [new file with mode: 0644]
queue-3.10/btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/btrfs-add-missing-brelse-when-superblock-checksum-fails.patch b/queue-3.10/btrfs-add-missing-brelse-when-superblock-checksum-fails.patch
new file mode 100644 (file)
index 0000000..462df73
--- /dev/null
@@ -0,0 +1,32 @@
+From b2acdddfad13c38a1e8b927d83c3cf321f63601a Mon Sep 17 00:00:00 2001
+From: Anand Jain <anand.jain@oracle.com>
+Date: Wed, 7 Oct 2015 17:23:23 +0800
+Subject: Btrfs: add missing brelse when superblock checksum fails
+
+From: Anand Jain <anand.jain@oracle.com>
+
+commit b2acdddfad13c38a1e8b927d83c3cf321f63601a upstream.
+
+Looks like oversight, call brelse() when checksum fails. Further down the
+code, in the non error path, we do call brelse() and so we don't see
+brelse() in the goto error paths.
+
+Signed-off-by: Anand Jain <anand.jain@oracle.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/disk-io.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/btrfs/disk-io.c
++++ b/fs/btrfs/disk-io.c
+@@ -2437,6 +2437,7 @@ int open_ctree(struct super_block *sb,
+                      "unsupported option features (%Lx).\n",
+                      (unsigned long long)features);
+               err = -EINVAL;
++              brelse(bh);
+               goto fail_alloc;
+       }
diff --git a/queue-3.10/btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch b/queue-3.10/btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch
new file mode 100644 (file)
index 0000000..f6e0de8
--- /dev/null
@@ -0,0 +1,36 @@
+From 9269d12b2d57d9e3d13036bb750762d1110d425c Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Thu, 31 Dec 2015 18:16:29 +0000
+Subject: Btrfs: fix number of transaction units required to create symlink
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit 9269d12b2d57d9e3d13036bb750762d1110d425c upstream.
+
+We weren't accounting for the insertion of an inline extent item for the
+symlink inode nor that we need to update the parent inode item (through
+the call to btrfs_add_nondir()). So fix this by including two more
+transaction units.
+
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/inode.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -8487,9 +8487,11 @@ static int btrfs_symlink(struct inode *d
+       /*
+        * 2 items for inode item and ref
+        * 2 items for dir items
++       * 1 item for updating parent inode item
++       * 1 item for the inline extent item
+        * 1 item for xattr if selinux is on
+        */
+-      trans = btrfs_start_transaction(root, 5);
++      trans = btrfs_start_transaction(root, 7);
+       if (IS_ERR(trans))
+               return PTR_ERR(trans);
diff --git a/queue-3.10/btrfs-igrab-inode-in-writepage.patch b/queue-3.10/btrfs-igrab-inode-in-writepage.patch
new file mode 100644 (file)
index 0000000..c03d88c
--- /dev/null
@@ -0,0 +1,59 @@
+From be7bd730841e69fe8f70120098596f648cd1f3ff Mon Sep 17 00:00:00 2001
+From: Josef Bacik <jbacik@fb.com>
+Date: Thu, 22 Oct 2015 15:05:09 -0400
+Subject: Btrfs: igrab inode in writepage
+
+From: Josef Bacik <jbacik@fb.com>
+
+commit be7bd730841e69fe8f70120098596f648cd1f3ff upstream.
+
+We hit this panic on a few of our boxes this week where we have an
+ordered_extent with an NULL inode.  We do an igrab() of the inode in writepages,
+but weren't doing it in writepage which can be called directly from the VM on
+dirty pages.  If the inode has been unlinked then we could have I_FREEING set
+which means igrab() would return NULL and we get this panic.  Fix this by trying
+to igrab in btrfs_writepage, and if it returns NULL then just redirty the page
+and return AOP_WRITEPAGE_ACTIVATE; so the VM knows it wasn't successful.  Thanks,
+
+Signed-off-by: Josef Bacik <jbacik@fb.com>
+Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/inode.c |   17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -7477,15 +7477,28 @@ int btrfs_readpage(struct file *file, st
+ static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
+ {
+       struct extent_io_tree *tree;
+-
++      struct inode *inode = page->mapping->host;
++      int ret;
+       if (current->flags & PF_MEMALLOC) {
+               redirty_page_for_writepage(wbc, page);
+               unlock_page(page);
+               return 0;
+       }
++
++      /*
++       * If we are under memory pressure we will call this directly from the
++       * VM, we need to make sure we have the inode referenced for the ordered
++       * extent.  If not just return like we didn't do anything.
++       */
++      if (!igrab(inode)) {
++              redirty_page_for_writepage(wbc, page);
++              return AOP_WRITEPAGE_ACTIVATE;
++      }
+       tree = &BTRFS_I(page->mapping->host)->io_tree;
+-      return extent_write_full_page(tree, page, btrfs_get_extent, wbc);
++      ret = extent_write_full_page(tree, page, btrfs_get_extent, wbc);
++      btrfs_add_delayed_iput(inode);
++      return ret;
+ }
+ static int btrfs_writepages(struct address_space *mapping,
diff --git a/queue-3.10/btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch b/queue-3.10/btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch
new file mode 100644 (file)
index 0000000..39b554d
--- /dev/null
@@ -0,0 +1,61 @@
+From a879719b8c90e15c9e7fa7266d5e3c0ca962f9df Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Thu, 31 Dec 2015 18:07:59 +0000
+Subject: Btrfs: send, don't BUG_ON() when an empty symlink is found
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit a879719b8c90e15c9e7fa7266d5e3c0ca962f9df upstream.
+
+When a symlink is successfully created it always has an inline extent
+containing the source path. However if an error happens when creating
+the symlink, we can leave in the subvolume's tree a symlink inode without
+any such inline extent item - this happens if after btrfs_symlink() calls
+btrfs_end_transaction() and before it calls the inode eviction handler
+(through the final iput() call), the transaction gets committed and a
+crash happens before the eviction handler gets called, or if a snapshot
+of the subvolume is made before the eviction handler gets called. Sadly
+we can't just avoid this by making btrfs_symlink() call
+btrfs_end_transaction() after it calls the eviction handler, because the
+later can commit the current transaction before it removes any items from
+the subvolume tree (if it encounters ENOSPC errors while reserving space
+for removing all the items).
+
+So make send fail more gracefully, with an -EIO error, and print a
+message to dmesg/syslog informing that there's an empty symlink inode,
+so that the user can delete the empty symlink or do something else
+about it.
+
+Reported-by: Stephen R. van den Berg <srb@cuci.nl>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/send.c |   16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+--- a/fs/btrfs/send.c
++++ b/fs/btrfs/send.c
+@@ -1338,7 +1338,21 @@ static int read_symlink(struct send_ctx
+       ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
+       if (ret < 0)
+               goto out;
+-      BUG_ON(ret);
++      if (ret) {
++              /*
++               * An empty symlink inode. Can happen in rare error paths when
++               * creating a symlink (transaction committed before the inode
++               * eviction handler removed the symlink inode items and a crash
++               * happened in between or the subvol was snapshoted in between).
++               * Print an informative message to dmesg/syslog so that the user
++               * can delete the symlink.
++               */
++              btrfs_err(root->fs_info,
++                        "Found empty symlink inode %llu at root %llu",
++                        ino, root->root_key.objectid);
++              ret = -EIO;
++              goto out;
++      }
+       ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
+                       struct btrfs_file_extent_item);
index 6818b6dc89ad907d46543129411c4bce0ca84fc8..07ff3a1a69592239a6be0136a8dc84be0c1124be 100644 (file)
@@ -44,3 +44,7 @@ rfkill-copy-the-name-into-the-rfkill-struct.patch
 ses-fix-problems-with-simple-enclosures.patch
 ses-fix-additional-element-traversal-bug.patch
 scripts-recordmcount-break-hardlinks.patch
+btrfs-add-missing-brelse-when-superblock-checksum-fails.patch
+btrfs-igrab-inode-in-writepage.patch
+btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch
+btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch