return err;
}
+static void orphan_abort(struct fs *fs);
static int orphan_pin(struct fs *fs, struct datablock *b)
{
struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan;
lafs_phase_wait(&ob->b);
err = lafs_pin_dblock(ob);
if (err) {
+ if (err != -EAGAIN)
+ orphan_abort(fs);
mutex_unlock(&fs->orphans->i_mutex);
putdref(ob, MKREF(orphan));
return err;
u32 bnum;
struct datablock *b;
struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan;
- mutex_lock_nested(&fs->orphans->i_mutex, I_MUTEX_QUOTA);
+
om->reserved--;
bnum = (om->nextfree + om->reserved) >>
(fs->prime_sb->s_blocksize_bits-4);
lafs_erase_dblock(b);
putdref(b, MKREF(orphan_reserve));
- mutex_unlock(&fs->orphans->i_mutex);
}
/* When we are about to make a change which might make a block
lafs_checkpoint_unlock_wait(fs);
goto retry;
}
- if (err)
- orphan_abort(fs);
/* there is no 'commit' - 'pin' did all the work */
lafs_checkpoint_unlock(fs);
- return 0;
+ return err;
}
/*
struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan;
struct orphan *or, *lastor, last;
int ent, lastent;
- u32 bnum;
if (!test_bit(B_Orphan, &b->b.flags))
return;
putdref(b, MKREF(orphan_list));
/* Now drop the reservation we just synthesised */
- om->reserved--;
- bnum = (om->nextfree + om->reserved) >> (b->b.inode->i_blkbits-4);
- b = lafs_get_block(fs->orphans, bnum, NULL, GFP_KERNEL,
- MKREF(orphan_release2));
- /* Note that we now own two references to this block, one
- * we just got and one we are trying to get rid of
- */
- putdref(b, MKREF(orphan_release2));
-
- /* If this was the last block in the file,
- * we need to punch a hole
- */
- if (((om->nextfree + om->reserved + 1) >> (b->b.inode->i_blkbits-4))
- != bnum)
- /* FIXME share code with orphan_abort */
- lafs_erase_dblock(b);
- putdref(b, MKREF(orphan_reserve));
-
+ orphan_abort(fs);
out_unlock:
mutex_unlock(&fs->orphans->i_mutex);
out: