--- /dev/null
+From ec00022030da5761518476096626338bd67df57a Mon Sep 17 00:00:00 2001
+From: Tahsin Erdogan <tahsin@google.com>
+Date: Sat, 5 Aug 2017 22:41:42 -0400
+Subject: ext4: inplace xattr block update fails to deduplicate blocks
+
+From: Tahsin Erdogan <tahsin@google.com>
+
+commit ec00022030da5761518476096626338bd67df57a upstream.
+
+When an xattr block has a single reference, block is updated inplace
+and it is reinserted to the cache. Later, a cache lookup is performed
+to see whether an existing block has the same contents. This cache
+lookup will most of the time return the just inserted entry so
+deduplication is not achieved.
+
+Running the following test script will produce two xattr blocks which
+can be observed in "File ACL: " line of debugfs output:
+
+ mke2fs -b 1024 -I 128 -F -O extent /dev/sdb 1G
+ mount /dev/sdb /mnt/sdb
+
+ touch /mnt/sdb/{x,y}
+
+ setfattr -n user.1 -v aaa /mnt/sdb/x
+ setfattr -n user.2 -v bbb /mnt/sdb/x
+
+ setfattr -n user.1 -v aaa /mnt/sdb/y
+ setfattr -n user.2 -v bbb /mnt/sdb/y
+
+ debugfs -R 'stat x' /dev/sdb | cat
+ debugfs -R 'stat y' /dev/sdb | cat
+
+This patch defers the reinsertion to the cache so that we can locate
+other blocks with the same contents.
+
+Signed-off-by: Tahsin Erdogan <tahsin@google.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Reviewed-by: Andreas Dilger <adilger@dilger.ca>
+Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/xattr.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -828,8 +828,6 @@ ext4_xattr_block_set(handle_t *handle, s
+ if (!IS_LAST_ENTRY(s->first))
+ ext4_xattr_rehash(header(s->base),
+ s->here);
+- ext4_xattr_cache_insert(ext4_mb_cache,
+- bs->bh);
+ }
+ unlock_buffer(bs->bh);
+ if (error == -EFSCORRUPTED)
+@@ -918,6 +916,7 @@ inserted:
+ } else if (bs->bh && s->base == bs->bh->b_data) {
+ /* We were modifying this block in-place. */
+ ea_bdebug(bs->bh, "keeping this block");
++ ext4_xattr_cache_insert(ext4_mb_cache, bs->bh);
+ new_bh = bs->bh;
+ get_bh(new_bh);
+ } else {
--- /dev/null
+From d9ee65539d3eabd9ade46cca1780e3309ad0f907 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Tue, 6 Mar 2018 12:47:08 -0500
+Subject: NFS: Fix an incorrect type in struct nfs_direct_req
+
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+
+commit d9ee65539d3eabd9ade46cca1780e3309ad0f907 upstream.
+
+The start offset needs to be of type loff_t.
+
+Fixed: 5fadeb47dcc5c ("nfs: count DIO good bytes correctly with mirroring")
+Cc: stable@vger.kernel.org # v4.0+
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/direct.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -86,9 +86,9 @@ struct nfs_direct_req {
+ struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX];
+ int mirror_count;
+
++ loff_t io_start; /* Start offset for I/O */
+ ssize_t count, /* bytes actually processed */
+ bytes_left, /* bytes left to be sent */
+- io_start, /* start of IO */
+ error; /* any reported error */
+ struct completion completion; /* wait for i/o completion */
+
--- /dev/null
+From 063b36d6b0ad74c748d536f5cb47bac2f850a0fa Mon Sep 17 00:00:00 2001
+From: Quinn Tran <quinn.tran@cavium.com>
+Date: Mon, 4 Dec 2017 14:45:10 -0800
+Subject: scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
+
+From: Quinn Tran <quinn.tran@cavium.com>
+
+commit 063b36d6b0ad74c748d536f5cb47bac2f850a0fa upstream.
+
+Current code manually allocate an fcport structure that is not properly
+initialize. Replace kzalloc with qla2x00_alloc_fcport, so that all
+fields are initialized. Also set set scan flag to port found
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
+Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/qla2xxx/qla_target.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/qla2xxx/qla_target.c
++++ b/drivers/scsi/qla2xxx/qla_target.c
+@@ -5502,7 +5502,7 @@ static fc_port_t *qlt_get_port_database(
+ fc_port_t *fcport;
+ int rc;
+
+- fcport = kzalloc(sizeof(*fcport), GFP_KERNEL);
++ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
+ if (!fcport) {
+ ql_dbg(ql_dbg_tgt_mgt, vha, 0xf06f,
+ "qla_target(%d): Allocation of tmp FC port failed",
netfilter-x_tables-pass-xt_counters-struct-instead-of-packet-counter.patch
netfilter-x_tables-pass-xt_counters-struct-to-counter-allocator.patch
netfilter-x_tables-pack-percpu-counter-allocations.patch
+ext4-inplace-xattr-block-update-fails-to-deduplicate-blocks.patch
+ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch
+scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch
+nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch
--- /dev/null
+From a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 Mon Sep 17 00:00:00 2001
+From: Clay McClure <clay@daemons.net>
+Date: Thu, 21 Sep 2017 19:01:34 -0700
+Subject: ubi: Fix race condition between ubi volume creation and udev
+
+From: Clay McClure <clay@daemons.net>
+
+commit a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 upstream.
+
+Similar to commit 714fb87e8bc0 ("ubi: Fix race condition between ubi
+device creation and udev"), we should make the volume active before
+registering it.
+
+Signed-off-by: Clay McClure <clay@daemons.net>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/vmt.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/mtd/ubi/vmt.c
++++ b/drivers/mtd/ubi/vmt.c
+@@ -265,6 +265,12 @@ int ubi_create_volume(struct ubi_device
+ vol->last_eb_bytes = vol->usable_leb_size;
+ }
+
++ /* Make volume "available" before it becomes accessible via sysfs */
++ spin_lock(&ubi->volumes_lock);
++ ubi->volumes[vol_id] = vol;
++ ubi->vol_count += 1;
++ spin_unlock(&ubi->volumes_lock);
++
+ /* Register character device for the volume */
+ cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
+ vol->cdev.owner = THIS_MODULE;
+@@ -304,11 +310,6 @@ int ubi_create_volume(struct ubi_device
+ if (err)
+ goto out_sysfs;
+
+- spin_lock(&ubi->volumes_lock);
+- ubi->volumes[vol_id] = vol;
+- ubi->vol_count += 1;
+- spin_unlock(&ubi->volumes_lock);
+-
+ ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED);
+ self_check_volumes(ubi);
+ return err;
+@@ -328,6 +329,10 @@ out_sysfs:
+ out_cdev:
+ cdev_del(&vol->cdev);
+ out_mapping:
++ spin_lock(&ubi->volumes_lock);
++ ubi->volumes[vol_id] = NULL;
++ ubi->vol_count -= 1;
++ spin_unlock(&ubi->volumes_lock);
+ if (do_free)
+ kfree(vol->eba_tbl);
+ out_acc: