Module Name: src Committed By: bouyer Date: Mon Feb 7 16:24:13 UTC 2011
Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Create a WAPBL transaction when setting quotas. To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.7 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.8 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.7 Thu Feb 3 15:56:16 2011 +++ src/sys/ufs/ufs/ufs_quota2.c Mon Feb 7 16:24:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota2.c,v 1.1.2.7 2011/02/03 15:56:16 bouyer Exp $ */ +/* $NetBSD: ufs_quota2.c,v 1.1.2.8 2011/02/07 16:24:13 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.1.2.7 2011/02/03 15:56:16 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.1.2.8 2011/02/07 16:24:13 bouyer Exp $"); #include <sys/buf.h> #include <sys/param.h> @@ -502,29 +502,33 @@ if (ump->um_quotas[type] == NULLVP) return ENODEV; + error = UFS_WAPBL_BEGIN(ump->um_mountp); + if (error) + return error; + if (defaultq) { mutex_enter(&dqlock); error = getq2h(ump, type, &bp, &q2h, B_MODIFY); if (error) { mutex_exit(&dqlock); - return error; + goto out_wapbl; } quota2_ufs_rwq2e(&q2h->q2h_defentry, &q2e, needswap); error = quota2_dict_update_q2e_limits(data, &q2e); if (error) { mutex_exit(&dqlock); brelse(bp, 0); - return error; + goto out_wapbl; } quota2_ufs_rwq2e(&q2e, &q2h->q2h_defentry, needswap); mutex_exit(&dqlock); VOP_BWRITE(bp); - return error; + goto out_wapbl; } error = dqget(NULLVP, id, ump, type, &dq); if (error) - return error; + goto out_wapbl; if (dq->dq2_lblkno == 0 && dq->dq2_blkoff == 0) { /* need to alloc a new on-disk quot */ @@ -537,7 +541,7 @@ } if (error) { dqrele(NULLVP, dq); - return error; + goto out_wapbl; } mutex_enter(&dq->dq_interlock); quota2_ufs_rwq2e(q2ep, &q2e, needswap); @@ -546,13 +550,15 @@ mutex_exit(&dq->dq_interlock); dqrele(NULLVP, dq); brelse(bp, 0); - return error; + goto out_wapbl; } quota2_ufs_rwq2e(&q2e, q2ep, needswap); mutex_exit(&dq->dq_interlock); dqrele(NULLVP, dq); VOP_BWRITE(bp); - + +out_wapbl: + UFS_WAPBL_END(ump->um_mountp); return error; }