All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-ide@vger.kernel.org, linuxppc-dev@ozlabs.org,
	petkovbb@gmail.com
Subject: Re: ide pmac breakage
Date: Thu, 31 Jul 2008 14:25:22 +1000	[thread overview]
Message-ID: <1217478322.11188.410.camel@pasglop> (raw)
In-Reply-To: <200807302111.54514.bzolnier@gmail.com>


> Is it actually caused by additional reference counting on drive->gendev?
> IOW if you reverse the patch below instead of applying the previous fix
> do things work OK again?
> 
> > Note that there shouldn't be anything fundamentally different from
> > ide-pmac here vs. something like pcmcia IDE cards... do you have one of
> > these to test with ?
> 
> Nope and I really don't intend to have one.  I count on other people
> to take some care of support for host drivers that they maintain/use. ;)

Reverting the patch below does the job. Thanks.

Ben.

> Thanks,
> Bart
> 
> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> index 4e73aee..8f253e5 100644
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -57,23 +57,29 @@ static DEFINE_MUTEX(idecd_ref_mutex);
>  #define ide_cd_g(disk) \
>  	container_of((disk)->private_data, struct cdrom_info, driver)
>  
> +static void ide_cd_release(struct kref *);
> +
>  static struct cdrom_info *ide_cd_get(struct gendisk *disk)
>  {
>  	struct cdrom_info *cd = NULL;
>  
>  	mutex_lock(&idecd_ref_mutex);
>  	cd = ide_cd_g(disk);
> -	if (cd)
> +	if (cd) {
>  		kref_get(&cd->kref);
> +		if (ide_device_get(cd->drive)) {
> +			kref_put(&cd->kref, ide_cd_release);
> +			cd = NULL;
> +		}
> +	}
>  	mutex_unlock(&idecd_ref_mutex);
>  	return cd;
>  }
>  
> -static void ide_cd_release(struct kref *);
> -
>  static void ide_cd_put(struct cdrom_info *cd)
>  {
>  	mutex_lock(&idecd_ref_mutex);
> +	ide_device_put(cd->drive);
>  	kref_put(&cd->kref, ide_cd_release);
>  	mutex_unlock(&idecd_ref_mutex);
>  }


WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-ide@vger.kernel.org, petkovbb@gmail.com,
	linuxppc-dev@ozlabs.org
Subject: Re: ide pmac breakage
Date: Thu, 31 Jul 2008 14:25:22 +1000	[thread overview]
Message-ID: <1217478322.11188.410.camel@pasglop> (raw)
In-Reply-To: <200807302111.54514.bzolnier@gmail.com>


> Is it actually caused by additional reference counting on drive->gendev?
> IOW if you reverse the patch below instead of applying the previous fix
> do things work OK again?
> 
> > Note that there shouldn't be anything fundamentally different from
> > ide-pmac here vs. something like pcmcia IDE cards... do you have one of
> > these to test with ?
> 
> Nope and I really don't intend to have one.  I count on other people
> to take some care of support for host drivers that they maintain/use. ;)

Reverting the patch below does the job. Thanks.

Ben.

> Thanks,
> Bart
> 
> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> index 4e73aee..8f253e5 100644
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -57,23 +57,29 @@ static DEFINE_MUTEX(idecd_ref_mutex);
>  #define ide_cd_g(disk) \
>  	container_of((disk)->private_data, struct cdrom_info, driver)
>  
> +static void ide_cd_release(struct kref *);
> +
>  static struct cdrom_info *ide_cd_get(struct gendisk *disk)
>  {
>  	struct cdrom_info *cd = NULL;
>  
>  	mutex_lock(&idecd_ref_mutex);
>  	cd = ide_cd_g(disk);
> -	if (cd)
> +	if (cd) {
>  		kref_get(&cd->kref);
> +		if (ide_device_get(cd->drive)) {
> +			kref_put(&cd->kref, ide_cd_release);
> +			cd = NULL;
> +		}
> +	}
>  	mutex_unlock(&idecd_ref_mutex);
>  	return cd;
>  }
>  
> -static void ide_cd_release(struct kref *);
> -
>  static void ide_cd_put(struct cdrom_info *cd)
>  {
>  	mutex_lock(&idecd_ref_mutex);
> +	ide_device_put(cd->drive);
>  	kref_put(&cd->kref, ide_cd_release);
>  	mutex_unlock(&idecd_ref_mutex);
>  }

  parent reply	other threads:[~2008-07-31  4:25 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28  1:29 ide pmac breakage Benjamin Herrenschmidt
2008-07-28  2:02 ` Benjamin Herrenschmidt
2008-07-28 14:31   ` Bartlomiej Zolnierkiewicz
2008-07-28 14:31     ` Bartlomiej Zolnierkiewicz
2008-07-29  5:17     ` FUJITA Tomonori
2008-07-29  5:17       ` FUJITA Tomonori
2008-07-29  5:20       ` Benjamin Herrenschmidt
2008-07-29  5:20         ` Benjamin Herrenschmidt
2008-07-29 11:41         ` Bartlomiej Zolnierkiewicz
2008-07-29 12:02           ` Benjamin Herrenschmidt
2008-07-29 12:02             ` Benjamin Herrenschmidt
2008-07-29 12:04             ` Bartlomiej Zolnierkiewicz
2008-07-29 12:04               ` Bartlomiej Zolnierkiewicz
2008-07-29 14:45               ` Bartlomiej Zolnierkiewicz
2008-07-29 14:45                 ` Bartlomiej Zolnierkiewicz
2008-07-29 19:26                 ` Bartlomiej Zolnierkiewicz
2008-07-29 19:26                   ` Bartlomiej Zolnierkiewicz
2008-07-29 21:30                   ` Benjamin Herrenschmidt
2008-07-29 21:30                     ` Benjamin Herrenschmidt
2008-07-30  1:23                   ` FUJITA Tomonori
2008-07-30  1:23                     ` FUJITA Tomonori
2008-07-30  6:57                   ` Benjamin Herrenschmidt
2008-07-30  6:57                     ` Benjamin Herrenschmidt
2008-07-30 19:11                     ` Bartlomiej Zolnierkiewicz
2008-07-30 19:11                       ` Bartlomiej Zolnierkiewicz
2008-07-30 22:49                       ` Benjamin Herrenschmidt
2008-07-30 22:49                         ` Benjamin Herrenschmidt
2008-07-31  0:48                         ` Bartlomiej Zolnierkiewicz
2008-07-31  0:48                           ` Bartlomiej Zolnierkiewicz
2008-07-31  1:09                           ` Benjamin Herrenschmidt
2008-07-31  1:09                             ` Benjamin Herrenschmidt
2008-07-31  3:17                             ` Bartlomiej Zolnierkiewicz
2008-07-31  3:17                               ` Bartlomiej Zolnierkiewicz
2008-07-31  8:49                           ` Alan Cox
2008-07-31  8:49                             ` Alan Cox
2008-07-31  9:11                             ` Benjamin Herrenschmidt
2008-07-31  9:11                               ` Benjamin Herrenschmidt
2008-07-31  9:13                               ` Alan Cox
2008-07-31  9:13                                 ` Alan Cox
2008-07-31  9:48                                 ` Benjamin Herrenschmidt
2008-07-31  9:48                                   ` Benjamin Herrenschmidt
2008-07-31  4:25                       ` Benjamin Herrenschmidt [this message]
2008-07-31  4:25                         ` Benjamin Herrenschmidt
2008-07-31 10:51                         ` Bartlomiej Zolnierkiewicz
2008-07-31 10:51                           ` Bartlomiej Zolnierkiewicz
2008-08-01 10:54                           ` Bartlomiej Zolnierkiewicz
2008-08-01 10:54                             ` Bartlomiej Zolnierkiewicz
2008-08-01 22:26                             ` Benjamin Herrenschmidt
2008-08-01 22:26                               ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217478322.11188.410.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=bzolnier@gmail.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-ide@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=petkovbb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.