socsvn commit: r238829 - soc2012/oleksandr/udf-head/sys/fs/udf2
oleksandr at FreeBSD.org
oleksandr at FreeBSD.org
Mon Jul 2 18:49:13 UTC 2012
Author: oleksandr
Date: Mon Jul 2 18:49:10 2012
New Revision: 238829
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238829
Log:
add function udf_release_system_nodes for release nodes and udf_unmount_sanity_check for debug and some small correction
Modified:
soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c
soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h
soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 17:55:29 2012 (r238828)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 18:49:10 2012 (r238829)
@@ -537,7 +537,7 @@
slot, &s_icb_loc, &eof);
if (eof) {
UDF_UNLOCK_NODE(ump->metadata_node, 0);
- return IEINVAL);
+ return (EINVAL);
}
len = le32toh(s_icb_loc.len);
flags = UDF_EXT_FLAGS(len);
Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 17:55:29 2012 (r238828)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 18:49:10 2012 (r238829)
@@ -296,6 +296,7 @@
}
+#endif
int
udf_synchronise_caches(struct udf_mount *ump)
{
@@ -314,14 +315,13 @@
mmc_op.operation = MMC_OP_SYNCHRONISECACHE;
/* ignore return code */
- (void) VOP_IOCTL(ump->devvp, MMCOP, &mmc_op, FKIOCTL, NOCRED);
+ (void) VOP_IOCTL(ump->devvp, MMCOP, &mmc_op, FKIOCTL, NOCRED, curthread);
return (0);
}
/* --------------------------------------------------------------------- */
-#endif
/* track/session searching for mounting */
int
udf_search_tracks(struct udf_mount *ump, struct udf_args *args,
@@ -6457,11 +6457,10 @@
mutex_exit(&mntvnode_lock);
}
-#endif
-
/* --------------------------------------------------------------------- */
+#endif
/*
* Read and write file extent in/from the buffer.
*
Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Mon Jul 2 17:55:29 2012 (r238828)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Mon Jul 2 18:49:10 2012 (r238829)
@@ -39,7 +39,7 @@
int *first_tracknr, int *last_tracknr);
//int udf_search_writing_tracks(struct udf_mount *ump);
//int udf_setup_writeparams(struct udf_mount *ump);
-//int udf_synchronise_caches(struct udf_mount *ump);
+int udf_synchronise_caches(struct udf_mount *ump);
/* tags operations */
int udf_fidsize(struct fileid_desc *fid);
Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 17:55:29 2012 (r238828)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 18:49:10 2012 (r238829)
@@ -116,6 +116,36 @@
/* --------------------------------------------------------------------- */
+/* if the system nodes exist, release them */
+static void
+udf_release_system_nodes(struct mount *mp)
+{
+ struct udf_mount *ump = VFSTOUDF(mp);
+ int error;
+
+ /* if we haven't even got an ump, dont bother */
+ if (!ump)
+ return;
+
+ /* VAT partition support */
+ if (ump->vat_node)
+ vrele(ump->vat_node->vnode);
+
+ /* Metadata partition support */
+ if (ump->metadata_node)
+ vrele(ump->metadata_node->vnode);
+ if (ump->metadatamirror_node)
+ vrele(ump->metadatamirror_node->vnode);
+ if (ump->metadatabitmap_node)
+ vrele(ump->metadatabitmap_node->vnode);
+
+ /* This flush should NOT write anything nor allow any node to remain */
+ if ((error = vflush(ump->vfs_mountp, 0, 0, curthread)))
+ panic("Failure to flush UDF system vnodes\n");
+}
+
+/* --------------------------------------------------------------------- */
+
#define MPFREE(a, lst) \
if ((a)) free((a), lst);
static void
@@ -129,18 +159,6 @@
ump = VFSTOUDF(mp);
if (ump) {
- /* VAT partition support */
- if (ump->vat_node)
- udf_dispose_node(ump->vat_node);
-
- /* Metadata partition support */
- if (ump->metadata_node)
- udf_dispose_node(ump->metadata_node);
- if (ump->metadatamirror_node)
- udf_dispose_node(ump->metadatamirror_node);
- if (ump->metadatabitmap_node)
- udf_dispose_node(ump->metadatabitmap_node);
-
/* clear our data */
for (i = 0; i < UDF_ANCHORS; i++)
MPFREE(ump->anchors[i], M_UDFTEMP);
@@ -274,7 +292,6 @@
}
/* --------------------------------------------------------------------- */
-#if 0
#ifdef DEBUG
static void
udf_unmount_sanity_check(struct mount *mp)
@@ -282,7 +299,7 @@
struct vnode *vp;
printf("On unmount, i found the following nodes:\n");
- TAILQ_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes) {
+ TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
vprint("", vp);
if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) {
printf(" is locked\n");
@@ -292,7 +309,7 @@
}
}
#endif
-#endif
+
int
udf_unmount(struct mount *mp, int mntflags)
@@ -300,58 +317,61 @@
struct udf_mount *ump;
int error, flags = 0;
- ump = VFSTOUDF(mp);
+ DPRINTF(CALL, ("udf_unmount called\n"));
+ ump = VFSTOUDF(mp);
if (!ump)
panic("UDF unmount: empty ump\n");
flags = (mntflags & MNT_FORCE) ? FORCECLOSE : 0;
/* TODO remove these paranoid functions */
-#if 0
#ifdef DEBUG
if (udf_verbose & UDF_DEBUG_LOCKING)
udf_unmount_sanity_check(mp);
#endif
-#endif
+
/*
* By specifying SKIPSYSTEM we can skip vnodes marked with VV_SYSTEM.
* This hardly documented feature allows us to exempt certain files
* from being flushed.
*/
- if ((error = vflush(mp, 0, flags, curthread)) != 0)
+ if ((error = vflush(mp, 0, flags, curthread)))
return (error);
/* update nodes and wait for completion of writeout of system nodes */
-#if 0
- udf_sync(mp, FSYNC_WAIT, NOCRED);
+ //udf_sync(mp, FSYNC_WAIT, NOCRED);
#ifdef DEBUG
if (udf_verbose & UDF_DEBUG_LOCKING)
udf_unmount_sanity_check(mp);
#endif
-
+#if 0
/* flush again, to check if we are still busy for something else */
- if ((error = vflush(ump->vfs_mountp, NULLVP, flags | SKIPSYSTEM)) != 0)
+ if ((error = vflush(ump->vfs_mountp, 0, flags, curthread)))
return (error);
/* close logical volume and close session if requested */
if ((error = udf_close_logvol(ump, mntflags)) != 0)
return (error);
+#endif
+
#ifdef DEBUG
DPRINTF(VOLUMES, ("FINAL sanity check\n"));
if (udf_verbose & UDF_DEBUG_LOCKING)
udf_unmount_sanity_check(mp);
#endif
-#endif
+
+ /* NOTE release system nodes should NOT write anything */
+ udf_release_system_nodes(mp);
#if 0
/* finalise disc strategy */
udf_discstrat_finish(ump);
+#endif
/* synchronise device caches */
(void) udf_synchronise_caches(ump);
-#endif
/* TODO: clean up iconv here */
if (ump->iconv_d2l)
@@ -378,6 +398,7 @@
mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp);
+ DPRINTF(VOLUMES, ("Fin unmount\n"));
return (0);
}
@@ -810,7 +831,6 @@
printf("UDF: skipping autosync\n");
return (0);
}
-
/* get sync lock */
ump->syncing = 1;
@@ -822,11 +842,10 @@
DPRINTF(CALL, ("end of udf_sync()\n"));
ump->syncing = 0;
-
return (0);
}
-#endif
+#endif
/* This added only for temp use */
struct udf_node *
udf_alloc_node()
More information about the svn-soc-all
mailing list