From: Josh Hunt Date: Tue, 7 Apr 2015 23:43:58 +0000 (+1000) Subject: block: restore /proc/partitions to not display non-partitionable removable devices X-Git-Tag: KARO-TXA5-2015-06-26~18^2~459 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9585ef3e224fc324b8c0c74e01966bcf7fde785e;p=karo-tx-linux.git block: restore /proc/partitions to not display non-partitionable removable devices We found with newer kernels we started seeing the cdrom device showing up in /proc/partitions, but it was not there before. Looking into this I found that commit d27769ec ("block: add GENHD_FL_NO_PART_SCAN") introduces this change in behavior. It's not clear to me from the commit's changelog if this change was intentional or not. This comment still remains: /* Don't show non-partitionable removeable devices or empty devices */ so I've decided to send a patch to restore the behavior of not printing unpartitionable removable devices. Signed-off-by: Josh Hunt Cc: Tejun Heo Cc: Kay Sievers Cc: Jens Axboe Cc: Al Viro Signed-off-by: Andrew Morton --- diff --git a/block/genhd.c b/block/genhd.c index 0a536dc05f3b..64600e911aaa 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -850,7 +850,7 @@ static int show_partition(struct seq_file *seqf, void *v) char buf[BDEVNAME_SIZE]; /* Don't show non-partitionable removeable devices or empty devices */ - if (!get_capacity(sgp) || (!disk_max_parts(sgp) && + if (!get_capacity(sgp) || (!(disk_max_parts(sgp) > 1) && (sgp->flags & GENHD_FL_REMOVABLE))) return 0; if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)