All of lore.kernel.org
 help / color / mirror / Atom feed
* loop warnings in current git HEAD
@ 2010-10-23 15:59 Christoph Hellwig
  2010-10-24 10:02 ` Milan Broz
  2010-10-25  7:11 ` [PATCH] loop: Properly clear sysfs in autoclear mode Milan Broz
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2010-10-23 15:59 UTC (permalink / raw)
  To: mbroz, jaxboe; +Cc: linux-kernel

The loop driver in current git HEAD is rather unhappy when running
xfstests.  I gets lots of warnings like the one below.  The most likely
culprit seems to be:

	loop: add some basic read-only sysfs attributes

(commit ee86273062cbb310665fe49e1f1937d2cf85b0b9)

[ 1055.017350] WARNING: at /home/hch/work/linux-2.6/fs/sysfs/dir.c:451 sysfs_add_one+0xa4/0x110()
[ 1055.019843] Hardware name: Bochs
[ 1055.021004] sysfs: cannot create duplicate filename '/devices/virtual/block/loop0/loop'
[ 1055.023362] Modules linked in:
[ 1055.024274] Pid: 7028, comm: mount Tainted: G        W   2.6.36+ #6
[ 1055.025622] Call Trace:
[ 1055.026312]  [<c0169ead>] warn_slowpath_common+0x6d/0xa0
[ 1055.027464]  [<c026f534>] ? sysfs_add_one+0xa4/0x110
[ 1055.028651]  [<c026f534>] ? sysfs_add_one+0xa4/0x110
[ 1055.030329]  [<c0169f5e>] warn_slowpath_fmt+0x2e/0x30
[ 1055.031877]  [<c026f534>] sysfs_add_one+0xa4/0x110
[ 1055.033052]  [<c09e7645>] ? mutex_lock_nested+0x35/0x40
[ 1055.034273]  [<c026f5fc>] create_dir+0x5c/0xa0
[ 1055.035318]  [<c026f712>] sysfs_create_subdir+0x22/0x30
[ 1055.036570]  [<c0270aec>] internal_create_group+0x4c/0x170
[ 1055.037778]  [<c0270c3c>] sysfs_create_group+0xc/0x10
[ 1055.038902]  [<c079de83>] lo_ioctl+0x623/0x8c0
[ 1055.042214]  [<c019a3fa>] ? print_lock_contention_bug+0x1a/0xe0
[ 1055.043471]  [<c079d860>] ? lo_ioctl+0x0/0x8c0
[ 1055.044557]  [<c07065ac>] __blkdev_driver_ioctl+0x2c/0x40
[ 1055.048076]  [<c0706a9b>] blkdev_ioctl+0x21b/0x730
[ 1055.049155]  [<c019bf3b>] ? trace_hardirqs_on+0xb/0x10
[ 1055.050277]  [<c023ce0b>] block_ioctl+0x3b/0x50
[ 1055.051302]  [<c023cdd0>] ? block_ioctl+0x0/0x50
[ 1055.059103]  [<c02216ed>] do_vfs_ioctl+0x7d/0x5e0
[ 1055.060225]  [<c021d510>] ? path_put+0x20/0x30
[ 1055.061263]  [<c0217881>] ? sys_readlinkat+0x71/0x90
[ 1055.062360]  [<c0221c89>] sys_ioctl+0x39/0x60
[ 1055.063358]  [<c09e907d>] syscall_call+0x7/0xb
[ 1055.064470] ---[ end trace 1de52d78815cd17d ]---


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

* Re: loop warnings in current git HEAD
  2010-10-23 15:59 loop warnings in current git HEAD Christoph Hellwig
@ 2010-10-24 10:02 ` Milan Broz
  2010-10-24 16:13   ` Christoph Hellwig
  2010-10-25  7:11 ` [PATCH] loop: Properly clear sysfs in autoclear mode Milan Broz
  1 sibling, 1 reply; 6+ messages in thread
From: Milan Broz @ 2010-10-24 10:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jaxboe, linux-kernel



On 10/23/2010 05:59 PM, Christoph Hellwig wrote:

> The loop driver in current git HEAD is rather unhappy when running
> xfstests.  I gets lots of warnings like the one below.  The most likely
> culprit seems to be:
>
> 	loop: add some basic read-only sysfs attributes
>
> (commit ee86273062cbb310665fe49e1f1937d2cf85b0b9) 
yes, seems I forgot bdev can be NULL in destructor (autoclear mode).
can you try if patch below helps?

Milan

loop: Properly clear sysfs in autoclear mode

Signed-off-by: Milan Broz <mbroz@redhat.com>

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6c48b35..c21d4f3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
 	if (bdev)
 		invalidate_bdev(bdev);
 	set_capacity(lo->lo_disk, 0);
+	loop_sysfs_exit(lo);
 	if (bdev) {
 		bd_set_size(bdev, 0);
-		loop_sysfs_exit(lo);
 		/* let user-space know about this change */
 		kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
 	}



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

* Re: loop warnings in current git HEAD
  2010-10-24 10:02 ` Milan Broz
@ 2010-10-24 16:13   ` Christoph Hellwig
  2010-10-24 16:18     ` Milan Broz
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2010-10-24 16:13 UTC (permalink / raw)
  To: Milan Broz; +Cc: Christoph Hellwig, jaxboe, linux-kernel

On Sun, Oct 24, 2010 at 12:02:39PM +0200, Milan Broz wrote:
> yes, seems I forgot bdev can be NULL in destructor (autoclear mode).
> can you try if patch below helps?

Yes, this patch seems to fix the issue for me.


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

* Re: loop warnings in current git HEAD
  2010-10-24 16:13   ` Christoph Hellwig
@ 2010-10-24 16:18     ` Milan Broz
  0 siblings, 0 replies; 6+ messages in thread
From: Milan Broz @ 2010-10-24 16:18 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jaxboe, linux-kernel

On 10/24/2010 06:13 PM, Christoph Hellwig wrote:
> On Sun, Oct 24, 2010 at 12:02:39PM +0200, Milan Broz wrote:
>> yes, seems I forgot bdev can be NULL in destructor (autoclear mode).
>> can you try if patch below helps?
> 
> Yes, this patch seems to fix the issue for me.

Great.

Jens, please can you queue it to block git then?

Btw there seems to be other loop problem I just found (not related to my patch)
when loop compiled as module oopses on unload, I'll try to bisect it.

Milan


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

* [PATCH] loop: Properly clear sysfs in autoclear mode
  2010-10-23 15:59 loop warnings in current git HEAD Christoph Hellwig
  2010-10-24 10:02 ` Milan Broz
@ 2010-10-25  7:11 ` Milan Broz
  2010-10-25 12:41   ` Jeff Chua
  1 sibling, 1 reply; 6+ messages in thread
From: Milan Broz @ 2010-10-25  7:11 UTC (permalink / raw)
  To: axboe; +Cc: jeff.chua.linux, hch, linux-kernel, Milan Broz

In autoclear mode bdev is NULL but the sysfs
entry should be destroyed otherwise this warning appears:

WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x82/0x95()
sysfs: cannot create duplicate filename '/devices/virtual/block/loop0/loop'

Fixes commit ee86273062cbb310665fe49e1f1937d2cf85b0b9

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 drivers/block/loop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6c48b35..c21d4f3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
 	if (bdev)
 		invalidate_bdev(bdev);
 	set_capacity(lo->lo_disk, 0);
+	loop_sysfs_exit(lo);
 	if (bdev) {
 		bd_set_size(bdev, 0);
-		loop_sysfs_exit(lo);
 		/* let user-space know about this change */
 		kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
 	}
-- 
1.7.2.3


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

* Re: [PATCH] loop: Properly clear sysfs in autoclear mode
  2010-10-25  7:11 ` [PATCH] loop: Properly clear sysfs in autoclear mode Milan Broz
@ 2010-10-25 12:41   ` Jeff Chua
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Chua @ 2010-10-25 12:41 UTC (permalink / raw)
  To: Milan Broz; +Cc: axboe, hch, lkml

On Mon, Oct 25, 2010 at 3:11 PM, Milan Broz <mbroz@redhat.com> wrote:
> In autoclear mode bdev is NULL but the sysfs
> entry should be destroyed otherwise this warning appears:
>
> WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x82/0x95()
> sysfs: cannot create duplicate filename '/devices/virtual/block/loop0/loop'
>
> Fixes commit ee86273062cbb310665fe49e1f1937d2cf85b0b9
>
> Signed-off-by: Milan Broz <mbroz@redhat.com>
> ---
>  drivers/block/loop.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 6c48b35..c21d4f3 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
>        if (bdev)
>                invalidate_bdev(bdev);
>        set_capacity(lo->lo_disk, 0);
> +       loop_sysfs_exit(lo);
>        if (bdev) {
>                bd_set_size(bdev, 0);
> -               loop_sysfs_exit(lo);
>                /* let user-space know about this change */
>                kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
>        }

Tested and worked.

Thanks,
Jeff

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

end of thread, other threads:[~2010-10-25 12:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-23 15:59 loop warnings in current git HEAD Christoph Hellwig
2010-10-24 10:02 ` Milan Broz
2010-10-24 16:13   ` Christoph Hellwig
2010-10-24 16:18     ` Milan Broz
2010-10-25  7:11 ` [PATCH] loop: Properly clear sysfs in autoclear mode Milan Broz
2010-10-25 12:41   ` Jeff Chua

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.