public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Fix quota type in quota structures when reusing quota file
@ 2015-02-17 15:57 Jan Kara
  2015-02-25 10:40 ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2015-02-17 15:57 UTC (permalink / raw)
  To: xfs; +Cc: Jan Kara, Al Viro, stable

For filesystems without separate project quota inode field in the
superblock we just reuse project quota file for group quotas (and vice
versa) if project quota file is allocated and we need group quota file.
When we reuse the file, quota structures on disk suddenly have wrong
type stored in d_flags though. Nobody really cares about this (although
structure type reported to userspace was wrong as well) except
that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
->set_dqblk() to use bytes as space units) assertion in
xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
was testing without XFS_DEBUG so I didn't notice when submitting the
above commit).

Fix the problem by properly resetting ddq->d_flags when running quotacheck
for a quota file.

CC: stable@vger.kernel.org
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_qm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 3e8186279541..dd0dcc7b76cd 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -836,6 +836,11 @@ xfs_qm_reset_dqcounts(
 		 */
 		xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
 			    "xfs_quotacheck");
+		/*
+		 * Reset type in case we are reusing group quota file for
+		 * project quotas or vice versa
+		 */
+		ddq->d_flags = type;
 		ddq->d_bcount = 0;
 		ddq->d_icount = 0;
 		ddq->d_rtbcount = 0;
-- 
2.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: Fix quota type in quota structures when reusing quota file
  2015-02-17 15:57 [PATCH] xfs: Fix quota type in quota structures when reusing quota file Jan Kara
@ 2015-02-25 10:40 ` Jan Kara
  2015-02-25 12:45   ` Brian Foster
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2015-02-25 10:40 UTC (permalink / raw)
  To: xfs; +Cc: Jan Kara, Al Viro

  Ping? Can you guys please review / pick-up the fix? Thanks!

								Honza

On Tue 17-02-15 16:57:10, Jan Kara wrote:
> For filesystems without separate project quota inode field in the
> superblock we just reuse project quota file for group quotas (and vice
> versa) if project quota file is allocated and we need group quota file.
> When we reuse the file, quota structures on disk suddenly have wrong
> type stored in d_flags though. Nobody really cares about this (although
> structure type reported to userspace was wrong as well) except
> that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
> ->set_dqblk() to use bytes as space units) assertion in
> xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
> was testing without XFS_DEBUG so I didn't notice when submitting the
> above commit).
> 
> Fix the problem by properly resetting ddq->d_flags when running quotacheck
> for a quota file.
> 
> CC: stable@vger.kernel.org
> Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_qm.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 3e8186279541..dd0dcc7b76cd 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -836,6 +836,11 @@ xfs_qm_reset_dqcounts(
>  		 */
>  		xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
>  			    "xfs_quotacheck");
> +		/*
> +		 * Reset type in case we are reusing group quota file for
> +		 * project quotas or vice versa
> +		 */
> +		ddq->d_flags = type;
>  		ddq->d_bcount = 0;
>  		ddq->d_icount = 0;
>  		ddq->d_rtbcount = 0;
> -- 
> 2.1.4
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: Fix quota type in quota structures when reusing quota file
  2015-02-25 10:40 ` Jan Kara
@ 2015-02-25 12:45   ` Brian Foster
  2015-02-25 14:17     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Foster @ 2015-02-25 12:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: Al Viro, xfs

On Wed, Feb 25, 2015 at 11:40:57AM +0100, Jan Kara wrote:
>   Ping? Can you guys please review / pick-up the fix? Thanks!
> 

Looks like this is in Dave's tree:

commit dfcc70a8c868fe03276fa59864149708fb41930b
Author: Jan Kara <jack@suse.cz>
Date:   Mon Feb 23 22:34:17 2015 +1100

    xfs: Fix quota type in quota structures when reusing quota file

...

Brian

> 								Honza
> 
> On Tue 17-02-15 16:57:10, Jan Kara wrote:
> > For filesystems without separate project quota inode field in the
> > superblock we just reuse project quota file for group quotas (and vice
> > versa) if project quota file is allocated and we need group quota file.
> > When we reuse the file, quota structures on disk suddenly have wrong
> > type stored in d_flags though. Nobody really cares about this (although
> > structure type reported to userspace was wrong as well) except
> > that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
> > ->set_dqblk() to use bytes as space units) assertion in
> > xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
> > was testing without XFS_DEBUG so I didn't notice when submitting the
> > above commit).
> > 
> > Fix the problem by properly resetting ddq->d_flags when running quotacheck
> > for a quota file.
> > 
> > CC: stable@vger.kernel.org
> > Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  fs/xfs/xfs_qm.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> > index 3e8186279541..dd0dcc7b76cd 100644
> > --- a/fs/xfs/xfs_qm.c
> > +++ b/fs/xfs/xfs_qm.c
> > @@ -836,6 +836,11 @@ xfs_qm_reset_dqcounts(
> >  		 */
> >  		xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
> >  			    "xfs_quotacheck");
> > +		/*
> > +		 * Reset type in case we are reusing group quota file for
> > +		 * project quotas or vice versa
> > +		 */
> > +		ddq->d_flags = type;
> >  		ddq->d_bcount = 0;
> >  		ddq->d_icount = 0;
> >  		ddq->d_rtbcount = 0;
> > -- 
> > 2.1.4
> > 
> -- 
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: Fix quota type in quota structures when reusing quota file
  2015-02-25 12:45   ` Brian Foster
@ 2015-02-25 14:17     ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2015-02-25 14:17 UTC (permalink / raw)
  To: Brian Foster; +Cc: Jan Kara, Al Viro, xfs

On Wed 25-02-15 07:45:25, Brian Foster wrote:
> On Wed, Feb 25, 2015 at 11:40:57AM +0100, Jan Kara wrote:
> >   Ping? Can you guys please review / pick-up the fix? Thanks!
> > 
> 
> Looks like this is in Dave's tree:
> 
> commit dfcc70a8c868fe03276fa59864149708fb41930b
> Author: Jan Kara <jack@suse.cz>
> Date:   Mon Feb 23 22:34:17 2015 +1100
> 
>     xfs: Fix quota type in quota structures when reusing quota file
  Ah, sorry. I should have checked.

								Honza

> > On Tue 17-02-15 16:57:10, Jan Kara wrote:
> > > For filesystems without separate project quota inode field in the
> > > superblock we just reuse project quota file for group quotas (and vice
> > > versa) if project quota file is allocated and we need group quota file.
> > > When we reuse the file, quota structures on disk suddenly have wrong
> > > type stored in d_flags though. Nobody really cares about this (although
> > > structure type reported to userspace was wrong as well) except
> > > that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
> > > ->set_dqblk() to use bytes as space units) assertion in
> > > xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
> > > was testing without XFS_DEBUG so I didn't notice when submitting the
> > > above commit).
> > > 
> > > Fix the problem by properly resetting ddq->d_flags when running quotacheck
> > > for a quota file.
> > > 
> > > CC: stable@vger.kernel.org
> > > Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
> > > Signed-off-by: Jan Kara <jack@suse.cz>
> > > ---
> > >  fs/xfs/xfs_qm.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> > > index 3e8186279541..dd0dcc7b76cd 100644
> > > --- a/fs/xfs/xfs_qm.c
> > > +++ b/fs/xfs/xfs_qm.c
> > > @@ -836,6 +836,11 @@ xfs_qm_reset_dqcounts(
> > >  		 */
> > >  		xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
> > >  			    "xfs_quotacheck");
> > > +		/*
> > > +		 * Reset type in case we are reusing group quota file for
> > > +		 * project quotas or vice versa
> > > +		 */
> > > +		ddq->d_flags = type;
> > >  		ddq->d_bcount = 0;
> > >  		ddq->d_icount = 0;
> > >  		ddq->d_rtbcount = 0;
> > > -- 
> > > 2.1.4
> > > 
> > -- 
> > Jan Kara <jack@suse.cz>
> > SUSE Labs, CR
> > 
> > _______________________________________________
> > xfs mailing list
> > xfs@oss.sgi.com
> > http://oss.sgi.com/mailman/listinfo/xfs
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-25 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-17 15:57 [PATCH] xfs: Fix quota type in quota structures when reusing quota file Jan Kara
2015-02-25 10:40 ` Jan Kara
2015-02-25 12:45   ` Brian Foster
2015-02-25 14:17     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox