xfs
[Top] [All Lists]

Re: a deadlock at xfs_growfs

To: ASANO Masahiro <masano@xxxxxxxxxxxxxx>
Subject: Re: a deadlock at xfs_growfs
From: Nathan Scott <nathans@xxxxxxx>
Date: Wed, 25 Aug 2004 17:30:42 +1000
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <20040825.140454.1025204076.masano@tnes.nec.co.jp>; from masano@tnes.nec.co.jp on Wed, Aug 25, 2004 at 02:04:54PM +0900
References: <20040825.125949.424242868.masano@tnes.nec.co.jp> <20040825053035.GB9823@frodo> <20040825.140454.1025204076.masano@tnes.nec.co.jp>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5i
On Wed, Aug 25, 2004 at 02:04:54PM +0900, ASANO Masahiro wrote:
> Hi Nathan,
> 
> Thank you for your quick response.
> But I have another problem report for xfs_growfs. :-p
> 
> Growing a filesystem in heavy dinode allocate/deallocate situation may
> cause a deadlock.
> It looks that (a)a process which hold m_peraglock as reading is
> waiting for a pagebuf(AGI), and (b)another process which hold the
> pagebuf(AGI) is waiting for down_read m_peraglock, while (c)xfs_growfs
> is waiting for down_write m_peraglock.

Hmm, I don't see the code path where (b) - the rm process - can
be holding the AGI buffer locked while trying to down m_peraglock?
That would seem to be an ABBA deadlock, with (a) - the tar - (but
the growfs process wouldn't even be involved?).  Where is it that
the xfs_ifree/xfs_difree takes the AGI buffer lock before trying to
grab the peraglock?

The correct order would be first m_peraglock, then the AGI buffer,
and I can't see anything that violates that in the code paths where
you're deadlocked processes are.  Odd.

> The following is a kernel backtrace. Its kernel version was 2.4.25,
> but I guess that the recent kernel also has the same problem. What do
> you think of it?

I would expect this deadlock still exists, I don't remember fixing
it or seeing anyone else fix it - do you have a reproducible test
case?

thanks.

> (a) PID = 3879 (tar)
>  c76efa7c  c01176f9  schedule+2b9 ()
> [c76efabc] c0105ff2  __down+82 (c1f23594,c1f235c8,0)
> [c76efae0] c010618c  __down_failed+8 ()
> [c76efaf0] c0240bc0  [.text.lock.xfs_buf+8a]
> [c76efaf0] c023ee04  pagebuf_lock+24 (c1f23594ds,2ee00400,0,cbf7cac0)
> [c76efafc] c023e6e3  _pagebuf_find+1b3 (c97ca67c,177002,0,200)
> [c76efb30] c023e7f7  pagebuf_get+77 (c97ca67c,177002,0,1)
> [c76efb60] c0227df4  xfs_trans_read_buf+184 
> (c38a1400,cbc495b4,c97ca67c,177002)
> [c76efb88] c0208c7e  xfs_ialloc_read_agi+8e (c38a1400,cbc495b4,6,c76efbf0)
> [c76efbc8] c0207434  xfs_ialloc_ag_select+244 (cbc495b4,3007d7,0,81a4)
> [c76efc04] c020802f  xfs_dialloc+b4f (cbc495b4,3007d7,0,81a4)
> [c76efcb4] c020ee74  xfs_ialloc+64 (cbc495b4,c239cbc4,81a4,1)
> [c76efcf8] c022928b  xfs_dir_ialloc+8b (c76efdc8,c239cbc4,81a4,1)
> [c76efd5c] c022efe7  xfs_create+3b7 (c239cbe4,cb746824,c76efe88,c76efe14)
> [c76efdfc] c0239821  linvfs_mknod+181 (cb312634,cb746824,81a4,0)
> [c76eff08] c02398a7  linvfs_create+27 (cb312634,cb746824,81a4,c76ee000)
> [c76eff1c] c014e62d  vfs_create+10d (cb312634,cb746824,1a4,c76eff8c)
> [c76eff40] c014ed45  open_namei+645 (c6ba2000,80c2,1a4,c76eff84)
> [c76eff70] c0140623  filp_open+43 (c6ba2000,80c1,1a4,c76ee000)
> [c76effa8] c0140a23  sys_open+53 (8072190,80c1,1a4,80c1)
> [c76effc0] c010761f  system_call+33 ()
> 
> (b) PID = 3946 (rm)
>  c3d91d8c  c01176f9  schedule+2b9 ()
> [c3d91dcc] c039082c  rwsem_down_failed_common+5c 
> (c38a15d4,c3d91df0,fffeffff,c5c71e0c)
> [c3d91de0] c0390679  rwsem_down_read_failed+29 (c38a1400,c38a1400)
> [c3d91e04] c0208fb1  .text.lock.xfs_ialloc+d7 (?c6173d50,a4,a7)
> [c3d91e14] c0208169  xfs_difree+129 ()
> [c3d91e90] c021057e  xfs_ifree+5e (c008ef38,c81e2964,c3d91ee8,0)
> [c3d91ec0] c022e8a6  xfs_inactive+276 (c81e2984,0,c2a78e1c,0)
> [c3d91f08] c023dab1  vn_rele+b1 (c2a78e1c,c2a78e3c,c015a4b2,c2a78e3c)
> [c3d91f20] c023c088  linvfs_clear_inode+18 
> (c2a78e3c,c2a78e3c,c015af78,c2a78e3c)
> [c3d91f2c] c015a4b2  clear_inode+102 (c2a78e3c,c04c1300,c5229750,c6a26898)
> [c3d91f38] c015af78  iput+b8 (c2a78e3c,0,0,c5229750)
> [c3d91f54] c0158bd2  d_delete+a2 (c6a26898,c6a26898,c689a000,c6a26898)
> [c3d91f68] c014faf5  vfs_unlink+185 (c5229750,c6a26898,c5c858ec,cbff9214)
> [c3d91f84] c014fd69  sys_unlink+119 (805313b,2,bffffac0,8053128)
> [c3d91fc0] c010761f  system_call+33 ()
> 
> (c) PID = 3947 (xfs_growfs)
>  c33f9d90  c01176f9  schedule+2b9 ()
> [c33f9dd0] c039082c  rwsem_down_failed_common+5c 
> (c38a15d4,c33f9df4,ffffffff,c1225978)
> [c33f9de4] c03906b9  rwsem_down_write_failed+29 (c272c704)
> [c33f9e08] c0206a4c  .text.lock.xfs_fsops+6 (?0,c057d118,c1232cc4,44)
> [c33f9e08] c0206306  xfs_growfs_data_private+7 ()
> [c33f9eb0] c02064c0  xfs_growfs_data+50 (c38a1400,c33f9f14,c,c767278c)
> [c33f9ec4] c02383c1  xfs_ioctl+261 (c1718c84,c7e31200,c3b88cb4,0)
> [c33f9f74] c023706b  linvfs_ioctl+3b (c7e31200,c3b88cb4,400c586e,bffff8b0)
> [c33f9f94] c0152b75  sys_ioctl+f5 (3,400c586e,bffff8b0,7e6000)
> [c33f9fc0] c010761f  system_call+33 ()

-- 
Nathan


<Prev in Thread] Current Thread [Next in Thread>