Set the auto-reflush flag if the flusher is unable to completely flush
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 12 Jan 2009 21:46:20 +0000 (13:46 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 12 Jan 2009 21:46:20 +0000 (13:46 -0800)
an inode due to dependencies or memory considerations.

This should hopefully solve reported 'vinvalbuf: dirty bufs' panics,
which occur when VOP_FSYNC() returns before the inode is completely
flushed.

Reported-by: "Justin C. Sherrill" <justin@shiningsilence.com>
sys/vfs/hammer/hammer_inode.c

index e8df385..537bd19 100644 (file)
@@ -2048,6 +2048,14 @@ hammer_flush_inode_done(hammer_inode_t ip, int error)
 
        hmp = ip->hmp;
 
+       /*
+        * Auto-reflush if the backend could not completely flush
+        * the inode.  This fixes a case where a deferred buffer flush
+        * could cause fsync to return early.
+        */
+       if (ip->sync_flags & HAMMER_INODE_MODMASK)
+               ip->flags |= HAMMER_INODE_REFLUSH;
+
        /*
         * Merge left-over flags back into the frontend and fix the state.
         * Incomplete truncations are retained by the backend.