diff options
author | Tim Shimmin <tes@sgi.com> | 2005-09-04 18:24:10 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-04 18:24:10 -0400 |
commit | 4cd4a034a3ef020d9de48fe0a3f5f976e5134669 (patch) | |
tree | d97e390aa0abd15212230b2b61cf0d15b8fbab8f /fs/xfs/quota | |
parent | 56d433e430eb399a4b6d0e73d28af6e1d4713547 (diff) |
[XFS] Need to be able to reset sb_qflags if not mounting with quotas
having previously mounted with quotas.
SGI-PV: 940491
SGI-Modid: xfs-linux:xfs-kern:23388a
Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 16 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 14 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 2 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_bhv.c | 44 |
4 files changed, 4 insertions, 72 deletions
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h index 39175103c8e0..8ebc87176c78 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/quota/xfs_dquot.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -113,20 +113,6 @@ typedef struct xfs_dquot { | |||
113 | 113 | ||
114 | #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) | 114 | #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) |
115 | 115 | ||
116 | /* | ||
117 | * Quota Accounting/Enforcement flags | ||
118 | */ | ||
119 | #define XFS_ALL_QUOTA_ACCT \ | ||
120 | (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) | ||
121 | #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) | ||
122 | #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) | ||
123 | |||
124 | #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) | ||
125 | #define XFS_IS_QUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ENFD) | ||
126 | #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) | ||
127 | #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) | ||
128 | #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) | ||
129 | |||
130 | #ifdef DEBUG | 116 | #ifdef DEBUG |
131 | static inline int | 117 | static inline int |
132 | XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) | 118 | XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 4badf38df5e9..efde16e0a913 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -365,16 +365,6 @@ xfs_qm_mount_quotas( | |||
365 | int error = 0; | 365 | int error = 0; |
366 | uint sbf; | 366 | uint sbf; |
367 | 367 | ||
368 | /* | ||
369 | * If a file system had quotas running earlier, but decided to | ||
370 | * mount without -o uquota/pquota/gquota options, revoke the | ||
371 | * quotachecked license, and bail out. | ||
372 | */ | ||
373 | if (! XFS_IS_QUOTA_ON(mp) && | ||
374 | (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT)) { | ||
375 | mp->m_qflags = 0; | ||
376 | goto write_changes; | ||
377 | } | ||
378 | 368 | ||
379 | /* | 369 | /* |
380 | * If quotas on realtime volumes is not supported, we disable | 370 | * If quotas on realtime volumes is not supported, we disable |
@@ -2002,7 +1992,7 @@ xfs_qm_quotacheck( | |||
2002 | ASSERT(mp->m_quotainfo != NULL); | 1992 | ASSERT(mp->m_quotainfo != NULL); |
2003 | ASSERT(xfs_Gqm != NULL); | 1993 | ASSERT(xfs_Gqm != NULL); |
2004 | xfs_qm_destroy_quotainfo(mp); | 1994 | xfs_qm_destroy_quotainfo(mp); |
2005 | xfs_mount_reset_sbqflags(mp); | 1995 | (void)xfs_mount_reset_sbqflags(mp); |
2006 | } else { | 1996 | } else { |
2007 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); | 1997 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); |
2008 | } | 1998 | } |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index b03eecf3b6cb..0b00b3c67015 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -184,8 +184,6 @@ typedef struct xfs_dquot_acct { | |||
184 | #define XFS_QM_HOLD(xqm) ((xqm)->qm_nrefs++) | 184 | #define XFS_QM_HOLD(xqm) ((xqm)->qm_nrefs++) |
185 | #define XFS_QM_RELE(xqm) ((xqm)->qm_nrefs--) | 185 | #define XFS_QM_RELE(xqm) ((xqm)->qm_nrefs--) |
186 | 186 | ||
187 | extern void xfs_mount_reset_sbqflags(xfs_mount_t *); | ||
188 | |||
189 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 187 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); |
190 | extern int xfs_qm_mount_quotas(xfs_mount_t *, int); | 188 | extern int xfs_qm_mount_quotas(xfs_mount_t *, int); |
191 | extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); | 189 | extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); |
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c index dc3c37a1e158..8890a18a99d8 100644 --- a/fs/xfs/quota/xfs_qm_bhv.c +++ b/fs/xfs/quota/xfs_qm_bhv.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -229,48 +229,6 @@ xfs_qm_syncall( | |||
229 | return error; | 229 | return error; |
230 | } | 230 | } |
231 | 231 | ||
232 | /* | ||
233 | * Clear the quotaflags in memory and in the superblock. | ||
234 | */ | ||
235 | void | ||
236 | xfs_mount_reset_sbqflags( | ||
237 | xfs_mount_t *mp) | ||
238 | { | ||
239 | xfs_trans_t *tp; | ||
240 | unsigned long s; | ||
241 | |||
242 | mp->m_qflags = 0; | ||
243 | /* | ||
244 | * It is OK to look at sb_qflags here in mount path, | ||
245 | * without SB_LOCK. | ||
246 | */ | ||
247 | if (mp->m_sb.sb_qflags == 0) | ||
248 | return; | ||
249 | s = XFS_SB_LOCK(mp); | ||
250 | mp->m_sb.sb_qflags = 0; | ||
251 | XFS_SB_UNLOCK(mp, s); | ||
252 | |||
253 | /* | ||
254 | * if the fs is readonly, let the incore superblock run | ||
255 | * with quotas off but don't flush the update out to disk | ||
256 | */ | ||
257 | if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) | ||
258 | return; | ||
259 | #ifdef QUOTADEBUG | ||
260 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); | ||
261 | #endif | ||
262 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | ||
263 | if (xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | ||
264 | XFS_DEFAULT_LOG_COUNT)) { | ||
265 | xfs_trans_cancel(tp, 0); | ||
266 | xfs_fs_cmn_err(CE_ALERT, mp, | ||
267 | "xfs_mount_reset_sbqflags: Superblock update failed!"); | ||
268 | return; | ||
269 | } | ||
270 | xfs_mod_sb(tp, XFS_SB_QFLAGS); | ||
271 | xfs_trans_commit(tp, 0, NULL); | ||
272 | } | ||
273 | |||
274 | STATIC int | 232 | STATIC int |
275 | xfs_qm_newmount( | 233 | xfs_qm_newmount( |
276 | xfs_mount_t *mp, | 234 | xfs_mount_t *mp, |