kernel: hopefully fix the busy block panic
authorAlan Cox <alan@linux.intel.com>
Wed, 18 Apr 2018 22:44:45 +0000 (23:44 +0100)
committerAlan Cox <alan@linux.intel.com>
Wed, 18 Apr 2018 22:44:45 +0000 (23:44 +0100)
Do make backups before you test this!

Kernel/devio.c
Kernel/filesys.c
Kernel/inode.c

index 3181d0f..8052a4d 100644 (file)
@@ -103,7 +103,6 @@ bufptr bread(uint16_t dev, blkno_t blk, bool rewrite)
                        }
                }
        }
-       bp->bf_time = ++bufclock;       /* Time stamp it */
        return bp;
 }
 
@@ -142,6 +141,11 @@ int bfree(regptr bufptr bp, uint8_t dirty)
                }
                bp->bf_dirty = false;
        }
+       /* Time stamp the buffer on free up. It doesn't matter if we stamp it
+          on read or free as while locked it can't go away. However if we
+          stamp it on free we can in future make smarter decisions such as
+          recycling full dirty buffers faster than partial ones */
+       bp->bf_time = ++bufclock;
        bunlock(bp);
        return ret;
 }
index 247f614..3c9e76e 100644 (file)
@@ -650,6 +650,11 @@ blkno_t blk_alloc(uint16_t devno)
         goto corrupt;
     --dev->s_tfree;
 
+   /*
+    * FIXME: When we implement the rest of the bigger block size fs support
+    * this routine is responsible for zeroing the entire extent not just the
+    * 512 byte block
+    */
     /* Zero out the new block */
     buf = bread(devno, newno, 2);
     if (buf == NULL)
index d412343..9e3dacf 100644 (file)
@@ -113,22 +113,14 @@ void readi(regptr inoptr ino, uint8_t flag)
                        } else
 #endif
                        {
-                               /* FIXME: for big file system support we need
-                                  to zero the rest of the logical extent here
-                                  and then allocate and write the one we want */
                                /* we transfer through the buffer pool */
                                if (pblk == NULLBLK)
                                        bp = zerobuf();
-                               else if (bp == NULL) {
+                               else if (bp == NULL)
                                        bp = bread(dev, pblk, 0);
-                                       if (bp == NULL)
-                                               break;
-                               } else {
-                                       /* FIXME: this has to get sorted ASAP */
-                                       bp->bf_time = ++bufclock;
-                               }
+                               if (bp == NULL)
+                                       break;
                                uputblk(bp, uoff(), amount);
-
                                brelse(bp);
                        }
                        /* Bletch */