lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 16 Jul 2006 12:33:45 +0200
From:	Laurent Riffard <laurent.riffard@...e.fr>
To:	Peter Osterlund <petero2@...ia.com>
CC:	Arjan van de Ven <arjan@...ux.intel.com>, mingo@...e.hu,
	akpm@...l.org,
	Kernel development list <linux-kernel@...r.kernel.org>,
	axboe@...e.de
Subject: Re: [patch] lockdep: annotate pktcdvd natural device hierarchy


Le 15.07.2006 12:57, Peter Osterlund a écrit :
> Laurent Riffard <laurent.riffard@...e.fr> writes:
> 
>> Le 15.07.2006 09:04, Arjan van de Ven a écrit :
>>
>> Thanks Arjan, this seems to solve the initial issue of this thread, 
>> which was "possible circular locking deadlock detected!" while 
>> doing "pktsetup dvd /dev/dvd".
>>
>> So here is the next step :-(. I'm now running 2.6.18-rc1-mm2 and I was able 
>> to successfully run:
>> - modprobe ptkcdvd
>> - pktsetup dvd /dev/dvd
>>
>> Then I inserted a UDF-formatted CD-RW in the CD/DVD burner and I typed 
>> this command :
>> - mount -oro -tauto /dev/pktcdvd/dvd /mnt/cdrom 
>> The following happened :
>>
>> pktcdvd: writer pktcdvd0 mapped to hdc
>>
>> =============================================
>> [ INFO: possible recursive locking detected ]
>> ---------------------------------------------
> 
> I got the same problem. This patch fixes it in my case. I'm not sure
> if using the *_partition() functions is the right thing to do, but the
> device mapper code is using those functions in similar situations.
> 
>  drivers/block/pktcdvd.c |   12 ++++++------
>  fs/block_dev.c          |    7 +++----
>  include/linux/fs.h      |    1 +
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index f87d1a8..ccded00 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -1922,7 +1922,7 @@ static int pkt_open_dev(struct pktcdvd_d
>  	 * so bdget() can't fail.
>  	 */
>  	bdget(pd->bdev->bd_dev);
> -	if ((ret = blkdev_get(pd->bdev, FMODE_READ, O_RDONLY)))
> +	if ((ret = blkdev_get_partition(pd->bdev, FMODE_READ, O_RDONLY)))
>  		goto out;
>  
>  	if ((ret = bd_claim(pd->bdev, pd)))
> @@ -1971,7 +1971,7 @@ static int pkt_open_dev(struct pktcdvd_d
>  out_unclaim:
>  	bd_release(pd->bdev);
>  out_putdev:
> -	blkdev_put(pd->bdev);
> +	blkdev_put_partition(pd->bdev);
>  out:
>  	return ret;
>  }
> @@ -1989,7 +1989,7 @@ static void pkt_release_dev(struct pktcd
>  
>  	pkt_set_speed(pd, MAX_SPEED, MAX_SPEED);
>  	bd_release(pd->bdev);
> -	blkdev_put(pd->bdev);
> +	blkdev_put_partition(pd->bdev);
>  
>  	pkt_shrink_pktlist(pd);
>  }
> @@ -2339,7 +2339,7 @@ static int pkt_new_dev(struct pktcdvd_de
>  	bdev = bdget(dev);
>  	if (!bdev)
>  		return -ENOMEM;
> -	ret = blkdev_get(bdev, FMODE_READ, O_RDONLY | O_NONBLOCK);
> +	ret = blkdev_get_partition(bdev, FMODE_READ, O_RDONLY | O_NONBLOCK);
>  	if (ret)
>  		return ret;
>  
> @@ -2368,7 +2368,7 @@ static int pkt_new_dev(struct pktcdvd_de
>  	return 0;
>  
>  out_mem:
> -	blkdev_put(bdev);
> +	blkdev_put_partition(bdev);
>  	/* This is safe: open() is still holding a reference. */
>  	module_put(THIS_MODULE);
>  	return ret;
> @@ -2530,7 +2530,7 @@ static int pkt_remove_dev(struct pkt_ctr
>  	if (!IS_ERR(pd->cdrw.thread))
>  		kthread_stop(pd->cdrw.thread);
>  
> -	blkdev_put(pd->bdev);
> +	blkdev_put_partition(pd->bdev);
>  
>  	remove_proc_entry(pd->name, pkt_proc);
>  	DPRINTK("pktcdvd: writer %s unmapped\n", pd->name);
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index b721bb6..642e9b2 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -822,9 +822,6 @@ struct block_device *open_by_devnum(dev_
>  
>  EXPORT_SYMBOL(open_by_devnum);
>  
> -static int
> -blkdev_get_partition(struct block_device *bdev, mode_t mode, unsigned flags);
> -
>  struct block_device *open_partition_by_devnum(dev_t dev, unsigned mode)
>  {
>  	struct block_device *bdev = bdget(dev);
> @@ -1031,7 +1028,7 @@ blkdev_get_whole(struct block_device *bd
>  	return do_open(bdev, &fake_file, BD_MUTEX_WHOLE);
>  }
>  
> -static int
> +int
>  blkdev_get_partition(struct block_device *bdev, mode_t mode, unsigned flags)
>  {
>  	/*
> @@ -1050,6 +1047,8 @@ blkdev_get_partition(struct block_device
>  	return do_open(bdev, &fake_file, BD_MUTEX_PARTITION);
>  }
>  
> +EXPORT_SYMBOL(blkdev_get_partition);
> +
>  static int blkdev_open(struct inode * inode, struct file * filp)
>  {
>  	struct block_device *bdev;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index b9f1c18..10f8c56 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1455,6 +1455,7 @@ extern int ioctl_by_bdev(struct block_de
>  extern int blkdev_ioctl(struct block_device *, struct file *, unsigned, unsigned long);
>  extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
>  extern int blkdev_get(struct block_device *, mode_t, unsigned);
> +extern int blkdev_get_partition(struct block_device *, mode_t, unsigned);
>  extern int blkdev_put(struct block_device *);
>  extern int blkdev_put_partition(struct block_device *);
>  extern int bd_claim(struct block_device *, void *);

Thank you Peter, the above patch removed the "possible recursive 
locking detected" message. 

Now, I've got a new one (will this thread never end ?):

pktcdvd: writer pktcdvd0 mapped to hdc
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
 [<c0104db5>] show_trace+0xd/0x10
 [<c0104dd1>] dump_stack+0x19/0x1c
 [<c012c2e1>] __lock_acquire+0x10f/0x9a5
 [<c012cbd7>] lock_acquire+0x60/0x80
 [<c0292131>] _spin_lock_irq+0x1f/0x2e
 [<c028fe86>] wait_for_completion+0x29/0xe5
 [<e1136299>] pkt_generic_packet+0x1bb/0x1e8 [pktcdvd]
 [<e113671a>] pkt_get_disc_info+0x3d/0x77 [pktcdvd]
 [<e113836f>] pkt_open+0xc3/0xbf4 [pktcdvd]
 [<c0159c36>] do_open+0xa1/0x3bd
 [<c015a179>] blkdev_open+0x1f/0x48
 [<c0151c87>] __dentry_open+0xb8/0x186
 [<c0151dc3>] nameidata_to_filp+0x1c/0x2e
 [<c0151e03>] do_filp_open+0x2e/0x35
 [<c0152ce1>] do_sys_open+0x40/0xbb
 [<c0152d88>] sys_open+0x16/0x18
 [<c0102c2d>] sysenter_past_esp+0x56/0x8d
UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'flexbackup', timestamp 2006/03/17 15:29 (1078)

(full dmesg attached)
-- 
laurent

View attachment "dmesg-2.6.18-rc1-mm2-a" of type "text/plain" (21071 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ