xfs
[Top] [All Lists]

Are two transactions running in parallel OK?

To: xfs@xxxxxxxxxxx
Subject: Are two transactions running in parallel OK?
From: Jan Kara <jack@xxxxxxx>
Date: Thu, 17 May 2012 22:08:31 +0200
Cc: sandeen@xxxxxxxxxx, dchinner@xxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
  Hello,

  I've been into a source of lockdep warning I got with XFS when testing my
filesystem freezing patches. The culprit seems to be that when doing direct
IO, XFS starts a transaction in xfs_setfilesize_trans_alloc() and attaches
that transaction to endio structure. Then it goes on and starts another
transaction in xfs_iomap_write_direct() which creates a possible deadlock
with filesystem freezing (if the second transaction start happens after we
start blocking new transactions, it gets blocked, but the first transaction
isn't ever completed).

So first I wanted to ask whether my analysis is correct. If yes, I was also
wondering whether this cannot cause a deadlock (at least in theory) if the
second transaction would block waiting for log space but we couldn't
possibly free enough of it due to the first transaction being held open?

If freezing deadlock is the only problem with this code, then I guess we
could avoid waiting for filesystem freezing when starting the second
transaction (although it might end up being rather ugly). Or if anyone else
has other idea how to solve this, I'm listening ;).

                                                                Honza

-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR

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