summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>1999-03-02 00:19:47 +0000
committermckusick <mckusick@FreeBSD.org>1999-03-02 00:19:47 +0000
commit0674f5c758dac16d84023df4db88655d5a532e42 (patch)
tree334f7b92563e1a0928000b5396581af5e6342db7 /sys/ufs
parent6f8b8ad7c089e44909b5d39670755b193419ad30 (diff)
downloadFreeBSD-src-0674f5c758dac16d84023df4db88655d5a532e42.zip
FreeBSD-src-0674f5c758dac16d84023df4db88655d5a532e42.tar.gz
Ensure that softdep_sync_metadata can handle bmsafemap and mkdir entries
if they ever arise (which should not happen as softdep_sync_metadata is currently used).
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_softdep.c48
-rw-r--r--sys/ufs/ffs/softdep.h5
2 files changed, 48 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 5b7b887..d408068 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,3 @@
-
/*
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
*
@@ -53,8 +52,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)ffs_softdep.c 9.32 (McKusick) 2/17/99
- * $Id: ffs_softdep.c,v 1.21 1999/01/22 09:07:32 dg Exp $
+ * from: @(#)ffs_softdep.c 9.33 (McKusick) 2/25/99
+ * $Id: ffs_softdep.c,v 1.22 1999/02/17 20:01:20 mckusick Exp $
*/
/*
@@ -2155,6 +2154,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp)
/*
* Dependency on "." and ".." being written to disk.
*/
+ mkdir1->md_buf = newdirbp;
LIST_INSERT_HEAD(&mkdirlisthd, mkdir1, md_mkdirs);
WORKLIST_INSERT(&newdirbp->b_dep, &mkdir1->md_list);
bdwrite(newdirbp);
@@ -3845,6 +3845,48 @@ loop:
}
break;
+ case D_MKDIR:
+ /*
+ * This case should never happen if the vnode has
+ * been properly sync'ed. However, if this function
+ * is used at a place where the vnode has not yet
+ * been sync'ed, this dependency can show up. So,
+ * rather than panic, just flush it.
+ */
+ nbp = WK_MKDIR(wk)->md_buf;
+ if (getdirtybuf(&nbp, waitfor) == 0)
+ break;
+ FREE_LOCK(&lk);
+ if (waitfor == MNT_NOWAIT) {
+ bawrite(nbp);
+ } else if ((error = VOP_BWRITE(nbp)) != 0) {
+ bawrite(bp);
+ return (error);
+ }
+ ACQUIRE_LOCK(&lk);
+ break;
+
+ case D_BMSAFEMAP:
+ /*
+ * This case should never happen if the vnode has
+ * been properly sync'ed. However, if this function
+ * is used at a place where the vnode has not yet
+ * been sync'ed, this dependency can show up. So,
+ * rather than panic, just flush it.
+ */
+ nbp = WK_BMSAFEMAP(wk)->sm_buf;
+ if (getdirtybuf(&nbp, waitfor) == 0)
+ break;
+ FREE_LOCK(&lk);
+ if (waitfor == MNT_NOWAIT) {
+ bawrite(nbp);
+ } else if ((error = VOP_BWRITE(nbp)) != 0) {
+ bawrite(bp);
+ return (error);
+ }
+ ACQUIRE_LOCK(&lk);
+ break;
+
default:
panic("softdep_sync_metadata: Unknown type %s",
TYPENAME(wk->wk_type));
diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h
index 71bb7fa..7d266db 100644
--- a/sys/ufs/ffs/softdep.h
+++ b/sys/ufs/ffs/softdep.h
@@ -52,8 +52,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)softdep.h 9.5 (McKusick) 2/11/98
- * $Id:$
+ * @(#)softdep.h 9.6 (McKusick) 2/25/99
+ * $Id: softdep.h,v 1.4 1998/05/19 23:07:25 julian Exp $
*/
#include <sys/queue.h>
@@ -517,6 +517,7 @@ struct mkdir {
struct worklist md_list; /* id_inowait or buffer holding dir */
# define md_state md_list.wk_state /* type: MKDIR_PARENT or MKDIR_BODY */
struct diradd *md_diradd; /* associated diradd */
+ struct buf *md_buf; /* MKDIR_BODY: buffer holding dir */
LIST_ENTRY(mkdir) md_mkdirs; /* list of all mkdirs */
};
LIST_HEAD(mkdirlist, mkdir) mkdirlisthd;
OpenPOWER on IntegriCloud