From: Greg Kroah-Hartman Date: Tue, 13 Mar 2018 14:19:07 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.14.27~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d7f9d2b3488e324c546bec98a9bd916efead049;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: ext4-inplace-xattr-block-update-fails-to-deduplicate-blocks.patch nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch --- diff --git a/queue-4.4/ext4-inplace-xattr-block-update-fails-to-deduplicate-blocks.patch b/queue-4.4/ext4-inplace-xattr-block-update-fails-to-deduplicate-blocks.patch new file mode 100644 index 00000000000..e4ff0867dad --- /dev/null +++ b/queue-4.4/ext4-inplace-xattr-block-update-fails-to-deduplicate-blocks.patch @@ -0,0 +1,64 @@ +From ec00022030da5761518476096626338bd67df57a Mon Sep 17 00:00:00 2001 +From: Tahsin Erdogan +Date: Sat, 5 Aug 2017 22:41:42 -0400 +Subject: ext4: inplace xattr block update fails to deduplicate blocks + +From: Tahsin Erdogan + +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 +Signed-off-by: Theodore Ts'o +Reviewed-by: Andreas Dilger +Signed-off-by: Tommi Rantala +Signed-off-by: Greg Kroah-Hartman + +--- + 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 { diff --git a/queue-4.4/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch b/queue-4.4/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch new file mode 100644 index 00000000000..42f74d86b75 --- /dev/null +++ b/queue-4.4/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch @@ -0,0 +1,33 @@ +From d9ee65539d3eabd9ade46cca1780e3309ad0f907 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Tue, 6 Mar 2018 12:47:08 -0500 +Subject: NFS: Fix an incorrect type in struct nfs_direct_req + +From: Trond Myklebust + +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 +Signed-off-by: Greg Kroah-Hartman + +--- + 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 */ + diff --git a/queue-4.4/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch b/queue-4.4/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch new file mode 100644 index 00000000000..f60c97b8ffd --- /dev/null +++ b/queue-4.4/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch @@ -0,0 +1,35 @@ +From 063b36d6b0ad74c748d536f5cb47bac2f850a0fa Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:10 -0800 +Subject: scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport + +From: Quinn Tran + +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: +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + 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", diff --git a/queue-4.4/series b/queue-4.4/series index 96ed93bf0b8..b9a0f7fcd3d 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -42,3 +42,7 @@ netfilter-use-skb_to_full_sk-in-ip_route_me_harder.patch 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 diff --git a/queue-4.4/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch b/queue-4.4/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch new file mode 100644 index 00000000000..29424867d3e --- /dev/null +++ b/queue-4.4/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch @@ -0,0 +1,60 @@ +From a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 Mon Sep 17 00:00:00 2001 +From: Clay McClure +Date: Thu, 21 Sep 2017 19:01:34 -0700 +Subject: ubi: Fix race condition between ubi volume creation and udev + +From: Clay McClure + +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 +Cc: +Signed-off-by: Richard Weinberger +Signed-off-by: Greg Kroah-Hartman + +--- + 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: