In actual allocation of file system blocks and freeing extents, the transaction
within each such operation may involve multiple locking of AGF buffer. While the
freeing extent function has sorted the extents based on AGF number before
entering
into transaction, however, when the file system space is very limited, the
allocation
of space would try every AGF to get space allocated, this could potentially
cause
out-of-order locking, thus deadlock could happen. This fix mitigates the scarce
space
for allocation by setting aside a few blocks without reservation, and avoid
deadlock
by maintaining ascending order of AGF locking.
Date: Tue May 23 12:28:08 PDT 2006
Workarea: attica.americas.sgi.com:/data/lwork/attica3/yingping/xfs_kern_947395
Inspected by: felixb,nathans
The following file(s) were checked into:
bonnie.engr.sgi.com:/isms/xfs-kern/xfs-linux
Modid: xfs-linux:xfs-kern:210801a
xfs_bmap_btree.c - 1.152 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_bmap_btree.c.diff?r1=text&tr1=1.152&r2=text&tr2=1.151&f=h
- Ensure no out-of-order locking of AGF in specifying allocation type
for
calling xfs_alloc_vextent.
xfs_mount.c - 1.378 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_mount.c.diff?r1=text&tr1=1.378&r2=text&tr2=1.377&f=h
- Set aside a few blocks that will not be reserved in delayed
allocation. This
will mitigate the situation where the allocator has to search for any
possible
AGF for space when space is very limited.
xfs_alloc.c - 1.180 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_alloc.c.diff?r1=text&tr1=1.180&r2=text&tr2=1.179&f=h
- Changed xfs_alloc_vextent, xfs_free_extent and
xfs_alloc_fix_freelist. In
xfs_alloc_vextent, we ensure the locking of AGF from the same
transaction does
not run out of order by forcing the AGF number is greater than the
previous
one in the second invocation. In xfs_alloc_fix_freelist, we
distinguish the
call from xfs_alloc_vextent from xfs_free_extent. Free space checking
is
enforced for call from xfs_alloc_vextent.
xfs_alloc.h - 1.60 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_alloc.h.diff?r1=text&tr1=1.60&r2=text&tr2=1.59&f=h
- Add a new flag XFS_ALLOC_FLAG_FREEING to indicate whether the caller
is
freeing or allocating. Add a field firstblock in structure
xfs_alloc_arg to
indicate whether this is the first allocation request.
xfs_bmap.c - 1.349 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_bmap.c.diff?r1=text&tr1=1.349&r2=text&tr2=1.348&f=h
- Ensure no out-of-order locking of AGF in specifying allocation type
for
calling xfs_alloc_vextent.
|