xfs: use KM_NOFS for allocations during attribute list operations
When listing attributes, we are doiing memory allocations under the inode ilock using only KM_SLEEP. This allows memory allocation to recurse back into the filesystem and do writeback, which may the ilock we already hold on the current inode. THis will deadlock. Hence use KM_NOFS for such allocations outside of transaction context to ensure that reclaim recursion does not occur. Reported-by: Nick Piggin <npiggin@gmail.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
committed by
Dave Chinner
parent
dcfcf20512
commit
622d81494f
@@ -637,7 +637,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
|
|||||||
* It didn't all fit, so we have to sort everything on hashval.
|
* It didn't all fit, so we have to sort everything on hashval.
|
||||||
*/
|
*/
|
||||||
sbsize = sf->hdr.count * sizeof(*sbuf);
|
sbsize = sf->hdr.count * sizeof(*sbuf);
|
||||||
sbp = sbuf = kmem_alloc(sbsize, KM_SLEEP);
|
sbp = sbuf = kmem_alloc(sbsize, KM_SLEEP | KM_NOFS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan the attribute list for the rest of the entries, storing
|
* Scan the attribute list for the rest of the entries, storing
|
||||||
@@ -2386,7 +2386,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
|
|||||||
args.dp = context->dp;
|
args.dp = context->dp;
|
||||||
args.whichfork = XFS_ATTR_FORK;
|
args.whichfork = XFS_ATTR_FORK;
|
||||||
args.valuelen = valuelen;
|
args.valuelen = valuelen;
|
||||||
args.value = kmem_alloc(valuelen, KM_SLEEP);
|
args.value = kmem_alloc(valuelen, KM_SLEEP | KM_NOFS);
|
||||||
args.rmtblkno = be32_to_cpu(name_rmt->valueblk);
|
args.rmtblkno = be32_to_cpu(name_rmt->valueblk);
|
||||||
args.rmtblkcnt = XFS_B_TO_FSB(args.dp->i_mount, valuelen);
|
args.rmtblkcnt = XFS_B_TO_FSB(args.dp->i_mount, valuelen);
|
||||||
retval = xfs_attr_rmtval_get(&args);
|
retval = xfs_attr_rmtval_get(&args);
|
||||||
|
Reference in New Issue
Block a user