summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2005-09-08 06:30:05 +0000
committertruckman <truckman@FreeBSD.org>2005-09-08 06:30:05 +0000
commitd2af5326c994aa94a5ea74bb305f2ef113aa3f37 (patch)
treea7c1284d2223edd7814ccb561907d21453d07e6b /sys/gnu
parent23fa8aa7880a44dca26cb97693a3ce5615169037 (diff)
downloadFreeBSD-src-d2af5326c994aa94a5ea74bb305f2ef113aa3f37.zip
FreeBSD-src-d2af5326c994aa94a5ea74bb305f2ef113aa3f37.tar.gz
Add a new struct buf flag bit, B_PERSISTENT, and use it to tag
struct bufs that are persistently held by ext2fs. Ignore any buffers with this flag in the code in boot() that counts "busy" and dirty buffers and attempts to sync the dirty buffers, which is done before attempting to unmount all the file systems during shutdown. This fixes the problem caused by any ext2fs file systems that are mounted at system shutdown time, which caused boot() to give up on a non-zero number of buffers and skip the call to vfs_unmountall(). This left all the mounted file systems in a dirty state and caused them to all require cleanup by fsck on reboot. Move the two separate copies of the "busy" buffer test in boot() to a separate function. Nuke the useless spl() stuff in the ext2fs ULCK_BUF() macro. Bring the PRINT_BUF_FLAGS definition in sys/buf.h up to date with this and previous flag changes. PR: kern/56675, kern/85163 Tested by: "Matthias Andree" matthias.andree at gmx.de Reviewed by: bde MFC after: 3 days
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/fs/ext2fs/fs.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/gnu/fs/ext2fs/fs.h b/sys/gnu/fs/ext2fs/fs.h
index 0339916..341371d 100644
--- a/sys/gnu/fs/ext2fs/fs.h
+++ b/sys/gnu/fs/ext2fs/fs.h
@@ -150,19 +150,19 @@ extern u_char *fragtbl[];
/*
* Historically, ext2fs kept it's metadata buffers on the LOCKED queue. Now,
- * we simply change the lock owner to kern so that it may be released from
- * another context. Later, we release the buffer, and conditionally write it
- * when we're done.
+ * we change the lock owner to kern so that we may use it from contexts other
+ * than the one that originally locked it. When we are finished with the
+ * buffer, we release it, writing it first if it was dirty.
*/
-#define LCK_BUF(bp) BUF_KERNPROC(bp);
+#define LCK_BUF(bp) { \
+ (bp)->b_flags |= B_PERSISTENT; \
+ BUF_KERNPROC(bp); \
+}
#define ULCK_BUF(bp) { \
long flags; \
- int s; \
- s = splbio(); \
flags = (bp)->b_flags; \
- (bp)->b_flags &= ~(B_DIRTY); \
- splx(s); \
+ (bp)->b_flags &= ~(B_DIRTY | B_PERSISTENT); \
if (flags & B_DIRTY) \
bwrite(bp); \
else \
OpenPOWER on IntegriCloud