xfs
[Top] [All Lists]

[PATCH] xfs: fix brown paperbag quota-aware stafs bug

To: nathans@xxxxxxx, xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: fix brown paperbag quota-aware stafs bug
From: Christoph Hellwig <hch@xxxxxx>
Date: Mon, 10 Jul 2006 18:55:39 +0200
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
All xfs_disk_dquot_t values are (as the name says) disk endian.  Before
putting them into struct statfs they should be endian-swapped.

(I wish someone at SGI would run sparse once in a while..)


Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs-2.6.x/fs/xfs/quota/xfs_qm_bhv.c
===================================================================
--- xfs-2.6.x.orig/fs/xfs/quota/xfs_qm_bhv.c    2006-07-09 19:28:21.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/quota/xfs_qm_bhv.c 2006-07-09 20:04:56.000000000 +0200
@@ -217,17 +217,24 @@
                return 0;
        dp = &dqp->q_core;
 
-       limit = dp->d_blk_softlimit ? dp->d_blk_softlimit : dp->d_blk_hardlimit;
+       limit = dp->d_blk_softlimit ?
+               be64_to_cpu(dp->d_blk_softlimit) :
+               be64_to_cpu(dp->d_blk_hardlimit);
        if (limit && statp->f_blocks > limit) {
                statp->f_blocks = limit;
-               statp->f_bfree = (statp->f_blocks > dp->d_bcount) ?
-                                       (statp->f_blocks - dp->d_bcount) : 0;
+               statp->f_bfree =
+                       (statp->f_blocks > be64_to_cpu(dp->d_bcount)) ?
+                        (statp->f_blocks - be64_to_cpu(dp->d_bcount)) : 0;
        }
-       limit = dp->d_ino_softlimit ? dp->d_ino_softlimit : dp->d_ino_hardlimit;
+
+       limit = dp->d_ino_softlimit ?
+               be64_to_cpu(dp->d_ino_softlimit) :
+               be64_to_cpu(dp->d_ino_hardlimit);
        if (limit && statp->f_files > limit) {
                statp->f_files = limit;
-               statp->f_ffree = (statp->f_files > dp->d_icount) ?
-                                       (statp->f_ffree - dp->d_icount) : 0;
+               statp->f_ffree =
+                       (statp->f_files > be64_to_cpu(dp->d_icount)) ?
+                        (statp->f_ffree - be64_to_cpu(dp->d_icount)) : 0;
        }
 
        xfs_qm_dqput(dqp);


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