summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-11-04 14:41:46 +0000
committerdg <dg@FreeBSD.org>1994-11-04 14:41:46 +0000
commite5d78dd23f38812b91b0e636e5fbec4cc35d46a1 (patch)
tree197d8d9c92571dc00690e6311677dbdc96f0ead0
parentfd72f9f9b7b492f149ba81c26bb310fe0d2f6608 (diff)
downloadFreeBSD-src-e5d78dd23f38812b91b0e636e5fbec4cc35d46a1.zip
FreeBSD-src-e5d78dd23f38812b91b0e636e5fbec4cc35d46a1.tar.gz
From tim@cs.city.ac.uk (Tim Wilkinson):
Find enclosed a short bugfix to get the union filesystem up and running in FreeBSD-current. We don't think we've got all the problems yet but these fixes sort out the major ones (which mostly concert bad locking of vnodes), no doubt we'll post others as necessary. Known problems include the inability of the umount command (not the system call) to unmount unions in certain circumstances (this is due the way "realpath" works), and the failure of direntries to always get all available files in unioned subdirectories. We are, as they say, working on it. Submitted by: tim@cs.city.ac.uk (Tim Wilkinson)
-rw-r--r--sys/fs/unionfs/union_vfsops.c4
-rw-r--r--sys/fs/unionfs/union_vnops.c12
-rw-r--r--sys/kern/vfs_extattr.c3
-rw-r--r--sys/kern/vfs_syscalls.c3
-rw-r--r--sys/miscfs/union/union_vfsops.c4
-rw-r--r--sys/miscfs/union/union_vnops.c12
6 files changed, 26 insertions, 12 deletions
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 580941e..393fe9d 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vfsops.c 8.7 (Berkeley) 3/5/94
- * $Id: union_vfsops.c,v 1.5 1994/09/22 19:38:20 wollman Exp $
+ * $Id: union_vfsops.c,v 1.6 1994/10/10 07:55:47 phk Exp $
*/
/*
@@ -257,6 +257,8 @@ union_mount(mp, path, data, ndp, p)
(void) copyinstr(args.target, cp, len - 1, &size);
bzero(cp + size, len - size);
+ (void)union_statfs(mp, &mp->mnt_stat, p);
+
#ifdef UNION_DIAGNOSTIC
printf("union_mount: from %s, on %s\n",
mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index decf8f3..df1935b 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vnops.c 8.6 (Berkeley) 2/17/94
- * $Id: union_vnops.c,v 1.6 1994/10/06 21:06:49 davidg Exp $
+ * $Id: union_vnops.c,v 1.7 1994/10/10 07:55:48 phk Exp $
*/
#include <sys/param.h>
@@ -53,8 +53,13 @@
#include <sys/queue.h>
#include <miscfs/union/union.h>
+/* FIXUP throws the lock on the uppervp vnode if the union_node is already
+ * locked and the uppervp vnode is not. Before, this was thrown regardless
+ * of the state of the union_node which resulted in locked vnodes which
+ * were never unlocked (since the union would never be unlocked).
+ */
#define FIXUP(un) { \
- if (((un)->un_flags & UN_ULOCK) == 0) { \
+ if (((un)->un_flags & (UN_LOCKED|UN_ULOCK)) == UN_LOCKED) { \
union_fixup(un); \
} \
}
@@ -1136,7 +1141,6 @@ union_symlink(ap)
int
union_readdir(ap)
struct vop_readdir_args /* {
- struct vnodeop_desc *a_desc;
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
@@ -1147,7 +1151,7 @@ union_readdir(ap)
if (un->un_uppervp) {
FIXUP(un);
- error = VOP_READDIR(un->un_uppervp, ap->a_uio, ap->a_cred);
+ error = VOP_READDIR(un->un_uppervp, ap->a_uio, ap->a_cred, NULL, NULL, NULL);
}
return (error);
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index c730946..e5c5218 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.14 1994/10/15 02:53:26 phk Exp $
+ * $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $
*/
#include <sys/param.h>
@@ -2153,6 +2153,7 @@ unionread:
#endif
if ((uap->count == auio.uio_resid) &&
+ vp &&
(vp->v_flag & VROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index c730946..e5c5218 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.14 1994/10/15 02:53:26 phk Exp $
+ * $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $
*/
#include <sys/param.h>
@@ -2153,6 +2153,7 @@ unionread:
#endif
if ((uap->count == auio.uio_resid) &&
+ vp &&
(vp->v_flag & VROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c
index 580941e..393fe9d 100644
--- a/sys/miscfs/union/union_vfsops.c
+++ b/sys/miscfs/union/union_vfsops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vfsops.c 8.7 (Berkeley) 3/5/94
- * $Id: union_vfsops.c,v 1.5 1994/09/22 19:38:20 wollman Exp $
+ * $Id: union_vfsops.c,v 1.6 1994/10/10 07:55:47 phk Exp $
*/
/*
@@ -257,6 +257,8 @@ union_mount(mp, path, data, ndp, p)
(void) copyinstr(args.target, cp, len - 1, &size);
bzero(cp + size, len - size);
+ (void)union_statfs(mp, &mp->mnt_stat, p);
+
#ifdef UNION_DIAGNOSTIC
printf("union_mount: from %s, on %s\n",
mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index decf8f3..df1935b 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vnops.c 8.6 (Berkeley) 2/17/94
- * $Id: union_vnops.c,v 1.6 1994/10/06 21:06:49 davidg Exp $
+ * $Id: union_vnops.c,v 1.7 1994/10/10 07:55:48 phk Exp $
*/
#include <sys/param.h>
@@ -53,8 +53,13 @@
#include <sys/queue.h>
#include <miscfs/union/union.h>
+/* FIXUP throws the lock on the uppervp vnode if the union_node is already
+ * locked and the uppervp vnode is not. Before, this was thrown regardless
+ * of the state of the union_node which resulted in locked vnodes which
+ * were never unlocked (since the union would never be unlocked).
+ */
#define FIXUP(un) { \
- if (((un)->un_flags & UN_ULOCK) == 0) { \
+ if (((un)->un_flags & (UN_LOCKED|UN_ULOCK)) == UN_LOCKED) { \
union_fixup(un); \
} \
}
@@ -1136,7 +1141,6 @@ union_symlink(ap)
int
union_readdir(ap)
struct vop_readdir_args /* {
- struct vnodeop_desc *a_desc;
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
@@ -1147,7 +1151,7 @@ union_readdir(ap)
if (un->un_uppervp) {
FIXUP(un);
- error = VOP_READDIR(un->un_uppervp, ap->a_uio, ap->a_cred);
+ error = VOP_READDIR(un->un_uppervp, ap->a_uio, ap->a_cred, NULL, NULL, NULL);
}
return (error);
OpenPOWER on IntegriCloud