}
dprintk("DELETE INODE %d\n", (int)ino->i_ino);
- wait_event(fs->trunc_wait,
- !test_bit(I_Trunc, &LAFSI(ino)->iflags));
+ /* Normal truncation holds an igrab, so we cannot be
+ * deleted until any truncation finishes
+ */
+ BUG_ON(test_bit(I_Trunc, &LAFSI(ino)->iflags));
spin_lock(&ino->i_data.private_lock);
b = LAFSI(ino)->dblock;
/* must be finished */
LAFS_BUG(test_bit(B_Dirty, &ib->b.flags), &ib->b);
clear_bit(I_Trunc, &LAFSI(ino)->iflags);
+ if (!test_bit(I_Deleting, &LAFSI(ino)->iflags))
+ iput(ino);
wake_up(&fs->trunc_wait);
err = -ERESTARTSYS;
goto out2;
if (ib2->b.fileaddr < lastaddr) {
/* Must be all done */
clear_bit(I_Trunc, &LAFSI(ino)->iflags);
+ if (!test_bit(I_Deleting, &LAFSI(ino)->iflags))
+ iput(ino);
wake_up(&fs->trunc_wait);
err = -ERESTARTSYS;
goto out2;
if (LAFSI(ino)->depth == 0) {
/* Nothing to truncate */
clear_bit(I_Trunc, &LAFSI(ino)->iflags);
+ if (!test_bit(I_Deleting, &LAFSI(ino)->iflags))
+ iput(ino);
if (test_bit(B_Pinned, &ib->b.flags))
/* Need to move the dirtiness which keeps this
* pinned to the data block.
/* FIXME there is nothing I can do with an error here */
lafs_make_orphan(fs, db);
+ if (!test_and_set_bit(I_Trunc, &LAFSI(ino)->iflags))
+ igrab(ino);
LAFSI(ino)->trunc_next = trunc_block;
putdref(db, MKREF(trunc));
}