* [PATCH 1/9] xfs: avoid memory allocation under m_peraglock in growfs code
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-27 1:48 ` Felix Blyakher
2009-07-18 22:14 ` [PATCH 2/9] xfs: switch to NOFS allocation under i_lock in xfs_getbmap Christoph Hellwig
` (8 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-growfs --]
[-- Type: text/plain, Size: 1590 bytes --]
Allocate the memory for the larger m_perag array before taking the
per-AG lock as the per-AG lock can be taken under the i_lock which
can be taken from reclaim context.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_fsops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_fsops.c 2009-07-10 13:05:24.798364926 +0200
+++ linux-2.6/fs/xfs/xfs_fsops.c 2009-07-10 13:16:00.827394975 +0200
@@ -167,17 +167,25 @@ xfs_growfs_data_private(
new = nb - mp->m_sb.sb_dblocks;
oagcount = mp->m_sb.sb_agcount;
if (nagcount > oagcount) {
+ void *new_perag, *old_perag;
+
xfs_filestream_flush(mp);
+
+ new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount,
+ KM_MAYFAIL);
+ if (!new_perag)
+ return XFS_ERROR(ENOMEM);
+
down_write(&mp->m_peraglock);
- mp->m_perag = kmem_realloc(mp->m_perag,
- sizeof(xfs_perag_t) * nagcount,
- sizeof(xfs_perag_t) * oagcount,
- KM_SLEEP);
- memset(&mp->m_perag[oagcount], 0,
- (nagcount - oagcount) * sizeof(xfs_perag_t));
+ memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount);
+ old_perag = mp->m_perag;
+ mp->m_perag = new_perag;
+
mp->m_flags |= XFS_MOUNT_32BITINODES;
nagimax = xfs_initialize_perag(mp, nagcount);
up_write(&mp->m_peraglock);
+
+ kmem_free(old_perag);
}
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
tp->t_flags |= XFS_TRANS_RESERVE;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 1/9] xfs: avoid memory allocation under m_peraglock in growfs code
2009-07-18 22:14 ` [PATCH 1/9] xfs: avoid memory allocation under m_peraglock in growfs code Christoph Hellwig
@ 2009-07-27 1:48 ` Felix Blyakher
0 siblings, 0 replies; 13+ messages in thread
From: Felix Blyakher @ 2009-07-27 1:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: sage, xfs
On Jul 18, 2009, at 5:14 PM, Christoph Hellwig wrote:
> Allocate the memory for the larger m_perag array before taking the
> per-AG lock as the per-AG lock can be taken under the i_lock which
> can be taken from reclaim context.
>
> Reported by the new reclaim context tracing in lockdep.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
For the whole series:
Reviewed-by: Felix Blyakher <felixb@sgi.com>
>
>
> Index: linux-2.6/fs/xfs/xfs_fsops.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/xfs_fsops.c 2009-07-10 13:05:24.798364926
> +0200
> +++ linux-2.6/fs/xfs/xfs_fsops.c 2009-07-10 13:16:00.827394975 +0200
> @@ -167,17 +167,25 @@ xfs_growfs_data_private(
> new = nb - mp->m_sb.sb_dblocks;
> oagcount = mp->m_sb.sb_agcount;
> if (nagcount > oagcount) {
> + void *new_perag, *old_perag;
> +
> xfs_filestream_flush(mp);
> +
> + new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount,
> + KM_MAYFAIL);
> + if (!new_perag)
> + return XFS_ERROR(ENOMEM);
> +
> down_write(&mp->m_peraglock);
> - mp->m_perag = kmem_realloc(mp->m_perag,
> - sizeof(xfs_perag_t) * nagcount,
> - sizeof(xfs_perag_t) * oagcount,
> - KM_SLEEP);
> - memset(&mp->m_perag[oagcount], 0,
> - (nagcount - oagcount) * sizeof(xfs_perag_t));
> + memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount);
> + old_perag = mp->m_perag;
> + mp->m_perag = new_perag;
> +
> mp->m_flags |= XFS_MOUNT_32BITINODES;
> nagimax = xfs_initialize_perag(mp, nagcount);
> up_write(&mp->m_peraglock);
> +
> + kmem_free(old_perag);
> }
> tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
> tp->t_flags |= XFS_TRANS_RESERVE;
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/9] xfs: switch to NOFS allocation under i_lock in xfs_getbmap
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
2009-07-18 22:14 ` [PATCH 1/9] xfs: avoid memory allocation under m_peraglock in growfs code Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:14 ` [PATCH 3/9] xfs: switch to NOFS allocation under i_lock in xfs_da_state_alloc Christoph Hellwig
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-getbmap --]
[-- Type: text/plain, Size: 862 bytes --]
xfs_getbmap allocates memory with i_lock held, but i_lock is taken in
reclaim context so all allocations under it must avoid recursions into
the filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_bmap.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_bmap.c 2009-07-10 13:05:24.808364312 +0200
+++ linux-2.6/fs/xfs/xfs_bmap.c 2009-07-10 13:16:00.830363579 +0200
@@ -6009,7 +6009,7 @@ xfs_getbmap(
*/
error = ENOMEM;
subnex = 16;
- map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL);
+ map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL | KM_NOFS);
if (!map)
goto out_unlock_ilock;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 3/9] xfs: switch to NOFS allocation under i_lock in xfs_da_state_alloc
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
2009-07-18 22:14 ` [PATCH 1/9] xfs: avoid memory allocation under m_peraglock in growfs code Christoph Hellwig
2009-07-18 22:14 ` [PATCH 2/9] xfs: switch to NOFS allocation under i_lock in xfs_getbmap Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:14 ` [PATCH 4/9] xfs: switch to NOFS allocation under i_lock in xfs_da_buf_make Christoph Hellwig
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-da_state_alloc --]
[-- Type: text/plain, Size: 877 bytes --]
xfs_da_state_alloc is always called with i_lock held, but i_lock is taken in
reclaim context so all allocations under it must avoid recursions into the
filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_da_btree.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_da_btree.c 2009-07-10 13:05:24.812364541 +0200
+++ linux-2.6/fs/xfs/xfs_da_btree.c 2009-07-10 13:16:00.834365485 +0200
@@ -2201,7 +2201,7 @@ kmem_zone_t *xfs_dabuf_zone; /* dabuf z
xfs_da_state_t *
xfs_da_state_alloc(void)
{
- return kmem_zone_zalloc(xfs_da_state_zone, KM_SLEEP);
+ return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS);
}
/*
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 4/9] xfs: switch to NOFS allocation under i_lock in xfs_da_buf_make
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (2 preceding siblings ...)
2009-07-18 22:14 ` [PATCH 3/9] xfs: switch to NOFS allocation under i_lock in xfs_da_state_alloc Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:14 ` [PATCH 5/9] xfs: switch to NOFS allocation under i_lock in xfs_dir_cilookup_result Christoph Hellwig
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-xfs_da_buf_make --]
[-- Type: text/plain, Size: 974 bytes --]
i_lock is taken in the reclaim context so all allocations under it
must avoid recursions into the filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_da_btree.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_da_btree.c 2009-07-10 13:05:24.812364541 +0200
+++ linux-2.6/fs/xfs/xfs_da_btree.c 2009-07-10 13:16:00.834365485 +0200
@@ -2261,9 +2261,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bp
int off;
if (nbuf == 1)
- dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_SLEEP);
+ dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_NOFS);
else
- dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_SLEEP);
+ dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_NOFS);
dabuf->dirty = 0;
#ifdef XFS_DABUF_DEBUG
dabuf->ra = ra;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 5/9] xfs: switch to NOFS allocation under i_lock in xfs_dir_cilookup_result
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (3 preceding siblings ...)
2009-07-18 22:14 ` [PATCH 4/9] xfs: switch to NOFS allocation under i_lock in xfs_da_buf_make Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:14 ` [PATCH 6/9] xfs: switch to NOFS allocation under i_lock in xfs_buf_associate_memory Christoph Hellwig
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-dir2 --]
[-- Type: text/plain, Size: 891 bytes --]
xfs_dir_cilookup_result is always called with i_lock held, but i_lock is taken
in reclaim context so all allocations under it must avoid recursions into the
filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_dir2.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_dir2.c 2009-07-10 13:05:24.817364338 +0200
+++ linux-2.6/fs/xfs/xfs_dir2.c 2009-07-10 13:16:00.834365485 +0200
@@ -256,7 +256,7 @@ xfs_dir_cilookup_result(
!(args->op_flags & XFS_DA_OP_CILOOKUP))
return EEXIST;
- args->value = kmem_alloc(len, KM_MAYFAIL);
+ args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL);
if (!args->value)
return ENOMEM;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 6/9] xfs: switch to NOFS allocation under i_lock in xfs_buf_associate_memory
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (4 preceding siblings ...)
2009-07-18 22:14 ` [PATCH 5/9] xfs: switch to NOFS allocation under i_lock in xfs_dir_cilookup_result Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:14 ` [PATCH 7/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_set Christoph Hellwig
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-buf --]
[-- Type: text/plain, Size: 1312 bytes --]
xfs_buf_associate_memory is used for setting up the spare buffer for the
log wrap case in xlog_sync which can happen under i_lock when called from
xfs_fsync. The i_lock mutex is taken in reclaim context so all allocations
under it must avoid recursions into the filesystem. There are a couple
more uses of xfs_buf_associate_memory in the log recovery code that are
also affected by this, but I'd rather keep the code simple than passing on
a gfp_mask argument. Longer term we should just stop requiring the memoery
allocation in xlog_sync by some smaller rework of the buffer layer.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c 2009-07-18 18:26:07.359681952 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c 2009-07-18 18:26:53.531658254 +0200
@@ -770,7 +770,7 @@ xfs_buf_associate_memory(
bp->b_pages = NULL;
bp->b_addr = mem;
- rval = _xfs_buf_get_pages(bp, page_count, 0);
+ rval = _xfs_buf_get_pages(bp, page_count, XBF_DONT_BLOCK);
if (rval)
return rval;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 7/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_set
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (5 preceding siblings ...)
2009-07-18 22:14 ` [PATCH 6/9] xfs: switch to NOFS allocation under i_lock in xfs_buf_associate_memory Christoph Hellwig
@ 2009-07-18 22:14 ` Christoph Hellwig
2009-07-18 22:15 ` [PATCH 8/9] xfs: switch to NOFS allocation under i_lock in xfs_readlink_bmap Christoph Hellwig
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:14 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-buf-2 --]
[-- Type: text/plain, Size: 1042 bytes --]
xfs_attr_rmtval_set is always called with i_lock held, and i_lock is taken
in reclaim context so all allocations under it must avoid recursions into
the filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_attr.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_attr.c 2009-07-18 18:49:20.129533080 +0200
+++ linux-2.6/fs/xfs/xfs_attr.c 2009-07-18 18:50:01.713535041 +0200
@@ -2141,8 +2141,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
- bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno,
- blkcnt, XFS_BUF_LOCK);
+ bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, blkcnt,
+ XFS_BUF_LOCK | XBF_DONT_BLOCK);
ASSERT(bp);
ASSERT(!XFS_BUF_GETERROR(bp));
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 8/9] xfs: switch to NOFS allocation under i_lock in xfs_readlink_bmap
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (6 preceding siblings ...)
2009-07-18 22:14 ` [PATCH 7/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_set Christoph Hellwig
@ 2009-07-18 22:15 ` Christoph Hellwig
2009-07-18 22:15 ` [PATCH 9/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_get Christoph Hellwig
2009-07-30 18:56 ` [PATCH 0/9] fixes for memory allocator recursions into the filesystem Sage Weil
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:15 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-buf-3 --]
[-- Type: text/plain, Size: 1057 bytes --]
xfs_readlink_bmap is called with i_lock held, but i_lock is taken in
reclaim context so all allocations under it must avoid recursions into
the filesystem.
Reported by the new reclaim context tracing in lockdep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/xfs/xfs_vnodeops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_vnodeops.c 2009-07-18 20:29:59.041657600 +0200
+++ linux-2.6/fs/xfs/xfs_vnodeops.c 2009-07-18 20:31:22.964535322 +0200
@@ -547,7 +547,9 @@ xfs_readlink_bmap(
d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
- bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0);
+ bp = xfs_buf_read_flags(mp->m_ddev_targp, d, BTOBB(byte_cnt),
+ XBF_LOCK | XBF_MAPPED |
+ XBF_DONT_BLOCK);
error = XFS_BUF_GETERROR(bp);
if (error) {
xfs_ioerror_alert("xfs_readlink",
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 9/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_get
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (7 preceding siblings ...)
2009-07-18 22:15 ` [PATCH 8/9] xfs: switch to NOFS allocation under i_lock in xfs_readlink_bmap Christoph Hellwig
@ 2009-07-18 22:15 ` Christoph Hellwig
2009-07-30 18:56 ` [PATCH 0/9] fixes for memory allocator recursions into the filesystem Sage Weil
9 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2009-07-18 22:15 UTC (permalink / raw)
To: xfs; +Cc: sage
[-- Attachment #1: xfs-lockdep-buf-4 --]
[-- Type: text/plain, Size: 975 bytes --]
xfs_attr_rmtval_get is always called with i_lock held, but i_lock is taken
in reclaim context so all allocations under it must avoid recursions into
the filesystem.
Reported by the new reclaim context tracing in lockdep.
Index: linux-2.6/fs/xfs/xfs_attr.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_attr.c 2009-07-18 22:34:08.947532301 +0200
+++ linux-2.6/fs/xfs/xfs_attr.c 2009-07-18 22:35:44.786660003 +0200
@@ -2010,7 +2010,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno,
- blkcnt, XFS_BUF_LOCK, &bp);
+ blkcnt,
+ XFS_BUF_LOCK | XBF_DONT_BLOCK,
+ &bp);
if (error)
return(error);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0/9] fixes for memory allocator recursions into the filesystem
2009-07-18 22:14 [PATCH 0/9] fixes for memory allocator recursions into the filesystem Christoph Hellwig
` (8 preceding siblings ...)
2009-07-18 22:15 ` [PATCH 9/9] xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_get Christoph Hellwig
@ 2009-07-30 18:56 ` Sage Weil
2009-07-30 19:03 ` Christoph Hellwig
9 siblings, 1 reply; 13+ messages in thread
From: Sage Weil @ 2009-07-30 18:56 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
Hi Christoph,
I just noticed another warning (the same as the second one I sent
before) with your patchset applied to 2.6.30. This is the unresolved
iolock issue you mentioned? Just FYI.
sage
[ 4328.303413] =================================
[ 4328.305294] [ INFO: inconsistent lock state ]
[ 4328.305294] 2.6.30 #24
[ 4328.305294] ---------------------------------
[ 4328.305294] inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
[ 4328.305294] kswapd0/290 [HC0[0]:SC0[0]:HE1:SE1] takes:
[ 4328.305294] (&(&ip->i_iolock)->mr_lock){++++?+}, at: [<ffffffff803afe7e>] xfs_ilock+0x27/0x79
[ 4328.305294] {RECLAIM_FS-ON-W} state was registered at:
[ 4328.305294] [<ffffffff8025c43b>] mark_held_locks+0x4d/0x6b
[ 4328.305294] [<ffffffff8025c501>] lockdep_trace_alloc+0xa8/0xc3
[ 4328.305294] [<ffffffff80287fba>] __alloc_pages_internal+0x6d/0x457
[ 4328.305294] [<ffffffff802a8348>] alloc_pages_current+0xbe/0xc6
[ 4328.305294] [<ffffffff80281f85>] grab_cache_page_write_begin+0x5e/0xa2
[ 4328.305294] [<ffffffff802d300d>] block_write_begin+0x3d/0xcf
[ 4328.305294] [<ffffffff803cbf84>] xfs_vm_write_begin+0x25/0x27
[ 4328.305294] [<ffffffff80282926>] generic_file_buffered_write+0x139/0x2ff
[ 4328.305294] [<ffffffff803d207e>] xfs_write+0x4de/0x717
[ 4328.305294] [<ffffffff803cea45>] xfs_file_aio_write+0x61/0x63
[ 4328.305294] [<ffffffff802b0d7a>] do_sync_write+0xe7/0x12d
[ 4328.305294] [<ffffffff802b172f>] vfs_write+0xae/0x137
[ 4328.305294] [<ffffffff802b187c>] sys_write+0x47/0x6e
[ 4328.305294] [<ffffffff8020bb2b>] system_call_fastpath+0x16/0x1b
[ 4328.305294] [<ffffffffffffffff>] 0xffffffffffffffff
[ 4328.305294] irq event stamp: 8357751
[ 4328.305294] hardirqs last enabled at (8357751): [<ffffffff8062d0ec>] _spin_unlock_irqrestore+0x3f/0x68
[ 4328.450537] hardirqs last disabled at (8357750): [<ffffffff8062d440>] _spin_lock_irqsave+0x19/0x7f
[ 4328.450537] softirqs last enabled at (8357742): [<ffffffff80240910>] __do_softirq+0x1d9/0x1e5
[ 4328.450537] softirqs last disabled at (8357721): [<ffffffff8020ccbc>] call_softirq+0x1c/0x28
[ 4328.450537]
[ 4328.450537] other info that might help us debug this:
[ 4328.450537] 2 locks held by kswapd0/290:
[ 4328.450537] #0: (shrinker_rwsem){++++..}, at: [<ffffffff8028db78>] shrink_slab+0x38/0x188
[ 4328.450537] #1: (iprune_mutex){+.+.-.}, at: [<ffffffff802c3f97>] shrink_icache_memory+0x4b/0x23b
[ 4328.514337]
[ 4328.514337] stack backtrace:
[ 4328.518349] Pid: 290, comm: kswapd0 Not tainted 2.6.30 #24
[ 4328.522330] Call Trace:
[ 4328.522330] [<ffffffff8025bea5>] print_usage_bug+0x1b2/0x1c3
[ 4328.522330] [<ffffffff8025ca86>] ? check_usage_forwards+0x0/0x9c
[ 4328.522330] [<ffffffff8025c1b0>] mark_lock+0x2fa/0x538
[ 4328.522330] [<ffffffff8025db79>] __lock_acquire+0x80d/0x16a9
[ 4328.522330] [<ffffffff8025eb0b>] lock_acquire+0xf6/0x11a
[ 4328.522330] [<ffffffff803afe7e>] ? xfs_ilock+0x27/0x79
[ 4328.522330] [<ffffffff80252b5d>] down_write_nested+0x46/0x7a
[ 4328.522330] [<ffffffff803afe7e>] ? xfs_ilock+0x27/0x79
[ 4328.522330] [<ffffffff803afe7e>] xfs_ilock+0x27/0x79
[ 4328.522330] [<ffffffff803aff8c>] xfs_ireclaim+0x8d/0x153
[ 4328.522330] [<ffffffff803d47c8>] xfs_reclaim_inode+0x131/0x13f
[ 4328.522330] [<ffffffff803c6ae4>] xfs_reclaim+0x98/0xa9
[ 4328.522330] [<ffffffff803d2e86>] xfs_fs_destroy_inode+0x37/0x57
[ 4328.522330] [<ffffffff802c3e3f>] destroy_inode+0x3a/0x4f
[ 4328.522330] [<ffffffff802c3f18>] dispose_list+0xc4/0xf8
[ 4328.522330] [<ffffffff802c4151>] shrink_icache_memory+0x205/0x23b
[ 4328.522330] [<ffffffff8028dc1f>] shrink_slab+0xdf/0x188
[ 4328.522330] [<ffffffff8028e475>] kswapd+0x4fc/0x6b2
[ 4328.522330] [<ffffffff80232d48>] ? finish_task_switch+0x3b/0xdc
[ 4328.522330] [<ffffffff8028bbb4>] ? isolate_pages_global+0x0/0x208
[ 4328.522330] [<ffffffff8024fdbc>] ? autoremove_wake_function+0x0/0x38
[ 4328.522330] [<ffffffff8025c70c>] ? trace_hardirqs_on+0xd/0xf
[ 4328.522330] [<ffffffff8028df79>] ? kswapd+0x0/0x6b2
[ 4328.522330] [<ffffffff8028df79>] ? kswapd+0x0/0x6b2
[ 4328.522330] [<ffffffff8024f97d>] kthread+0x56/0x83
[ 4328.522330] [<ffffffff8020cbba>] child_rip+0xa/0x20
[ 4328.522330] [<ffffffff8020c580>] ? restore_args+0x0/0x30
[ 4328.522330] [<ffffffff8062a00f>] ? __schedule+0xf9/0x948
[ 4328.522330] [<ffffffff8024f927>] ? kthread+0x0/0x83
[ 4328.522330] [<ffffffff8020cbb0>] ? child_rip+0x0/0x20
On Sat, 18 Jul 2009, Christoph Hellwig wrote:
> lockdep has recently start tracking if a lock is used in reclaim context
> and if so warns if we do allocations without the NOFS flag inside it.
>
> This patch series fixes the easy targers involving the i_lock by switching
> various allocations to the NOFS variant, or in case of the growfs code
> moving the allocation out of the lock.
>
> We still have some more issues that involve the iolock, but I think we
> can simply get rid of the iolock in the reclaim path, but I'll send that
> our for a separate discussion.
>
> Sage, this should fix the two reports you've sent a while ago.
>
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread