public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PULL] bcache updates based on git.kernel.dk/linux-block:for-next
@ 2017-05-25 19:10 Eric Wheeler
  2017-06-28 23:06 ` [PULL] bcache fixes and updates for-4.13 Eric Wheeler
  2017-07-14 11:40 ` [PULL] bcache updates based on git.kernel.dk/linux-block:for-next Eddie Chapman
  0 siblings, 2 replies; 41+ messages in thread
From: Eric Wheeler @ 2017-05-25 19:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-bcache, Jan Kara, stable, tang.junhui, Kent Overstreet,
	Coly Li, Stefan Bader, Liang Chen, nix

Hi Jens,

Please pull these updates and bugfixes from the bcache community when you 
have a minute.  If you need a rebase against something else then please 
let me know and I would be happy to update for you.

Thank you for your help!



The following changes since commit 0789bd7bdb5bd036fe3df96c19528f46127a0160:

  Merge branch 'for-linus' into for-next (2017-05-10 07:40:47 -0600)

are available in the git repository at:

  https://bitbucket.org/ewheelerinc/linux.git bcache-updates-linux-block-for-next

for you to fetch changes up to 8a02c3d571b895931db7a2700f05d8c70a7c6cb2:

  bcache: update bio->bi_opf bypass/writeback REQ_ flag hints (2017-05-11 12:29:08 -0700)

----------------------------------------------------------------
Jan Kara (1):
      bcache: Fix leak of bdev reference

Liang Chen (1):
      bcache: explicitly destory mutex while exiting

tang.junhui (4):
      bcache: fix sequential large write IO bypass
      bcache: do not subtract sectors_to_gc for bypassed IO
      bcache: fix wrong cache_misses statistics
      bcache: fix calling ida_simple_remove() with incorrect minor

Eric Wheeler (3):
      bcache: introduce bcache sysfs entries for ioprio-based bypass/writeback hints
      bcache: documentation for sysfs entries describing bcache cache hinting
      bcache: update bio->bi_opf bypass/writeback REQ_ flag hints


 Documentation/bcache.txt      | 80 ++++++++++++++++++++++++++++++++++++++++
 drivers/md/bcache/bcache.h    |  3 ++
 drivers/md/bcache/request.c   | 45 +++++++++++++++++-----
 drivers/md/bcache/super.c     | 18 ++++++---
 drivers/md/bcache/sysfs.c     | 71 +++++++++++++++++++++++++++++++++++
 drivers/md/bcache/writeback.c |  8 ++++
 drivers/md/bcache/writeback.h | 27 +++++++++++++-
 7 files changed, 236 insertions(+), 16 deletions(-)

^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor
@ 2017-07-01 19:25 Eric Wheeler
  0 siblings, 0 replies; 41+ messages in thread
From: Eric Wheeler @ 2017-07-01 19:25 UTC (permalink / raw)
  To: linux-block; +Cc: linux-bcache, hch, axboe, Tang Junhui, stable, Stefan Bader

From: Tang Junhui <tang.junhui@zte.com.cn>

bcache called ida_simple_remove() with minor which have multiplied by
BCACHE_MINORS, it would cause minor wrong release and leakage.

In addition, when adding partition support to bcache, the name assignment
was not updated, resulting in numbers jumping (bcache0, bcache16,
bcache32...). This has been fixed implicitly by the rework.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
Reviewed-by: Coly Li <colyli@suse.de>
Reviewed-by: Eric Wheeler <bcache@linux.ewheeler.net>
Cc: stable@vger.kernel.org # 4.10
Cc: Stefan Bader <stefan.bader@canonical.com>
Fixes: b8c0d91 (bcache: partition support: add 16 minors per bcacheN device)
BugLink: https://bugs.launchpad.net/bugs/1667078
---
 drivers/md/bcache/super.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 9a2c190..48b8c20 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -58,7 +58,10 @@ static wait_queue_head_t unregister_wait;
 struct workqueue_struct *bcache_wq;
 
 #define BTREE_MAX_PAGES		(256 * 1024 / PAGE_SIZE)
-#define BCACHE_MINORS		16 /* partition support */
+#define BCACHE_MINORS_BITS                4 /* bcache partition support */
+#define BCACHE_MINORS                     (1 << BCACHE_MINORS_BITS)
+#define BCACHE_TO_IDA_MINORS(first_minor) ((first_minor) >> BCACHE_MINORS_BITS)
+#define IDA_TO_BCACHE_MINORS(minor)       ((minor) << BCACHE_MINORS_BITS)
 
 /* Superblock */
 
@@ -734,7 +737,8 @@ static void bcache_device_free(struct bcache_device *d)
 	if (d->disk && d->disk->queue)
 		blk_cleanup_queue(d->disk->queue);
 	if (d->disk) {
-		ida_simple_remove(&bcache_minor, d->disk->first_minor);
+		ida_simple_remove(&bcache_minor,
+			BCACHE_TO_IDA_MINORS(d->disk->first_minor));
 		put_disk(d->disk);
 	}
 
@@ -776,11 +780,11 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
 	if (!d->full_dirty_stripes)
 		return -ENOMEM;
 
-	minor = ida_simple_get(&bcache_minor, 0, MINORMASK + 1, GFP_KERNEL);
+	minor = ida_simple_get(&bcache_minor, 0,
+		BCACHE_TO_IDA_MINORS(MINORMASK) + 1, GFP_KERNEL);
 	if (minor < 0)
 		return minor;
 
-	minor *= BCACHE_MINORS;
 
 	if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio),
 					   BIOSET_NEED_BVECS |
@@ -794,7 +798,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
 	snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", minor);
 
 	d->disk->major		= bcache_major;
-	d->disk->first_minor	= minor;
+	d->disk->first_minor	= IDA_TO_BCACHE_MINORS(minor);
 	d->disk->fops		= &bcache_ops;
 	d->disk->private_data	= d;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2017-10-27 19:17 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-25 19:10 [PULL] bcache updates based on git.kernel.dk/linux-block:for-next Eric Wheeler
2017-06-28 23:06 ` [PULL] bcache fixes and updates for-4.13 Eric Wheeler
2017-06-29 13:45   ` Christoph Hellwig
2017-06-29 16:19     ` Coly Li
2017-06-29 22:12     ` Eric Wheeler
2017-06-29 22:25       ` Eric Wheeler
2017-06-29 23:28         ` Nick Alcock
2017-06-30 20:42     ` [PATCH 01/19] bcache: Fix leak of bdev reference bcache
2017-06-30 20:42       ` [PATCH 02/19] bcache: fix sequential large write IO bypass bcache
2017-07-05 18:25         ` Christoph Hellwig
2017-06-30 20:42       ` [PATCH 03/19] bcache: do not subtract sectors_to_gc for bypassed IO bcache
2017-07-01 17:26         ` Coly Li
2017-07-05 18:25         ` Christoph Hellwig
2017-06-30 20:42       ` [PATCH 04/19] bcache: fix wrong cache_misses statistics bcache
2017-07-01 17:58         ` Coly Li
2017-06-30 20:42       ` [PATCH 06/19] bcache: explicitly destory mutex while exiting bcache
2017-07-01 18:43         ` Coly Li
2017-07-05 11:58           ` Liang Chen
2017-07-11  7:22             ` Coly Li
2017-07-05 18:27         ` Christoph Hellwig
2017-07-06  1:56           ` Liang Chen
2017-06-30 20:42       ` [PATCH 10/19] bcache: initialize stripe_sectors_dirty correctly for thin flash device bcache
2017-07-01 18:52         ` Coly Li
2017-06-30 20:43       ` [PATCH 11/19] bcache: Subtract dirty sectors of thin flash from cache_sectors in calculating writeback rate bcache
2017-07-10 18:11         ` Coly Li
     [not found]           ` <OF92BDA950.86AA00FA-ON4825815A.001F33D9-4825815A.001F5C89@zte.com.cn>
2017-07-13  4:12             ` Eric Wheeler
2017-07-13  4:15               ` Coly Li
2017-10-27 19:12                 ` Eric Wheeler
2017-06-30 20:43       ` [PATCH 14/19] bcache: Correct return value for sysfs attach errors bcache
2017-06-30 20:43       ` [PATCH 17/19] bcache: fix for gc and write-back race bcache
2017-08-03 16:20         ` Coly Li
2017-07-01 16:55       ` [PATCH 01/19] bcache: Fix leak of bdev reference Coly Li
2017-07-05 18:24       ` Christoph Hellwig
     [not found]       ` <1498855388-16990-5-git-send-email-bcache@lists.ewheeler.net>
2017-07-05 18:26         ` [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor Christoph Hellwig
2017-07-14 11:40 ` [PULL] bcache updates based on git.kernel.dk/linux-block:for-next Eddie Chapman
     [not found]   ` <7040453d-2272-d376-710b-6ed07527a98e@coly.li>
2017-07-14 17:33     ` Eddie Chapman
     [not found]       ` <OF92BA0158.87BDF9E3-ON4825815E.000736BF-4825815E.000833F7@zte.com.cn>
2017-07-18 18:24         ` Eddie Chapman
2017-07-18 18:31           ` Eddie Chapman
2017-07-18 20:06             ` Greg KH
2017-07-18 20:36               ` Eddie Chapman
  -- strict thread matches above, loose matches on Subject: below --
2017-07-01 19:25 [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor Eric Wheeler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox