--- /dev/null
+From 41b0fc42800569f63e029549b75c4c9cb63f2dfd Mon Sep 17 00:00:00 2001
+From: Josef Bacik <jbacik@fusionio.com>
+Date: Mon, 1 Apr 2013 20:36:28 -0400
+Subject: Btrfs: compare relevant parts of delayed tree refs
+
+From: Josef Bacik <jbacik@fusionio.com>
+
+commit 41b0fc42800569f63e029549b75c4c9cb63f2dfd upstream.
+
+A user reported a panic while running a balance. What was happening was he was
+relocating a block, which added the reference to the relocation tree. Then
+relocation would walk through the relocation tree and drop that reference and
+free that block, and then it would walk down a snapshot which referenced the
+same block and add another ref to the block. The problem is this was all
+happening in the same transaction, so the parent block was free'ed up when we
+drop our reference which was immediately available for allocation, and then it
+was used _again_ to add a reference for the same block from a different
+snapshot. This resulted in something like this in the delayed ref tree
+
+add ref to 90234880, parent=2067398656, ref_root 1766, level 1
+del ref to 90234880, parent=2067398656, ref_root 18446744073709551608, level 1
+add ref to 90234880, parent=2067398656, ref_root 1767, level 1
+
+as you can see the ref_root's don't match, because when we inc the ref we use
+the header owner, which is the original tree the block belonged to, instead of
+the data reloc tree. Then when we remove the extent we use the reloc tree
+objectid. But none of this matters, since it is a shared reference which means
+only the parent matters. When the delayed ref stuff runs it adds all the
+increments first, and then does all the drops, to make sure that we don't delete
+the ref if we net a positive ref count. But tree blocks aren't allowed to have
+multiple refs from the same block, so this panics when it tries to add the
+second ref. We need the add and the drop to cancel each other out in memory so
+we only do the final add.
+
+So to fix this we need to adjust how the delayed refs are added to the tree.
+Only the ref_root matters when it is a normal backref, and only the parent
+matters when it is a shared backref. So make our decision based on what ref
+type we have. This allows us to keep the ref_root in memory in case anybody
+wants to use it for something else, and it allows the delayed refs to be merged
+properly so we don't end up with this panic.
+
+With this patch the users image no longer panics on mount, and it has a clean
+fsck after a normal mount/umount cycle. Thanks,
+
+Reported-by: Roman Mamedov <rm@romanrm.ru>
+Signed-off-by: Josef Bacik <jbacik@fusionio.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/delayed-ref.c | 24 ++++++++++++++----------
+ 1 file changed, 14 insertions(+), 10 deletions(-)
+
+--- a/fs/btrfs/delayed-ref.c
++++ b/fs/btrfs/delayed-ref.c
+@@ -40,16 +40,19 @@ struct kmem_cache *btrfs_delayed_extent_
+ * compare two delayed tree backrefs with same bytenr and type
+ */
+ static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2,
+- struct btrfs_delayed_tree_ref *ref1)
++ struct btrfs_delayed_tree_ref *ref1, int type)
+ {
+- if (ref1->root < ref2->root)
+- return -1;
+- if (ref1->root > ref2->root)
+- return 1;
+- if (ref1->parent < ref2->parent)
+- return -1;
+- if (ref1->parent > ref2->parent)
+- return 1;
++ if (type == BTRFS_TREE_BLOCK_REF_KEY) {
++ if (ref1->root < ref2->root)
++ return -1;
++ if (ref1->root > ref2->root)
++ return 1;
++ } else {
++ if (ref1->parent < ref2->parent)
++ return -1;
++ if (ref1->parent > ref2->parent)
++ return 1;
++ }
+ return 0;
+ }
+
+@@ -113,7 +116,8 @@ static int comp_entry(struct btrfs_delay
+ if (ref1->type == BTRFS_TREE_BLOCK_REF_KEY ||
+ ref1->type == BTRFS_SHARED_BLOCK_REF_KEY) {
+ return comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref2),
+- btrfs_delayed_node_to_tree_ref(ref1));
++ btrfs_delayed_node_to_tree_ref(ref1),
++ ref1->type);
+ } else if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY ||
+ ref1->type == BTRFS_SHARED_DATA_REF_KEY) {
+ return comp_data_refs(btrfs_delayed_node_to_data_ref(ref2),
--- /dev/null
+From eb384b55ae9c2055ea00c5cc87971e182d47aefa Mon Sep 17 00:00:00 2001
+From: Josef Bacik <jbacik@fusionio.com>
+Date: Wed, 24 Apr 2013 16:32:55 -0400
+Subject: Btrfs: fix extent logging with O_DIRECT into prealloc
+
+From: Josef Bacik <jbacik@fusionio.com>
+
+commit eb384b55ae9c2055ea00c5cc87971e182d47aefa upstream.
+
+This is the same as the fix from commit
+
+Btrfs: fix bad extent logging
+
+but for O_DIRECT. I missed this when I fixed the problem originally, we were
+still using the em for the orig_start and orig_block_len, which would be the
+merged extent. We need to use the actual extent from the on disk file extent
+item, which we have to lookup to make sure it's ok to nocow anyway so just pass
+in some pointers to hold this info. Thanks,
+
+Signed-off-by: Josef Bacik <jbacik@fusionio.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/inode.c | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -6502,7 +6502,9 @@ out:
+ * block must be cow'd
+ */
+ static noinline int can_nocow_odirect(struct btrfs_trans_handle *trans,
+- struct inode *inode, u64 offset, u64 len)
++ struct inode *inode, u64 offset, u64 *len,
++ u64 *orig_start, u64 *orig_block_len,
++ u64 *ram_bytes)
+ {
+ struct btrfs_path *path;
+ int ret;
+@@ -6559,8 +6561,12 @@ static noinline int can_nocow_odirect(st
+ disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
+ backref_offset = btrfs_file_extent_offset(leaf, fi);
+
++ *orig_start = key.offset - backref_offset;
++ *orig_block_len = btrfs_file_extent_disk_num_bytes(leaf, fi);
++ *ram_bytes = btrfs_file_extent_ram_bytes(leaf, fi);
++
+ extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi);
+- if (extent_end < offset + len) {
++ if (extent_end < offset + *len) {
+ /* extent doesn't include our full range, must cow */
+ goto out;
+ }
+@@ -6584,13 +6590,14 @@ static noinline int can_nocow_odirect(st
+ */
+ disk_bytenr += backref_offset;
+ disk_bytenr += offset - key.offset;
+- num_bytes = min(offset + len, extent_end) - offset;
++ num_bytes = min(offset + *len, extent_end) - offset;
+ if (csum_exist_in_range(root, disk_bytenr, num_bytes))
+ goto out;
+ /*
+ * all of the above have passed, it is safe to overwrite this extent
+ * without cow
+ */
++ *len = num_bytes;
+ ret = 1;
+ out:
+ btrfs_free_path(path);
+@@ -6789,7 +6796,7 @@ static int btrfs_get_blocks_direct(struc
+ em->block_start != EXTENT_MAP_HOLE)) {
+ int type;
+ int ret;
+- u64 block_start;
++ u64 block_start, orig_start, orig_block_len, ram_bytes;
+
+ if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
+ type = BTRFS_ORDERED_PREALLOC;
+@@ -6807,10 +6814,8 @@ static int btrfs_get_blocks_direct(struc
+ if (IS_ERR(trans))
+ goto must_cow;
+
+- if (can_nocow_odirect(trans, inode, start, len) == 1) {
+- u64 orig_start = em->orig_start;
+- u64 orig_block_len = em->orig_block_len;
+-
++ if (can_nocow_odirect(trans, inode, start, &len, &orig_start,
++ &orig_block_len, &ram_bytes) == 1) {
+ if (type == BTRFS_ORDERED_PREALLOC) {
+ free_extent_map(em);
+ em = create_pinned_em(inode, start, len,
--- /dev/null
+From c8c64d165ccfd2274058ac84e0c680f9b48c4ec1 Mon Sep 17 00:00:00 2001
+From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
+Date: Tue, 30 Apr 2013 15:17:16 +0530
+Subject: EDAC: Don't give write permission to read-only files
+
+From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
+
+commit c8c64d165ccfd2274058ac84e0c680f9b48c4ec1 upstream.
+
+I get the following warning on boot:
+
+------------[ cut here ]------------
+WARNING: at drivers/base/core.c:575 device_create_file+0x9a/0xa0()
+Hardware name: -[8737R2A]-
+Write permission without 'store'
+...
+</snip>
+
+Drilling down, this is related to dynamic channel ce_count attribute
+files sporting a S_IWUSR mode without a ->store() function. Looking
+around, it appears that they aren't supposed to have a ->store()
+function. So remove the bogus write permission to get rid of the
+warning.
+
+Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
+Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
+[ shorten commit message ]
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/edac/edac_mc_sysfs.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/edac/edac_mc_sysfs.c
++++ b/drivers/edac/edac_mc_sysfs.c
+@@ -327,17 +327,17 @@ static struct device_attribute *dynamic_
+ };
+
+ /* possible dynamic channel ce_count attribute files */
+-DEVICE_CHANNEL(ch0_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch0_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 0);
+-DEVICE_CHANNEL(ch1_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch1_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 1);
+-DEVICE_CHANNEL(ch2_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch2_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 2);
+-DEVICE_CHANNEL(ch3_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch3_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 3);
+-DEVICE_CHANNEL(ch4_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch4_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 4);
+-DEVICE_CHANNEL(ch5_ce_count, S_IRUGO | S_IWUSR,
++DEVICE_CHANNEL(ch5_ce_count, S_IRUGO,
+ channel_ce_count_show, NULL, 5);
+
+ /* Total possible dynamic ce_count attribute file table */
--- /dev/null
+From 12b2f117f3bf738c1a00a6f64393f1953a740bd4 Mon Sep 17 00:00:00 2001
+From: Chen Gang <gang.chen@asianux.com>
+Date: Mon, 29 Apr 2013 15:05:19 -0700
+Subject: kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees()
+
+From: Chen Gang <gang.chen@asianux.com>
+
+commit 12b2f117f3bf738c1a00a6f64393f1953a740bd4 upstream.
+
+audit_trim_trees() calls get_tree(). If a failure occurs we must call
+put_tree().
+
+[akpm@linux-foundation.org: run put_tree() before mutex_lock() for small scalability improvement]
+Signed-off-by: Chen Gang <gang.chen@asianux.com>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: Eric Paris <eparis@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/audit_tree.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/audit_tree.c
++++ b/kernel/audit_tree.c
+@@ -617,9 +617,9 @@ void audit_trim_trees(void)
+ }
+ spin_unlock(&hash_lock);
+ trim_marked(tree);
+- put_tree(tree);
+ drop_collected_mounts(root_mnt);
+ skip_it:
++ put_tree(tree);
+ mutex_lock(&audit_filter_mutex);
+ }
+ list_del(&cursor);
--- /dev/null
+From c5a2a15f8146fdfe45078df7873a6dc1006b3869 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Tue, 30 Apr 2013 12:43:42 -0400
+Subject: NFSv4.x: Fix handling of partially delegated locks
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit c5a2a15f8146fdfe45078df7873a6dc1006b3869 upstream.
+
+If a NFS client receives a delegation for a file after it has taken
+a lock on that file, we can currently end up in a situation where
+we mistakenly skip unlocking that file.
+
+The following patch swaps an erroneous check in nfs4_proc_unlck for
+whether or not the file has a delegation to one which checks whether
+or not we hold a lock stateid for that file.
+
+Reported-by: Chuck Lever <Chuck.Lever@oracle.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Tested-by: Chuck Lever <Chuck.Lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/nfs4proc.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -4553,9 +4553,9 @@ static int nfs4_proc_unlck(struct nfs4_s
+ if (status != 0)
+ goto out;
+ /* Is this a delegated lock? */
+- if (test_bit(NFS_DELEGATED_STATE, &state->flags))
+- goto out;
+ lsp = request->fl_u.nfs4_fl.owner;
++ if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0)
++ goto out;
+ seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
+ status = -ENOMEM;
+ if (seqid == NULL)
--- /dev/null
+From e253aaf0af51c1e4dc7dd3b26ea8e666bf9a2d8d Mon Sep 17 00:00:00 2001
+From: Yinghai Lu <yinghai@kernel.org>
+Date: Tue, 7 May 2013 14:35:44 -0600
+Subject: PCI: Delay final fixups until resources are assigned
+
+From: Yinghai Lu <yinghai@kernel.org>
+
+commit e253aaf0af51c1e4dc7dd3b26ea8e666bf9a2d8d upstream.
+
+Commit 4f535093cf "PCI: Put pci_dev in device tree as early as possible"
+moved final fixups from pci_bus_add_device() to pci_device_add(). But
+pci_device_add() happens before resource assignment, so BARs may not be
+valid yet.
+
+Typical flow for hot-add:
+
+ pciehp_configure_device
+ pci_scan_slot
+ pci_scan_single_device
+ pci_device_add
+ pci_fixup_device(pci_fixup_final, dev) # previous location
+ # resource assignment happens here
+ pci_bus_add_devices
+ pci_bus_add_device
+ pci_fixup_device(pci_fixup_final, dev) # new location
+
+[bhelgaas: changelog, move fixups to pci_bus_add_device()]
+Reference: https://lkml.kernel.org/r/20130415182614.GB9224@xanatos
+Reported-by: David Bulkow <David.Bulkow@stratus.com>
+Tested-by: David Bulkow <David.Bulkow@stratus.com>
+Signed-off-by: Yinghai Lu <yinghai@kernel.org>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/bus.c | 1 +
+ drivers/pci/probe.c | 1 -
+ 2 files changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pci/bus.c
++++ b/drivers/pci/bus.c
+@@ -174,6 +174,7 @@ int pci_bus_add_device(struct pci_dev *d
+ * Can not put in pci_device_add yet because resources
+ * are not assigned yet for some devices.
+ */
++ pci_fixup_device(pci_fixup_final, dev);
+ pci_create_sysfs_dev_files(dev);
+
+ dev->match_driver = true;
+--- a/drivers/pci/probe.c
++++ b/drivers/pci/probe.c
+@@ -1339,7 +1339,6 @@ void pci_device_add(struct pci_dev *dev,
+ list_add_tail(&dev->bus_list, &bus->devices);
+ up_write(&pci_bus_sem);
+
+- pci_fixup_device(pci_fixup_final, dev);
+ ret = pcibios_add_device(dev);
+ WARN_ON(ret < 0);
+
--- /dev/null
+From 7fdb7846c9ca6fc06e380de0976a1228703b498a Mon Sep 17 00:00:00 2001
+From: Dan Williams <dcbw@redhat.com>
+Date: Mon, 6 May 2013 11:17:37 +0000
+Subject: qmi_wwan/cdc_ether: add device IDs for Dell 5804 (Novatel E371) WWAN card
+
+From: Dan Williams <dcbw@redhat.com>
+
+commit 7fdb7846c9ca6fc06e380de0976a1228703b498a upstream.
+
+A rebranded Novatel E371 for AT&T's LTE bands. qmi_wwan should drive this
+device, while cdc_ether should ignore it. Even though the USB descriptors
+are plain CDC-ETHER that USB interface is a QMI interface.
+
+Signed-off-by: Dan Williams <dcbw@redhat.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/usb/cdc_ether.c | 7 +++++++
+ drivers/net/usb/qmi_wwan.c | 7 +++++++
+ 2 files changed, 14 insertions(+)
+
+--- a/drivers/net/usb/cdc_ether.c
++++ b/drivers/net/usb/cdc_ether.c
+@@ -615,6 +615,13 @@ static const struct usb_device_id produc
+ .driver_info = 0,
+ },
+
++/* Dell Wireless 5804 (Novatel E371) - handled by qmi_wwan */
++{
++ USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, 0x819b, USB_CLASS_COMM,
++ USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
++ .driver_info = 0,
++},
++
+ /* AnyDATA ADU960S - handled by qmi_wwan */
+ {
+ USB_DEVICE_AND_INTERFACE_INFO(0x16d5, 0x650a, USB_CLASS_COMM,
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -496,6 +496,13 @@ static const struct usb_device_id produc
+ USB_CDC_PROTO_NONE),
+ .driver_info = (unsigned long)&qmi_wwan_info,
+ },
++ { /* Dell Wireless 5804 (Novatel E371) */
++ USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x819b,
++ USB_CLASS_COMM,
++ USB_CDC_SUBCLASS_ETHERNET,
++ USB_CDC_PROTO_NONE),
++ .driver_info = (unsigned long)&qmi_wwan_info,
++ },
+ { /* ADU960S */
+ USB_DEVICE_AND_INTERFACE_INFO(0x16d5, 0x650a,
+ USB_CLASS_COMM,
drm-radeon-fix-handling-of-v6-power-tables.patch
drm-tilcdc-fix-an-incorrect-condition.patch
tracing-fix-ftrace_dump.patch
+btrfs-compare-relevant-parts-of-delayed-tree-refs.patch
+btrfs-fix-extent-logging-with-o_direct-into-prealloc.patch
+edac-don-t-give-write-permission-to-read-only-files.patch
+pci-delay-final-fixups-until-resources-are-assigned.patch
+qmi_wwan-cdc_ether-add-device-ids-for-dell-5804-novatel-e371-wwan-card.patch
+nfsv4.x-fix-handling-of-partially-delegated-locks.patch
+kernel-audit_tree.c-tree-will-leak-memory-when-failure-occurs-in-audit_trim_trees.patch