[PATCH] ide: Fix bug caused by git merge

From: Steven Rostedt
Date: Wed Jun 01 2011 - 15:25:36 EST


Running ktest.pl randconfig on an older box of mine that has an ide cd,
I found a config that caused the machine not to boot. Doing a ktest
config bisect, I found that if I have CONFIG_BLK_DEV_PIIX set, it caused
the bug.

Then I took that same config and found that 2.6.39 boots fine. So I
kicked off ktest to do a git bisect, and this is where everything went
to hell. The bisect came to a point where it wouldn't boot from a branch
that was based off of v2.6.39-rc4. But then I found v2.6.39-rc4 didn't
boot either. Something fixed this bug between rc4 and 39, but this
branch didn't have it.

I than ran a reverse git bisect with ktest (where good is bad and bad is
good) between v2.6.39 and v2.6.39-rc4 to find what fixed this bug, and
it found:

commit 7eec77a1816a7042591a6cbdb4820e9e7ebffe0e
Author: Tejun Heo <tj@xxxxxxxxxx>
ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd

Great I thought, and then applied this patch to my git bisect again
(modified ktest for v3.1) to find the other bug. But instead I found
that this was the same bug, but it reappeared. The culprit was a line in
drivers/ide/ide-cd.c. What happened was that a git merge brought back
some code that was deleted.

The merge 0eb8e885726a3a93206510092bbc7e39e272f6ef that merged the
commits:

af75cd3c67845ebe31d2df9a780889a5ebecef11

and

0a58e077eb600d1efd7e54ad9926a75a39d7f8ae

had an issue.

If I did a:

git blame af75cd3c67845ebe31d2df9a780889a5ebecef11 drivers/ide/ide-cd.c

I would find:

5b03a1b1 (Tejun Heo 2011-03-09 19:54:27 +0100 1785) g->events = DISK_EVENT_MEDIA_CHANGE;

But if I did a:

git blame 0a58e077eb600d1efd7e54ad9926a75a39d7f8ae drivers/ide/ide-cd.c

Which contains the commit 7eec77a1816a7042591a6cbdb4820e9e7ebffe0e which
removes this line, it does not exist.

The issue here is that the commit 5b03a1b1 is a common ancestor to both
commits. But even though the commit 7eec77a1 removed that line, for some
reason, the merge put that line back. No other commit added that line to
the code.

By simply removing that line, my machine now boots again with the bad
config.

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6e5123b..144d272 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive)
ide_cd_read_toc(drive, &sense);
g->fops = &idecd_ops;
g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE;
- g->events = DISK_EVENT_MEDIA_CHANGE;
add_disk(g);
return 0;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/