X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=fs%2Fxfs%2Fquota%2Fxfs_qm.c;h=89f2cd656ebfd3969bd0a40af131d3d9c24f8c16;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=918b7e8749fb51eae9f7071eae7ded08650e6159;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 918b7e874..89f2cd656 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -85,7 +85,6 @@ kmem_shaker_t xfs_qm_shaker; STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int); STATIC void xfs_qm_list_destroy(xfs_dqlist_t *); -STATIC int xfs_qm_quotacheck(xfs_mount_t *); STATIC int xfs_qm_init_quotainos(xfs_mount_t *); STATIC int xfs_qm_shake(int, unsigned int); @@ -349,7 +348,8 @@ xfs_qm_unmount_quotadestroy( */ int xfs_qm_mount_quotas( - xfs_mount_t *mp) + xfs_mount_t *mp, + int mfsi_flags) { unsigned long s; int error = 0; @@ -398,22 +398,16 @@ xfs_qm_mount_quotas( /* * If any of the quotas are not consistent, do a quotacheck. */ - if (XFS_QM_NEED_QUOTACHECK(mp)) { + if (XFS_QM_NEED_QUOTACHECK(mp) && + !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { #ifdef DEBUG cmn_err(CE_NOTE, "Doing a quotacheck. Please wait."); #endif if ((error = xfs_qm_quotacheck(mp))) { - cmn_err(CE_WARN, "Quotacheck unsuccessful (Error %d): " - "Disabling quotas.", - error); - /* - * We must turn off quotas. + /* Quotacheck has failed and quotas have + * been disabled. */ - ASSERT(mp->m_quotainfo != NULL); - ASSERT(xfs_Gqm != NULL); - xfs_qm_destroy_quotainfo(mp); - mp->m_qflags = 0; - goto write_changes; + return XFS_ERROR(error); } #ifdef DEBUG cmn_err(CE_NOTE, "Done quotacheck."); @@ -1788,7 +1782,7 @@ xfs_qm_dqusage_adjust( * the case in all other instances. It's OK that we do this because * quotacheck is done only at mount time. */ - if ((error = xfs_iget(mp, NULL, ino, XFS_ILOCK_EXCL, &ip, bno))) { + if ((error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_EXCL, &ip, bno))) { *res = BULKSTAT_RV_NOTHING; return (error); } @@ -1875,9 +1869,9 @@ xfs_qm_dqusage_adjust( /* * Walk thru all the filesystem inodes and construct a consistent view - * of the disk quota world. + * of the disk quota world. If the quotacheck fails, disable quotas. */ -STATIC int +int xfs_qm_quotacheck( xfs_mount_t *mp) { @@ -1973,7 +1967,20 @@ xfs_qm_quotacheck( XQM_LIST_PRINT(&(XFS_QI_MPL_LIST(mp)), MPL_NEXT, "++++ Mp list +++"); error_return: - cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); + if (error) { + cmn_err(CE_WARN, "XFS quotacheck %s: Unsuccessful (Error %d): " + "Disabling quotas.", + mp->m_fsname, error); + /* + * We must turn off quotas. + */ + ASSERT(mp->m_quotainfo != NULL); + ASSERT(xfs_Gqm != NULL); + xfs_qm_destroy_quotainfo(mp); + xfs_mount_reset_sbqflags(mp); + } else { + cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); + } return (error); } @@ -2003,14 +2010,14 @@ xfs_qm_init_quotainos( mp->m_sb.sb_uquotino != NULLFSINO) { ASSERT(mp->m_sb.sb_uquotino > 0); if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, - 0, &uip, 0))) + 0, 0, &uip, 0))) return XFS_ERROR(error); } if (XFS_IS_GQUOTA_ON(mp) && mp->m_sb.sb_gquotino != NULLFSINO) { ASSERT(mp->m_sb.sb_gquotino > 0); if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, - 0, &gip, 0))) { + 0, 0, &gip, 0))) { if (uip) VN_RELE(XFS_ITOV(uip)); return XFS_ERROR(error);