diff options
-rw-r--r-- | fs/xfs/xfs_dquot.c | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 22 | ||||
-rw-r--r-- | fs/xfs/xfs_quota.h | 1 |
4 files changed, 18 insertions, 34 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 1a2aa173ef21..b4ff40b5f918 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -552,7 +552,7 @@ xfs_qm_dqtobp( | |||
552 | * | 552 | * |
553 | * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed. | 553 | * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed. |
554 | */ | 554 | */ |
555 | STATIC int | 555 | int |
556 | xfs_qm_dqread( | 556 | xfs_qm_dqread( |
557 | struct xfs_mount *mp, | 557 | struct xfs_mount *mp, |
558 | xfs_dqid_t id, | 558 | xfs_dqid_t id, |
@@ -804,32 +804,17 @@ restart: | |||
804 | mutex_unlock(&h->qh_lock); | 804 | mutex_unlock(&h->qh_lock); |
805 | 805 | ||
806 | error = xfs_qm_dqread(mp, id, type, flags, &dqp); | 806 | error = xfs_qm_dqread(mp, id, type, flags, &dqp); |
807 | if (error) { | ||
808 | if (ip) | ||
809 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
810 | return error; | ||
811 | } | ||
812 | 807 | ||
813 | /* | 808 | if (ip) |
814 | * See if this is mount code calling to look at the overall quota limits | 809 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
815 | * which are stored in the id == 0 user or group's dquot. | 810 | |
816 | * Since we may not have done a quotacheck by this point, just return | 811 | if (error) |
817 | * the dquot without attaching it to any hashtables, lists, etc, or even | 812 | return error; |
818 | * taking a reference. | ||
819 | * The caller must dqdestroy this once done. | ||
820 | */ | ||
821 | if (flags & XFS_QMOPT_DQSUSER) { | ||
822 | ASSERT(id == 0); | ||
823 | ASSERT(! ip); | ||
824 | goto dqret; | ||
825 | } | ||
826 | 813 | ||
827 | /* | 814 | /* |
828 | * Dquot lock comes after hashlock in the lock ordering | 815 | * Dquot lock comes after hashlock in the lock ordering |
829 | */ | 816 | */ |
830 | if (ip) { | 817 | if (ip) { |
831 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
832 | |||
833 | /* | 818 | /* |
834 | * A dquot could be attached to this inode by now, since | 819 | * A dquot could be attached to this inode by now, since |
835 | * we had dropped the ilock. | 820 | * we had dropped the ilock. |
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index cc0149d217ba..a1d91d8f1802 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h | |||
@@ -129,6 +129,8 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp) | |||
129 | (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ | 129 | (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ |
130 | (XFS_IS_OQUOTA_ON((d)->q_mount)))) | 130 | (XFS_IS_OQUOTA_ON((d)->q_mount)))) |
131 | 131 | ||
132 | extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint, | ||
133 | uint, struct xfs_dquot **); | ||
132 | extern void xfs_qm_dqdestroy(xfs_dquot_t *); | 134 | extern void xfs_qm_dqdestroy(xfs_dquot_t *); |
133 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); | 135 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); |
134 | extern void xfs_qm_dqpurge(xfs_dquot_t *); | 136 | extern void xfs_qm_dqpurge(xfs_dquot_t *); |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index cd7460ba4e69..b8df0bda5a54 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -858,18 +858,21 @@ xfs_qm_init_quotainfo( | |||
858 | /* | 858 | /* |
859 | * We try to get the limits from the superuser's limits fields. | 859 | * We try to get the limits from the superuser's limits fields. |
860 | * This is quite hacky, but it is standard quota practice. | 860 | * This is quite hacky, but it is standard quota practice. |
861 | * | ||
861 | * We look at the USR dquot with id == 0 first, but if user quotas | 862 | * We look at the USR dquot with id == 0 first, but if user quotas |
862 | * are not enabled we goto the GRP dquot with id == 0. | 863 | * are not enabled we goto the GRP dquot with id == 0. |
863 | * We don't really care to keep separate default limits for user | 864 | * We don't really care to keep separate default limits for user |
864 | * and group quotas, at least not at this point. | 865 | * and group quotas, at least not at this point. |
866 | * | ||
867 | * Since we may not have done a quotacheck by this point, just read | ||
868 | * the dquot without attaching it to any hashtables or lists. | ||
865 | */ | 869 | */ |
866 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0, | 870 | error = xfs_qm_dqread(mp, 0, |
867 | XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER : | 871 | XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER : |
868 | (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP : | 872 | (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP : |
869 | XFS_DQ_PROJ), | 873 | XFS_DQ_PROJ), |
870 | XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN, | 874 | XFS_QMOPT_DOWARN, &dqp); |
871 | &dqp); | 875 | if (!error) { |
872 | if (! error) { | ||
873 | xfs_disk_dquot_t *ddqp = &dqp->q_core; | 876 | xfs_disk_dquot_t *ddqp = &dqp->q_core; |
874 | 877 | ||
875 | /* | 878 | /* |
@@ -896,11 +899,6 @@ xfs_qm_init_quotainfo( | |||
896 | qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); | 899 | qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); |
897 | qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); | 900 | qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); |
898 | 901 | ||
899 | /* | ||
900 | * We sent the XFS_QMOPT_DQSUSER flag to dqget because | ||
901 | * we don't want this dquot cached. We haven't done a | ||
902 | * quotacheck yet, and quotacheck doesn't like incore dquots. | ||
903 | */ | ||
904 | xfs_qm_dqdestroy(dqp); | 902 | xfs_qm_dqdestroy(dqp); |
905 | } else { | 903 | } else { |
906 | qinf->qi_btimelimit = XFS_QM_BTIMELIMIT; | 904 | qinf->qi_btimelimit = XFS_QM_BTIMELIMIT; |
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h index b86c62f5eeba..8a0807e0f979 100644 --- a/fs/xfs/xfs_quota.h +++ b/fs/xfs/xfs_quota.h | |||
@@ -197,7 +197,6 @@ typedef struct xfs_qoff_logformat { | |||
197 | #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ | 197 | #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ |
198 | #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ | 198 | #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ |
199 | #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ | 199 | #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ |
200 | #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */ | ||
201 | #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ | 200 | #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ |
202 | #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ | 201 | #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ |
203 | #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ | 202 | #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ |