···44244424 error = xfs_bmap_add_extent_unwritten_real(bma->tp, bma->ip, &bma->idx,44254425 &bma->cur, mval, bma->firstblock, bma->flist,44264426 &tmp_logflags);44274427- bma->logflags |= tmp_logflags;44274427+ /*44284428+ * Log the inode core unconditionally in the unwritten extent conversion44294429+ * path because the conversion might not have done so (e.g., if the44304430+ * extent count hasn't changed). We need to make sure the inode is dirty44314431+ * in the transaction for the sake of fsync(), even if nothing has44324432+ * changed, because fsync() will not force the log for this transaction44334433+ * unless it sees the inode pinned.44344434+ */44354435+ bma->logflags |= tmp_logflags | XFS_ILOG_CORE;44284436 if (error)44294437 return error;44304438
···5555typedef struct xfs_dqtrx {5656 struct xfs_dquot *qt_dquot; /* the dquot this refers to */5757 ulong qt_blk_res; /* blks reserved on a dquot */5858- ulong qt_blk_res_used; /* blks used from the reservation */5958 ulong qt_ino_res; /* inode reserved on a dquot */6059 ulong qt_ino_res_used; /* inodes used from the reservation */6160 long qt_bcount_delta; /* dquot blk count changes */
+19-13
fs/xfs/xfs_trans_dquot.c
···9090 xfs_trans_t *ntp)9191{9292 xfs_dqtrx_t *oq, *nq;9393- int i,j;9393+ int i, j;9494 xfs_dqtrx_t *oqa, *nqa;9595+ ulong blk_res_used;95969697 if (!otp->t_dqinfo)9798 return;···103102 * Because the quota blk reservation is carried forward,104103 * it is also necessary to carry forward the DQ_DIRTY flag.105104 */106106- if(otp->t_flags & XFS_TRANS_DQ_DIRTY)105105+ if (otp->t_flags & XFS_TRANS_DQ_DIRTY)107106 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;108107109108 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {110109 oqa = otp->t_dqinfo->dqs[j];111110 nqa = ntp->t_dqinfo->dqs[j];112111 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {112112+ blk_res_used = 0;113113+113114 if (oqa[i].qt_dquot == NULL)114115 break;115116 oq = &oqa[i];116117 nq = &nqa[i];118118+119119+ if (oq->qt_blk_res && oq->qt_bcount_delta > 0)120120+ blk_res_used = oq->qt_bcount_delta;117121118122 nq->qt_dquot = oq->qt_dquot;119123 nq->qt_bcount_delta = nq->qt_icount_delta = 0;···127121 /*128122 * Transfer whatever is left of the reservations.129123 */130130- nq->qt_blk_res = oq->qt_blk_res - oq->qt_blk_res_used;131131- oq->qt_blk_res = oq->qt_blk_res_used;124124+ nq->qt_blk_res = oq->qt_blk_res - blk_res_used;125125+ oq->qt_blk_res = blk_res_used;132126133127 nq->qt_rtblk_res = oq->qt_rtblk_res -134128 oq->qt_rtblk_res_used;···245239 * disk blocks used.246240 */247241 case XFS_TRANS_DQ_BCOUNT:248248- if (qtrx->qt_blk_res && delta > 0) {249249- qtrx->qt_blk_res_used += (ulong)delta;250250- ASSERT(qtrx->qt_blk_res >= qtrx->qt_blk_res_used);251251- }252242 qtrx->qt_bcount_delta += delta;253243 break;254244···425423 * reservation that a transaction structure knows of.426424 */427425 if (qtrx->qt_blk_res != 0) {428428- if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) {429429- if (qtrx->qt_blk_res >430430- qtrx->qt_blk_res_used)426426+ ulong blk_res_used = 0;427427+428428+ if (qtrx->qt_bcount_delta > 0)429429+ blk_res_used = qtrx->qt_bcount_delta;430430+431431+ if (qtrx->qt_blk_res != blk_res_used) {432432+ if (qtrx->qt_blk_res > blk_res_used)431433 dqp->q_res_bcount -= (xfs_qcnt_t)432434 (qtrx->qt_blk_res -433433- qtrx->qt_blk_res_used);435435+ blk_res_used);434436 else435437 dqp->q_res_bcount -= (xfs_qcnt_t)436436- (qtrx->qt_blk_res_used -438438+ (blk_res_used -437439 qtrx->qt_blk_res);438440 }439441 } else {