diff options
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/Makefile | 1 | ||||
-rw-r--r-- | fs/xfs/quota/Makefile-linux-2.6 | 53 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 43 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 16 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 1 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 26 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 2 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_bhv.c | 44 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 16 |
9 files changed, 102 insertions, 100 deletions
diff --git a/fs/xfs/quota/Makefile b/fs/xfs/quota/Makefile new file mode 100644 index 000000000000..7a4f725b2824 --- /dev/null +++ b/fs/xfs/quota/Makefile | |||
@@ -0,0 +1 @@ | |||
include $(TOPDIR)/fs/xfs/quota/Makefile-linux-$(VERSION).$(PATCHLEVEL) | |||
diff --git a/fs/xfs/quota/Makefile-linux-2.6 b/fs/xfs/quota/Makefile-linux-2.6 new file mode 100644 index 000000000000..8b7b676718b9 --- /dev/null +++ b/fs/xfs/quota/Makefile-linux-2.6 | |||
@@ -0,0 +1,53 @@ | |||
1 | # | ||
2 | # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | ||
3 | # | ||
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 | ||
6 | # published by the Free Software Foundation. | ||
7 | # | ||
8 | # This program is distributed in the hope that it would be useful, but | ||
9 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
11 | # | ||
12 | # Further, this software is distributed without any warranty that it is | ||
13 | # free of the rightful claim of any third person regarding infringement | ||
14 | # or the like. Any license provided herein, whether implied or | ||
15 | # otherwise, applies only to this software file. Patent licenses, if | ||
16 | # any, provided herein do not apply to combinations of this program with | ||
17 | # other software, or any other product whatsoever. | ||
18 | # | ||
19 | # You should have received a copy of the GNU General Public License along | ||
20 | # with this program; if not, write the Free Software Foundation, Inc., 59 | ||
21 | # Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
22 | # | ||
23 | # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
24 | # Mountain View, CA 94043, or: | ||
25 | # | ||
26 | # http://www.sgi.com | ||
27 | # | ||
28 | # For further information regarding this notice, see: | ||
29 | # | ||
30 | # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
31 | # | ||
32 | |||
33 | EXTRA_CFLAGS += -I $(TOPDIR)/fs/xfs -I $(TOPDIR)/fs/xfs/linux-2.6 | ||
34 | |||
35 | ifeq ($(CONFIG_XFS_DEBUG),y) | ||
36 | EXTRA_CFLAGS += -g -DDEBUG | ||
37 | #EXTRA_CFLAGS += -DQUOTADEBUG | ||
38 | endif | ||
39 | ifeq ($(CONFIG_XFS_TRACE),y) | ||
40 | EXTRA_CFLAGS += -DXFS_DQUOT_TRACE | ||
41 | EXTRA_CFLAGS += -DXFS_VNODE_TRACE | ||
42 | endif | ||
43 | |||
44 | obj-$(CONFIG_XFS_QUOTA) += xfs_quota.o | ||
45 | |||
46 | xfs_quota-y += xfs_dquot.o \ | ||
47 | xfs_dquot_item.o \ | ||
48 | xfs_trans_dquot.o \ | ||
49 | xfs_qm_syscalls.o \ | ||
50 | xfs_qm_bhv.o \ | ||
51 | xfs_qm.o | ||
52 | |||
53 | xfs_quota-$(CONFIG_PROC_FS) += xfs_qm_stats.o | ||
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index 46ce1e3ce1d6..e2e8d35fa4d0 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -421,7 +421,7 @@ xfs_qm_init_dquot_blk( | |||
421 | */ | 421 | */ |
422 | STATIC int | 422 | STATIC int |
423 | xfs_qm_dqalloc( | 423 | xfs_qm_dqalloc( |
424 | xfs_trans_t *tp, | 424 | xfs_trans_t **tpp, |
425 | xfs_mount_t *mp, | 425 | xfs_mount_t *mp, |
426 | xfs_dquot_t *dqp, | 426 | xfs_dquot_t *dqp, |
427 | xfs_inode_t *quotip, | 427 | xfs_inode_t *quotip, |
@@ -433,6 +433,7 @@ xfs_qm_dqalloc( | |||
433 | xfs_bmbt_irec_t map; | 433 | xfs_bmbt_irec_t map; |
434 | int nmaps, error, committed; | 434 | int nmaps, error, committed; |
435 | xfs_buf_t *bp; | 435 | xfs_buf_t *bp; |
436 | xfs_trans_t *tp = *tpp; | ||
436 | 437 | ||
437 | ASSERT(tp != NULL); | 438 | ASSERT(tp != NULL); |
438 | xfs_dqtrace_entry(dqp, "DQALLOC"); | 439 | xfs_dqtrace_entry(dqp, "DQALLOC"); |
@@ -492,10 +493,32 @@ xfs_qm_dqalloc( | |||
492 | xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), | 493 | xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), |
493 | dqp->dq_flags & XFS_DQ_ALLTYPES, bp); | 494 | dqp->dq_flags & XFS_DQ_ALLTYPES, bp); |
494 | 495 | ||
495 | if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { | 496 | /* |
497 | * xfs_bmap_finish() may commit the current transaction and | ||
498 | * start a second transaction if the freelist is not empty. | ||
499 | * | ||
500 | * Since we still want to modify this buffer, we need to | ||
501 | * ensure that the buffer is not released on commit of | ||
502 | * the first transaction and ensure the buffer is added to the | ||
503 | * second transaction. | ||
504 | * | ||
505 | * If there is only one transaction then don't stop the buffer | ||
506 | * from being released when it commits later on. | ||
507 | */ | ||
508 | |||
509 | xfs_trans_bhold(tp, bp); | ||
510 | |||
511 | if ((error = xfs_bmap_finish(tpp, &flist, firstblock, &committed))) { | ||
496 | goto error1; | 512 | goto error1; |
497 | } | 513 | } |
498 | 514 | ||
515 | if (committed) { | ||
516 | tp = *tpp; | ||
517 | xfs_trans_bjoin(tp, bp); | ||
518 | } else { | ||
519 | xfs_trans_bhold_release(tp, bp); | ||
520 | } | ||
521 | |||
499 | *O_bpp = bp; | 522 | *O_bpp = bp; |
500 | return 0; | 523 | return 0; |
501 | 524 | ||
@@ -514,7 +537,7 @@ xfs_qm_dqalloc( | |||
514 | */ | 537 | */ |
515 | STATIC int | 538 | STATIC int |
516 | xfs_qm_dqtobp( | 539 | xfs_qm_dqtobp( |
517 | xfs_trans_t *tp, | 540 | xfs_trans_t **tpp, |
518 | xfs_dquot_t *dqp, | 541 | xfs_dquot_t *dqp, |
519 | xfs_disk_dquot_t **O_ddpp, | 542 | xfs_disk_dquot_t **O_ddpp, |
520 | xfs_buf_t **O_bpp, | 543 | xfs_buf_t **O_bpp, |
@@ -528,6 +551,7 @@ xfs_qm_dqtobp( | |||
528 | xfs_disk_dquot_t *ddq; | 551 | xfs_disk_dquot_t *ddq; |
529 | xfs_dqid_t id; | 552 | xfs_dqid_t id; |
530 | boolean_t newdquot; | 553 | boolean_t newdquot; |
554 | xfs_trans_t *tp = (tpp ? *tpp : NULL); | ||
531 | 555 | ||
532 | mp = dqp->q_mount; | 556 | mp = dqp->q_mount; |
533 | id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); | 557 | id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); |
@@ -579,9 +603,10 @@ xfs_qm_dqtobp( | |||
579 | return (ENOENT); | 603 | return (ENOENT); |
580 | 604 | ||
581 | ASSERT(tp); | 605 | ASSERT(tp); |
582 | if ((error = xfs_qm_dqalloc(tp, mp, dqp, quotip, | 606 | if ((error = xfs_qm_dqalloc(tpp, mp, dqp, quotip, |
583 | dqp->q_fileoffset, &bp))) | 607 | dqp->q_fileoffset, &bp))) |
584 | return (error); | 608 | return (error); |
609 | tp = *tpp; | ||
585 | newdquot = B_TRUE; | 610 | newdquot = B_TRUE; |
586 | } else { | 611 | } else { |
587 | /* | 612 | /* |
@@ -645,7 +670,7 @@ xfs_qm_dqtobp( | |||
645 | /* ARGSUSED */ | 670 | /* ARGSUSED */ |
646 | STATIC int | 671 | STATIC int |
647 | xfs_qm_dqread( | 672 | xfs_qm_dqread( |
648 | xfs_trans_t *tp, | 673 | xfs_trans_t **tpp, |
649 | xfs_dqid_t id, | 674 | xfs_dqid_t id, |
650 | xfs_dquot_t *dqp, /* dquot to get filled in */ | 675 | xfs_dquot_t *dqp, /* dquot to get filled in */ |
651 | uint flags) | 676 | uint flags) |
@@ -653,15 +678,19 @@ xfs_qm_dqread( | |||
653 | xfs_disk_dquot_t *ddqp; | 678 | xfs_disk_dquot_t *ddqp; |
654 | xfs_buf_t *bp; | 679 | xfs_buf_t *bp; |
655 | int error; | 680 | int error; |
681 | xfs_trans_t *tp; | ||
682 | |||
683 | ASSERT(tpp); | ||
656 | 684 | ||
657 | /* | 685 | /* |
658 | * get a pointer to the on-disk dquot and the buffer containing it | 686 | * get a pointer to the on-disk dquot and the buffer containing it |
659 | * dqp already knows its own type (GROUP/USER). | 687 | * dqp already knows its own type (GROUP/USER). |
660 | */ | 688 | */ |
661 | xfs_dqtrace_entry(dqp, "DQREAD"); | 689 | xfs_dqtrace_entry(dqp, "DQREAD"); |
662 | if ((error = xfs_qm_dqtobp(tp, dqp, &ddqp, &bp, flags))) { | 690 | if ((error = xfs_qm_dqtobp(tpp, dqp, &ddqp, &bp, flags))) { |
663 | return (error); | 691 | return (error); |
664 | } | 692 | } |
693 | tp = *tpp; | ||
665 | 694 | ||
666 | /* copy everything from disk dquot to the incore dquot */ | 695 | /* copy everything from disk dquot to the incore dquot */ |
667 | memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); | 696 | memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); |
@@ -740,7 +769,7 @@ xfs_qm_idtodq( | |||
740 | * Read it from disk; xfs_dqread() takes care of | 769 | * Read it from disk; xfs_dqread() takes care of |
741 | * all the necessary initialization of dquot's fields (locks, etc) | 770 | * all the necessary initialization of dquot's fields (locks, etc) |
742 | */ | 771 | */ |
743 | if ((error = xfs_qm_dqread(tp, id, dqp, flags))) { | 772 | if ((error = xfs_qm_dqread(&tp, id, dqp, flags))) { |
744 | /* | 773 | /* |
745 | * This can happen if quotas got turned off (ESRCH), | 774 | * This can happen if quotas got turned off (ESRCH), |
746 | * or if the dquot didn't exist on disk and we ask to | 775 | * or if the dquot didn't exist on disk and we ask to |
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_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index f5271b7b1e84..e74eaa7dd1bc 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -509,6 +509,7 @@ xfs_qm_qoff_logitem_format(xfs_qoff_logitem_t *qf, | |||
509 | 509 | ||
510 | log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format); | 510 | log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format); |
511 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); | 511 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); |
512 | XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_QUOTAOFF); | ||
512 | qf->qql_format.qf_size = 1; | 513 | qf->qql_format.qf_size = 1; |
513 | } | 514 | } |
514 | 515 | ||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index f665ca8f9e96..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 |
@@ -388,11 +378,8 @@ xfs_qm_mount_quotas( | |||
388 | goto write_changes; | 378 | goto write_changes; |
389 | } | 379 | } |
390 | 380 | ||
391 | #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) | ||
392 | cmn_err(CE_NOTE, "Attempting to turn on disk quotas."); | ||
393 | #endif | ||
394 | |||
395 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 381 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
382 | |||
396 | /* | 383 | /* |
397 | * Allocate the quotainfo structure inside the mount struct, and | 384 | * Allocate the quotainfo structure inside the mount struct, and |
398 | * create quotainode(s), and change/rev superblock if necessary. | 385 | * create quotainode(s), and change/rev superblock if necessary. |
@@ -410,19 +397,14 @@ xfs_qm_mount_quotas( | |||
410 | */ | 397 | */ |
411 | if (XFS_QM_NEED_QUOTACHECK(mp) && | 398 | if (XFS_QM_NEED_QUOTACHECK(mp) && |
412 | !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { | 399 | !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { |
413 | #ifdef DEBUG | ||
414 | cmn_err(CE_NOTE, "Doing a quotacheck. Please wait."); | ||
415 | #endif | ||
416 | if ((error = xfs_qm_quotacheck(mp))) { | 400 | if ((error = xfs_qm_quotacheck(mp))) { |
417 | /* Quotacheck has failed and quotas have | 401 | /* Quotacheck has failed and quotas have |
418 | * been disabled. | 402 | * been disabled. |
419 | */ | 403 | */ |
420 | return XFS_ERROR(error); | 404 | return XFS_ERROR(error); |
421 | } | 405 | } |
422 | #ifdef DEBUG | ||
423 | cmn_err(CE_NOTE, "Done quotacheck."); | ||
424 | #endif | ||
425 | } | 406 | } |
407 | |||
426 | write_changes: | 408 | write_changes: |
427 | /* | 409 | /* |
428 | * We actually don't have to acquire the SB_LOCK at all. | 410 | * We actually don't have to acquire the SB_LOCK at all. |
@@ -2010,7 +1992,7 @@ xfs_qm_quotacheck( | |||
2010 | ASSERT(mp->m_quotainfo != NULL); | 1992 | ASSERT(mp->m_quotainfo != NULL); |
2011 | ASSERT(xfs_Gqm != NULL); | 1993 | ASSERT(xfs_Gqm != NULL); |
2012 | xfs_qm_destroy_quotainfo(mp); | 1994 | xfs_qm_destroy_quotainfo(mp); |
2013 | xfs_mount_reset_sbqflags(mp); | 1995 | (void)xfs_mount_reset_sbqflags(mp); |
2014 | } else { | 1996 | } else { |
2015 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); | 1997 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); |
2016 | } | 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, |
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index 68e98962dbef..15e02e8a9d4f 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -1053,7 +1053,6 @@ xfs_qm_dqrele_all_inodes( | |||
1053 | struct xfs_mount *mp, | 1053 | struct xfs_mount *mp, |
1054 | uint flags) | 1054 | uint flags) |
1055 | { | 1055 | { |
1056 | vmap_t vmap; | ||
1057 | xfs_inode_t *ip, *topino; | 1056 | xfs_inode_t *ip, *topino; |
1058 | uint ireclaims; | 1057 | uint ireclaims; |
1059 | vnode_t *vp; | 1058 | vnode_t *vp; |
@@ -1061,8 +1060,8 @@ xfs_qm_dqrele_all_inodes( | |||
1061 | 1060 | ||
1062 | ASSERT(mp->m_quotainfo); | 1061 | ASSERT(mp->m_quotainfo); |
1063 | 1062 | ||
1064 | again: | ||
1065 | XFS_MOUNT_ILOCK(mp); | 1063 | XFS_MOUNT_ILOCK(mp); |
1064 | again: | ||
1066 | ip = mp->m_inodes; | 1065 | ip = mp->m_inodes; |
1067 | if (ip == NULL) { | 1066 | if (ip == NULL) { |
1068 | XFS_MOUNT_IUNLOCK(mp); | 1067 | XFS_MOUNT_IUNLOCK(mp); |
@@ -1090,18 +1089,14 @@ again: | |||
1090 | } | 1089 | } |
1091 | vnode_refd = B_FALSE; | 1090 | vnode_refd = B_FALSE; |
1092 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) { | 1091 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) { |
1093 | /* | ||
1094 | * Sample vp mapping while holding the mplock, lest | ||
1095 | * we come across a non-existent vnode. | ||
1096 | */ | ||
1097 | VMAP(vp, vmap); | ||
1098 | ireclaims = mp->m_ireclaims; | 1092 | ireclaims = mp->m_ireclaims; |
1099 | topino = mp->m_inodes; | 1093 | topino = mp->m_inodes; |
1100 | XFS_MOUNT_IUNLOCK(mp); | 1094 | vp = vn_grab(vp); |
1095 | if (!vp) | ||
1096 | goto again; | ||
1101 | 1097 | ||
1098 | XFS_MOUNT_IUNLOCK(mp); | ||
1102 | /* XXX restart limit ? */ | 1099 | /* XXX restart limit ? */ |
1103 | if ( ! (vp = vn_get(vp, &vmap))) | ||
1104 | goto again; | ||
1105 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1100 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
1106 | vnode_refd = B_TRUE; | 1101 | vnode_refd = B_TRUE; |
1107 | } else { | 1102 | } else { |
@@ -1137,7 +1132,6 @@ again: | |||
1137 | */ | 1132 | */ |
1138 | if (topino != mp->m_inodes || mp->m_ireclaims != ireclaims) { | 1133 | if (topino != mp->m_inodes || mp->m_ireclaims != ireclaims) { |
1139 | /* XXX use a sentinel */ | 1134 | /* XXX use a sentinel */ |
1140 | XFS_MOUNT_IUNLOCK(mp); | ||
1141 | goto again; | 1135 | goto again; |
1142 | } | 1136 | } |
1143 | ip = ip->i_mnext; | 1137 | ip = ip->i_mnext; |