VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / fs / jfs / jfs_extent.c
index 3995722..2b411bc 100644 (file)
@@ -533,7 +533,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
                nb = nblks = *nblocks;
 
        /* try to allocate blocks */
-       while ((rc = dbAlloc(ip, hint, nb, &daddr))) {
+       while ((rc = dbAlloc(ip, hint, nb, &daddr)) != 0) {
                /* if something other than an out of space error,
                 * stop and return this error.
                 */
@@ -553,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
 
        if (S_ISREG(ip->i_mode) && (ji->fileset == FILESYSTEM_I)) {
                ag = BLKTOAG(daddr, sbi);
+               spin_lock_irq(&ji->ag_lock);
                if (ji->active_ag == -1) {
                        atomic_inc(&bmp->db_active[ag]);
                        ji->active_ag = ag;
@@ -561,6 +562,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
                        atomic_inc(&bmp->db_active[ag]);
                        ji->active_ag = ag;
                }
+               spin_unlock_irq(&ji->ag_lock);
        }
 
        return (0);