aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>2017-01-20 13:54:36 +0530
committerMartin Jansa <Martin.Jansa@gmail.com>2017-02-13 20:34:30 +0100
commit5ef5025c629b64e2c4d59f73653d8ca44b48e56a (patch)
tree1024a60913b78832812ca00c23e04b4ae007ea2e
parent38e955e3ce9ce2749857e8c3d04962b6cf143aa7 (diff)
downloadmeta-openembedded-contrib-5ef5025c629b64e2c4d59f73653d8ca44b48e56a.tar.gz
iscsitarget: use upstream to build with linux kernel >= 4.3
1. The original patch is at http://launchpadlibrarian.net/227478885/iscsitarget_1.4.20.3+svn502-2ubuntu2_1.4.20.3+svn502-2ubuntu3.diff.gz, those changes were taken using #ifs to allow compilation of iscsitarget package with kernel versions < 4.3. 2. It helps to maintain the patches in future, when iscsitarget is updated. Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch123
1 files changed, 78 insertions, 45 deletions
diff --git a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch b/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch
index 0e8b792af8..bce38baee5 100644
--- a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch
+++ b/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch
@@ -1,75 +1,108 @@
-1. test_bit was used to return true boolean value, if
- BIO_UPTODATE bit of bio->bi_flags is set. But the same
- job can be done by checking bio->bi_error, implemented in
- linux kernel 4.3 and above. If bio->bi_error is set, then
- it denotes error.
+Description: Fix source to compile with 4.3+ kernels
+ commit 4246a0b63bd8f56a1469b12eafeb875b1041a451
+ block: add a bi_error field to struct bio
+ -> Removes BIO_UPTODATE and error argument to bio_endio.
+ commit b54ffb73cadcdcff9cc1ae0e11f502407e3e2e4c
+ block: remove bio_get_nr_vecs()
+ -> Removed that call (always use BIO_MAX_PAGES)
+ commit 676d23690fb62b5d51ba5d659935e9f7d9da9f8e
+ net: Fix use after free by removing length arg from sk_data_ready callbacks.
+ -> Removes len argument from sk_data_ready() callback.
+Author: Stefan Bader <stefan.bader@canonical.com>
-Ref: https://github.com/torvalds/linux/commit/4246a0b63bd8f56a1469b12eafeb875b1041a451
+The original patch is at http://launchpadlibrarian.net/227478885/iscsitarget_1.4.20.3+svn502-2ubuntu2_1.4.20.3+svn502-2ubuntu3.diff.gz,
+those changes were taken using #ifs to allow compilation of iscsitarget
+package with kernel versions < 4.3.
-It solves below build error:
--- snip --
-iscsitarget-1.4.20.3+svn502/kernel/block-io.c:40:19: error: 'BIO_UPTODATE' undeclared (first use in this function)
- error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
--- CUT --
-
-2. bio can always be filled to a maximum value of BIO_MAX_PAGES,
- so no need to check for min value for linux kernel 4.3 and above.
-
-Ref: https://github.com/torvalds/linux/commit/b54ffb73cadcdcff9cc1ae0e11f502407e3e2e4c
-
-It solves below build error:
--- snip --
-iscsitarget-1.4.20.3+svn502/kernel/block-io.c:80:15: error: implicit declaration of function 'bio_get_nr_vecs' [-Werror=implicit-function-declaration]
- max_pages = bio_get_nr_vecs(bio_data->bdev);
--- CUT --
-
-Upstream-Status: Pending
+Upstream-Status: Submitted [http://launchpadlibrarian.net/227478885/iscsitarget_1.4.20.3+svn502-2ubuntu2_1.4.20.3+svn502-2ubuntu3.diff.gz]
Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c iscsitarget-1.4.20.3+svn502/kernel/block-io.c
---- iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c 2016-04-01 09:07:12.891810059 +0530
-+++ iscsitarget-1.4.20.3+svn502/kernel/block-io.c 2016-04-01 09:15:59.076469313 +0530
-@@ -33,7 +33,11 @@ static void blockio_bio_endio(struct bio
+--- iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c 2014-05-06 13:59:55.000000000 -0700
++++ iscsitarget-1.4.20.3+svn502/kernel/block-io.c 2017-01-19 00:46:28.263951115 -0800
+@@ -29,14 +29,23 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
++static void blockio_bio_endio(struct bio *bio)
++#else
+ static void blockio_bio_endio(struct bio *bio, int error)
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
{
struct tio_work *tio_work = bio->bi_private;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
-+ error = bio->bi_error ? -EIO : error;
++ if (bio->bi_error)
++ atomic_set(&tio_work->error, bio->bi_error);
+#else
error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
if (error)
atomic_set(&tio_work->error, error);
-@@ -61,6 +65,10 @@ blockio_make_request(struct iet_volume *
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
+
+ /* If last bio signal completion */
+ if (atomic_dec_and_test(&tio_work->bios_remaining))
+@@ -61,14 +70,20 @@ blockio_make_request(struct iet_volume *
u32 size = tio->size;
u32 tio_index = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
-+ int err = 0;
-+ loff_t ppos = tio->offset;
-+#else
++ int max_pages = bdev_q ? BIO_MAX_PAGES : 1;
++#else
int max_pages = 1;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
int err = 0;
-@@ -69,6 +77,7 @@ blockio_make_request(struct iet_volume *
+ loff_t ppos = tio->offset;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
/* Calculate max_pages for bio_alloc (memory saver) */
if (bdev_q)
max_pages = bio_get_nr_vecs(bio_data->bdev);
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */
tio_work = kzalloc(sizeof (*tio_work), GFP_KERNEL);
if (!tio_work)
-@@ -80,7 +89,11 @@ blockio_make_request(struct iet_volume *
+diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/conn.c iscsitarget-1.4.20.3+svn502/kernel/conn.c
+--- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2017-01-19 00:39:09.737117778 -0800
++++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2017-01-19 00:52:30.037223901 -0800
+@@ -89,13 +89,21 @@ static void iet_state_change(struct sock
+ target->nthread_info.old_state_change(sk);
+ }
- /* Main processing loop, allocate and fill all bios */
- while (size && tio_index < tio->pg_cnt) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
-+ bio = bio_alloc(GFP_KERNEL, BIO_MAX_PAGES);
-+#else
- bio = bio_alloc(GFP_KERNEL, min(max_pages, BIO_MAX_PAGES));
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
- if (!bio) {
- err = -ENOMEM;
- goto out;
++static void iet_data_ready(struct sock *sk)
++#else
+ static void iet_data_ready(struct sock *sk, int len)
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
+ {
+ struct iscsi_conn *conn = sk->sk_user_data;
+ struct iscsi_target *target = conn->session->target;
+
+ nthread_wakeup(target);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
++ target->nthread_info.old_data_ready(sk);
++#else
+ target->nthread_info.old_data_ready(sk, len);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
+ }
+
+ /*
+diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h iscsitarget-1.4.20.3+svn502/kernel/iscsi.h
+--- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h 2014-05-06 13:59:55.000000000 -0700
++++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.h 2017-01-19 00:48:02.102837260 -0800
+@@ -81,7 +81,11 @@ struct network_thread_info {
+ spinlock_t nthread_lock;
+
+ void (*old_state_change)(struct sock *);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
++ void (*old_data_ready)(struct sock *);
++#else
+ void (*old_data_ready)(struct sock *, int);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */
+ void (*old_write_space)(struct sock *);
+ };
+