* Review: Fix dbflush panic in xfs_qm_sync
@ 2007-10-15 23:29 Donald Douwsma
2007-10-16 5:18 ` Lachlan McIlroy
2007-10-18 16:16 ` Christoph Hellwig
0 siblings, 2 replies; 5+ messages in thread
From: Donald Douwsma @ 2007-10-15 23:29 UTC (permalink / raw)
To: xfs-oss
The recent behaviour layer removal dropped the check for quotas that have been
requested at mount time but have subsequently been turned off. This results
in a panic when accessing m_quotainfo which has been freed.
This patch adds the check originally made by xfs_qm_syncall() to xfs_qm_sync()
Signed-off-by: Donald Douwsma <donaldd@sgi.com>
--- 2.6.x-xfs.orig/fs/xfs/quota/xfs_qm.c
+++ 2.6.x-xfs/fs/xfs/quota/xfs_qm.c
@@ -1007,6 +1007,9 @@ xfs_qm_sync(
boolean_t nowait;
int error;
+ if (! XFS_IS_QUOTA_ON(mp))
+ return 0;
+
restarts = 0;
/*
* We won't block unless we are asked to.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Review: Fix dbflush panic in xfs_qm_sync
2007-10-15 23:29 Review: Fix dbflush panic in xfs_qm_sync Donald Douwsma
@ 2007-10-16 5:18 ` Lachlan McIlroy
2007-10-16 6:07 ` David Chinner
2007-10-18 16:16 ` Christoph Hellwig
1 sibling, 1 reply; 5+ messages in thread
From: Lachlan McIlroy @ 2007-10-16 5:18 UTC (permalink / raw)
To: Donald Douwsma; +Cc: xfs-oss
Could mp->m_quotainfo become NULL after this check but before we
lock the list with xfs_qm_mplist_lock()? There doesn't seem to
be any locking to protect changes to this field?
Donald Douwsma wrote:
> The recent behaviour layer removal dropped the check for quotas that
> have been
> requested at mount time but have subsequently been turned off. This results
> in a panic when accessing m_quotainfo which has been freed.
>
> This patch adds the check originally made by xfs_qm_syncall() to
> xfs_qm_sync()
>
>
> Signed-off-by: Donald Douwsma <donaldd@sgi.com>
>
> --- 2.6.x-xfs.orig/fs/xfs/quota/xfs_qm.c
> +++ 2.6.x-xfs/fs/xfs/quota/xfs_qm.c
> @@ -1007,6 +1007,9 @@ xfs_qm_sync(
> boolean_t nowait;
> int error;
>
> + if (! XFS_IS_QUOTA_ON(mp))
> + return 0;
> +
> restarts = 0;
> /*
> * We won't block unless we are asked to.
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Review: Fix dbflush panic in xfs_qm_sync
2007-10-16 5:18 ` Lachlan McIlroy
@ 2007-10-16 6:07 ` David Chinner
2007-10-17 1:54 ` Donald Douwsma
0 siblings, 1 reply; 5+ messages in thread
From: David Chinner @ 2007-10-16 6:07 UTC (permalink / raw)
To: Lachlan McIlroy; +Cc: Donald Douwsma, xfs-oss
On Tue, Oct 16, 2007 at 03:18:02PM +1000, Lachlan McIlroy wrote:
> Could mp->m_quotainfo become NULL after this check but before we
> lock the list with xfs_qm_mplist_lock()? There doesn't seem to
> be any locking to protect changes to this field?
Possible - in theory. Likely - no. We do the same unlocked check in a
few places...
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Review: Fix dbflush panic in xfs_qm_sync
2007-10-16 6:07 ` David Chinner
@ 2007-10-17 1:54 ` Donald Douwsma
0 siblings, 0 replies; 5+ messages in thread
From: Donald Douwsma @ 2007-10-17 1:54 UTC (permalink / raw)
To: David Chinner; +Cc: Lachlan McIlroy, xfs-oss
David Chinner wrote:
> On Tue, Oct 16, 2007 at 03:18:02PM +1000, Lachlan McIlroy wrote:
>> Could mp->m_quotainfo become NULL after this check but before we
>> lock the list with xfs_qm_mplist_lock()? There doesn't seem to
>> be any locking to protect changes to this field?
>
> Possible - in theory. Likely - no. We do the same unlocked check in a
> few places...
>
The mplist lock doesnt prevent the quotainfo going away while its held.
It's just guarding a hashlist that lives in quotainfo structure.
So none of this code prevents a quotaoff race.
In the short term this change restores the original checks. But in the
longer term we should review the locking in the quota system, possibly
adding a quotaoff lock to xfs_mount_t.
Don
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Review: Fix dbflush panic in xfs_qm_sync
2007-10-15 23:29 Review: Fix dbflush panic in xfs_qm_sync Donald Douwsma
2007-10-16 5:18 ` Lachlan McIlroy
@ 2007-10-18 16:16 ` Christoph Hellwig
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2007-10-18 16:16 UTC (permalink / raw)
To: Donald Douwsma; +Cc: xfs-oss
On Tue, Oct 16, 2007 at 09:29:23AM +1000, Donald Douwsma wrote:
> The recent behaviour layer removal dropped the check for quotas that have
> been
> requested at mount time but have subsequently been turned off. This results
> in a panic when accessing m_quotainfo which has been freed.
>
> This patch adds the check originally made by xfs_qm_syncall() to
> xfs_qm_sync()
Hmm. We do the same check just a few lines below, but inbetween
we access ->m_quotainfo to take the lock. I was under the impression
that's the only safe way to check anyway, but ->m_quotainfo might not
actually be present. It might me better to move the lock into xfs_mount
directly, but it's embedded into a xfs_dqhash and there's some complex
mess with gazillions of macros around it.
So I suspect restoring it to the original state might be good enough.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-18 16:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 23:29 Review: Fix dbflush panic in xfs_qm_sync Donald Douwsma
2007-10-16 5:18 ` Lachlan McIlroy
2007-10-16 6:07 ` David Chinner
2007-10-17 1:54 ` Donald Douwsma
2007-10-18 16:16 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox