]> git.neil.brown.name Git - LaFS.git/commitdiff
wait for pending truncate in delete_inode
authorNeilBrown <neilb@suse.de>
Mon, 28 Jun 2010 03:33:05 +0000 (13:33 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 28 Jun 2010 03:33:05 +0000 (13:33 +1000)
If we truncate then delete, the truncate could be on-going.
Safest to wait for it to finish before deleting (and this
truncating from 0).
This makes it more consistent with lafs_truncate.

Signed-off-by: NeilBrown <neilb@suse.de>
README
inode.c

diff --git a/README b/README
index 7b7c46ac30432212706832e06a202ad2b2ae508b..a5ae377a039bad253bf0e9c4e5f242dbcef6fc97 100644 (file)
--- a/README
+++ b/README
@@ -4853,13 +4853,14 @@ DONE 7d/ paging request at 6b6b6bfb.
 DONE 7e/ Remove BUG block.c;273 as cleaner can cause this.
      Check for Realloc too.
 
- 7f/ index.c:2024 no uninc credit 
+PRESUME-FIXED 7f/ index.c:2024 no uninc credit 
         [ce532338]0/306(2996)r1F:Pinned,Phase0,Valid,Dirty,Writeback,SegRef,Claimed,PhysValid cluster(1)
       found during checkpoint.  Maybe inode credit problem.
 
- 7g/  inode.c:831 InoIdx 283/0 is Realloc, not dirty, and has
+PRESUME-FIXED 7g/  inode.c:831 InoIdx 283/0 is Realloc, not dirty, and has
       ->uninc blocks.  This is during truncate.  Need some
       interlock with cleaner maybe?
+      Probably the same race between cleaner and truncate.
 
 DONE 7h/ inode.c:845 truncate finds children - Realloc on clean-leafs
 
@@ -4874,7 +4875,7 @@ DONE 8/ looping in do_checkpoint
      Need to call lafs_io_wake in lafs_iocheck_writeback for when
      it is called by lafs_writepage
 
- 9/ cluster.c:478
+DONE 9/ cluster.c:478
     flush_data_To_inode finds Realloc (not dirty) block
     and InoIdx block is not Valid.
   [cfb5ef50]2/0(3)r1F:Index(0),Pinned,Phase1,InoIdx,SegRef,C,CI,CN,CNI,IOLock,OnFree,PhysValid{0,1}[0]</cluster.c:435> child(1)
@@ -4882,6 +4883,7 @@ DONE 8/ looping in do_checkpoint
 
    I guess we truncated, then added data, then tried to clean.
    Probably just a bad 'bug' given recent changes.
+   No, I think it is the race between truncate and clean which is now fixed.
 
 10/ inode.c:606
     Deleting inode 328: 2+0+0 1+0
@@ -4891,7 +4893,7 @@ DONE 8/ looping in do_checkpoint
     Nothing else found empty.
     Somehow the second index block and contents were lost.
 
-11/ super.c:657
+ASSUME_DONE 11/ super.c:657
     Root still pinned at unmount.
      0/2 is Dirty:  [cfa53c58]0/2(1750)r0E:Valid,Dirty,CN,CNI,UninCredit,PhysValid
                     [cfa5fc58]0/2(2852)r0E:Valid,Dirty,SegRef,CN,CNI,UninCredit,PhysValid
@@ -4899,14 +4901,18 @@ DONE 8/ looping in do_checkpoint
                     [cfa53828]0/2(2969)r0E:Valid,Dirty,CN,CNI,UninCredit,PhysValid
                     [cfa75c58]0/2(579)r0E:Valid,Dirty,UninCredit,PhysValid
     maybe dir-orphan handling stuffed up
+    Or maybe it is the I_Dirty issue.  Assume fixed.
 
-12/ timeout/showstate in unmount
+
+ASSUME_DONE 12/ timeout/showstate in unmount
     umount is in sync_inodes / do_writepages / lafs_writepage / lafs_iolock_written
     That looks similar to 8
 
-13/ delete_inode should wait for pending truncate to complete.
+DONE 13/ delete_inode should wait for pending truncate to complete.
     Document I_Trunc somewhere - including that i_mutex is needed to set it.
     Verify that assertion.
+    Actually it requires i_alloc_sem, or the inode to be deleted.
+
 
 14/ Review writepage and flush and make sure we flush often enough but
     not too often.
@@ -5021,6 +5027,8 @@ DONE 15d/ What does I_Dirty mean - and implement it.
 
 49/ measure performance
 
+50/ Support O_DIRECT
+
 26June2010
  Investigating 5a
 
diff --git a/inode.c b/inode.c
index 58e5a0c7c645a3fd4d96e1ac159564ede7f46651..1ce736f5ee1aa5f8c6458f019014e1e68ad433a2 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -484,6 +484,10 @@ void lafs_delete_inode(struct inode *ino)
                return;
        }
        dprintk("DELETE INODE %d\n", (int)ino->i_ino);
+
+       wait_event(fs->trunc_wait,
+                  !test_bit(I_Trunc, &LAFSI(ino)->iflags));
+
        spin_lock(&ino->i_data.private_lock);
        b = LAFSI(ino)->dblock;
        /* FIXME we use b unconditionally, so either we don't