CVS commit: src/sys/fs/union
Module Name:src Committed By: thorpej Date: Sat May 18 00:04:46 UTC 2024 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: Remove unnecessary include of . To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.87 src/sys/fs/union/union_vfsops.c:1.88 --- src/sys/fs/union/union_vfsops.c:1.87 Mon Feb 13 08:39:40 2023 +++ src/sys/fs/union/union_vfsops.c Sat May 18 00:04:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.88 2024/05/18 00:04:46 thorpej Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.88 2024/05/18 00:04:46 thorpej Exp $"); #include #include @@ -87,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: union_vfsops #include #include #include -#include #include #include #include
CVS commit: src/sys/fs/union
Module Name:src Committed By: thorpej Date: Sat May 18 00:04:46 UTC 2024 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: Remove unnecessary include of . To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Feb 13 08:39:40 UTC 2023 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: When mounting a union file system set its lower mount only on success. Reported-by: syzbot+b81b69971581b4f4d...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.86 src/sys/fs/union/union_vfsops.c:1.87 --- src/sys/fs/union/union_vfsops.c:1.86 Mon Feb 6 10:33:32 2023 +++ src/sys/fs/union/union_vfsops.c Mon Feb 13 08:39:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $"); #include #include @@ -255,15 +255,16 @@ union_mount(struct mount *mp, const char mp->mnt_data = um; vfs_getnewfsid(mp); - error = vfs_set_lowermount(mp, um->um_uppervp->v_mount); - if (error) - goto bad; error = set_statvfs_info(path, UIO_USERSPACE, NULL, UIO_USERSPACE, mp->mnt_op->vfs_name, mp, l); if (error) goto bad; + error = vfs_set_lowermount(mp, um->um_uppervp->v_mount); + if (error) + goto bad; + switch (um->um_op) { case UNMNT_ABOVE: cp = ":";
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Feb 13 08:39:40 UTC 2023 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: When mounting a union file system set its lower mount only on success. Reported-by: syzbot+b81b69971581b4f4d...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Feb 6 10:33:32 UTC 2023 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: Set IMNT_MPSAFE only if all lower layers have it set. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.85 src/sys/fs/union/union_vfsops.c:1.86 --- src/sys/fs/union/union_vfsops.c:1.85 Mon Nov 21 10:37:14 2022 +++ src/sys/fs/union/union_vfsops.c Mon Feb 6 10:33:32 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $"); #include #include @@ -198,7 +198,14 @@ union_mount(struct mount *mp, const char goto bad; } - mp->mnt_iflag |= IMNT_MPSAFE; + /* + * This mount is mp-safe if both lower mounts are mp-safe. + */ + + if (((um->um_lowervp == NULLVP) || + (um->um_lowervp->v_mount->mnt_iflag & IMNT_MPSAFE)) && + (um->um_uppervp->v_mount->mnt_iflag & IMNT_MPSAFE)) + mp->mnt_iflag |= IMNT_MPSAFE; /* * Unless the mount is readonly, ensure that the top layer
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Feb 6 10:33:32 UTC 2023 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: Set IMNT_MPSAFE only if all lower layers have it set. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Nov 21 10:37:14 UTC 2022 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: When testing whiteout support on the underlying file system union_mount() should not use a NULL componentname as not all file systems can handle it. Use static { LOOKUP, NOCRED } componentname instead. Reported-by: syzbot+ecda308a1dd965283...@syzkaller.appspotmail.com Reported-by: syzbot+9b687847ee5f43e94...@syzkaller.appspotmail.com Reported-by: syzbot+9f9d1a841734f9f50...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.84 src/sys/fs/union/union_vfsops.c:1.85 --- src/sys/fs/union/union_vfsops.c:1.84 Fri Nov 4 11:20:39 2022 +++ src/sys/fs/union/union_vfsops.c Mon Nov 21 10:37:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $"); #include #include @@ -205,9 +205,13 @@ union_mount(struct mount *mp, const char * supports whiteout operations */ if ((mp->mnt_flag & MNT_RDONLY) == 0) { + static struct componentname nullcn = { + .cn_nameiop = LOOKUP, + .cn_cred = NOCRED + }; + vn_lock(um->um_uppervp, LK_EXCLUSIVE | LK_RETRY); - error = VOP_WHITEOUT(um->um_uppervp, - (struct componentname *) 0, LOOKUP); + error = VOP_WHITEOUT(um->um_uppervp, &nullcn, LOOKUP); VOP_UNLOCK(um->um_uppervp); if (error) goto bad;
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Mon Nov 21 10:37:14 UTC 2022 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: When testing whiteout support on the underlying file system union_mount() should not use a NULL componentname as not all file systems can handle it. Use static { LOOKUP, NOCRED } componentname instead. Reported-by: syzbot+ecda308a1dd965283...@syzkaller.appspotmail.com Reported-by: syzbot+9b687847ee5f43e94...@syzkaller.appspotmail.com Reported-by: syzbot+9f9d1a841734f9f50...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/fs/union
Thanks for quick fix! rin On 2022/09/12 22:10, Christos Zoulas wrote: Yup! christos On Sep 12, 2022, at 5:04 AM, Rin Okuyama wrote: Hi, On 2022/09/12 0:42, Christos Zoulas wrote: @@ -420,11 +423,11 @@ union_statvfs(struct mount *mp, struct s { int error; struct union_mount *um = MOUNTTOUNIONMOUNT(mp); - struct statvfs *sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK | M_ZERO); + struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP); unsigned long lbsize; #ifdef UNION_DIAGNOSTIC - printf("union_statvfs(mp = %p, lvp = %p, uvp = %p)\n", mp, + printf("%s(mp = %p, lvp = %p, uvp = %p)\n", __func__, mp, um->um_lowervp, um->um_uppervp); #endif kmem_zalloc() here? Thanks, rin
Re: CVS commit: src/sys/fs/union
Yup! christos > On Sep 12, 2022, at 5:04 AM, Rin Okuyama wrote: > > Hi, > > On 2022/09/12 0:42, Christos Zoulas wrote: >> @@ -420,11 +423,11 @@ union_statvfs(struct mount *mp, struct s >> { >> int error; >> struct union_mount *um = MOUNTTOUNIONMOUNT(mp); >> -struct statvfs *sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK | M_ZERO); >> +struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP); >> unsigned long lbsize; >>#ifdef UNION_DIAGNOSTIC >> -printf("union_statvfs(mp = %p, lvp = %p, uvp = %p)\n", mp, >> +printf("%s(mp = %p, lvp = %p, uvp = %p)\n", __func__, mp, >> um->um_lowervp, um->um_uppervp); >> #endif >> > > kmem_zalloc() here? > > Thanks, > rin signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/sys/fs/union
Hi, On 2022/09/12 0:42, Christos Zoulas wrote: @@ -420,11 +423,11 @@ union_statvfs(struct mount *mp, struct s { int error; struct union_mount *um = MOUNTTOUNIONMOUNT(mp); - struct statvfs *sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK | M_ZERO); + struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP); unsigned long lbsize; #ifdef UNION_DIAGNOSTIC - printf("union_statvfs(mp = %p, lvp = %p, uvp = %p)\n", mp, + printf("%s(mp = %p, lvp = %p, uvp = %p)\n", __func__, mp, um->um_lowervp, um->um_uppervp); #endif kmem_zalloc() here? Thanks, rin
CVS commit: src/sys/fs/union
Module Name:src Committed By: christos Date: Sun Sep 11 15:42:29 UTC 2022 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: - avoid another credential leak on error from Chris J-D (chris at accessvector dot net) - KNF - use kmem To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.81 src/sys/fs/union/union_vfsops.c:1.82 --- src/sys/fs/union/union_vfsops.c:1.81 Mon Mar 16 17:20:10 2020 +++ src/sys/fs/union/union_vfsops.c Sun Sep 11 11:42:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.81 2020/03/16 21:20:10 pgoyette Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.82 2022/09/11 15:42:29 christos Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.81 2020/03/16 21:20:10 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.82 2022/09/11 15:42:29 christos Exp $"); #include #include @@ -122,7 +122,7 @@ union_mount(struct mount *mp, const char return EINVAL; #ifdef UNION_DIAGNOSTIC - printf("union_mount(mp = %p)\n", mp); + printf("%s(mp = %p)\n", __func__, mp); #endif if (mp->mnt_flag & MNT_GETARGS) { @@ -154,7 +154,7 @@ union_mount(struct mount *mp, const char * Find upper node. */ error = namei_simple_user(args->target, -NSM_FOLLOW_NOEMULROOT, &upperrootvp); + NSM_FOLLOW_NOEMULROOT, &upperrootvp); if (error != 0) goto bad; @@ -163,7 +163,7 @@ union_mount(struct mount *mp, const char goto bad; } - um = kmem_zalloc(sizeof(struct union_mount), KM_SLEEP); + um = kmem_zalloc(sizeof(*um), KM_SLEEP); /* * Keep a held reference to the target vnodes. @@ -246,7 +246,7 @@ union_mount(struct mount *mp, const char vfs_getnewfsid(mp); mp->mnt_lower = um->um_uppervp->v_mount; - error = set_statvfs_info( path, UIO_USERSPACE, NULL, UIO_USERSPACE, + error = set_statvfs_info(path, UIO_USERSPACE, NULL, UIO_USERSPACE, mp->mnt_op->vfs_name, mp, l); if (error) goto bad; @@ -264,7 +264,7 @@ union_mount(struct mount *mp, const char default: cp = ":"; #ifdef DIAGNOSTIC - panic("union_mount: bad um_op"); + panic("%s: bad um_op", __func__); #endif break; } @@ -278,7 +278,7 @@ union_mount(struct mount *mp, const char memset(xp + size, 0, len - size); #ifdef UNION_DIAGNOSTIC - printf("union_mount: from %s, on %s\n", + printf("%s: from %s, on %s\n", __func__, mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname); #endif @@ -286,16 +286,19 @@ union_mount(struct mount *mp, const char if (!vn_union_readdir_hook) vn_union_readdir_hook = union_readdirhook; - return (0); + return 0; bad: - if (um) - kmem_free(um, sizeof(struct union_mount)); + if (um) { + if (um->um_cred) + kauth_cred_free(um->um_cred); + kmem_free(um, sizeof(*um)); + } if (upperrootvp) vrele(upperrootvp); if (lowerrootvp) vrele(lowerrootvp); - return (error); + return error; } /* @@ -308,7 +311,7 @@ int union_start(struct mount *mp, int flags) { - return (0); + return 0; } /* @@ -333,7 +336,7 @@ union_unmount(struct mount *mp, int mntf int error; #ifdef UNION_DIAGNOSTIC - printf("union_unmount(mp = %p)\n", mp); + printf("%s(mp = %p)\n", __func__, mp); #endif /* @@ -383,7 +386,7 @@ union_unmount(struct mount *mp, int mntf /* * Finally, throw away the union_mount structure */ - kmem_free(um, sizeof(struct union_mount)); + kmem_free(um, sizeof(*um)); mp->mnt_data = NULL; return 0; } @@ -401,7 +404,7 @@ union_root(struct mount *mp, int lktype, if (um->um_lowervp) vref(um->um_lowervp); error = union_allocvp(vpp, mp, NULL, NULL, NULL, - um->um_uppervp, um->um_lowervp, 1); + um->um_uppervp, um->um_lowervp, 1); if (error) { vrele(um->um_uppervp); @@ -420,11 +423,11 @@ union_statvfs(struct mount *mp, struct s { int error; struct union_mount *um = MOUNTTOUNIONMOUNT(mp); - struct statvfs *sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK | M_ZERO); + struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP); unsigned long lbsize; #ifdef UNION_DIAGNOSTIC - printf("union_statvfs(mp = %p, lvp = %p, uvp = %p)\n", mp, + printf("%s(mp = %p, lvp = %p, uvp = %p)\n", __func__, mp, um->um_lowervp, um->um_uppervp); #endif @@ -468,29 +471,27 @@ union_statvfs(struct mount *mp, struct s copy_statvfs_info(sbp, mp); done: - free(sbuf, M_TEMP); + kmem_free(sbuf, sizeof(*sbuf)); return error; } /*ARGSUSED*/ int -union_sync(struct mount *mp, int waitfor, -kauth_cred_t cred) +union_sync(struct mount *mp, int waitfor, kauth_cred_t cred) { /* * XXX - Assumes no data cached at union layer. */ - return (0); + return 0; } /*ARGSUSED*/ int -union_vget(struct mount *mp, ino
CVS commit: src/sys/fs/union
Module Name:src Committed By: christos Date: Sun Sep 11 15:42:29 UTC 2022 Modified Files: src/sys/fs/union: union_vfsops.c Log Message: - avoid another credential leak on error from Chris J-D (chris at accessvector dot net) - KNF - use kmem To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/fs/union/union_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Sat Mar 19 13:48:04 UTC 2022 Modified Files: src/sys/fs/union: union_subr.c union_vnops.c Log Message: As FSTRANS is part of VOP_*LOCK() since June 4, 2017 the vdead_check() from union_lock() is no longer needed. Adapt union_lock() to the recent addition of upgrade or downgrade. VV_LOCKSWORK now. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_subr.c cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Sat Mar 19 13:48:04 UTC 2022 Modified Files: src/sys/fs/union: union_subr.c union_vnops.c Log Message: As FSTRANS is part of VOP_*LOCK() since June 4, 2017 the vdead_check() from union_lock() is no longer needed. Adapt union_lock() to the recent addition of upgrade or downgrade. VV_LOCKSWORK now. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_subr.c cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_subr.c diff -u src/sys/fs/union/union_subr.c:1.79 src/sys/fs/union/union_subr.c:1.80 --- src/sys/fs/union/union_subr.c:1.79 Tue Aug 18 09:44:07 2020 +++ src/sys/fs/union/union_subr.c Sat Mar 19 13:48:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $ */ +/* $NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $ */ /* * Copyright (c) 1994 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $"); #include #include @@ -567,6 +567,7 @@ union_loadvnode(struct mount *mp, struct vp->v_tag = VT_UNION; vp->v_op = union_vnodeop_p; + vp->v_vflag |= VV_LOCKSWORK; vp->v_data = un; un->un_vnode = vp; Index: src/sys/fs/union/union_vnops.c diff -u src/sys/fs/union/union_vnops.c:1.82 src/sys/fs/union/union_vnops.c:1.83 --- src/sys/fs/union/union_vnops.c:1.82 Fri Dec 10 19:30:05 2021 +++ src/sys/fs/union/union_vnops.c Sat Mar 19 13:48:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $ */ +/* $NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $"); #include #include @@ -1709,15 +1709,6 @@ union_lock(void *v) lockvp = LOCKVP(vp); error = union_lock1(vp, lockvp, flags); mutex_exit(&un->un_lock); - if (error) - return error; - if (mutex_tryenter(vp->v_interlock)) { - error = vdead_check(vp, VDEAD_NOWAIT); - mutex_exit(vp->v_interlock); - } else - error = EBUSY; - if (error) - union_unlock1(vp, lockvp); return error; } @@ -1726,7 +1717,7 @@ union_lock(void *v) lockvp = LOCKVP(vp); mutex_exit(&un->un_lock); error = union_lock1(vp, lockvp, flags); - if (error != 0) + if (error != 0 || (flags & (LK_DOWNGRADE | LK_UPGRADE)) != 0) return error; mutex_enter(&un->un_lock); if (lockvp == LOCKVP(vp)) @@ -1735,14 +1726,6 @@ union_lock(void *v) } mutex_exit(&un->un_lock); - mutex_enter(vp->v_interlock); - error = vdead_check(vp, VDEAD_NOWAIT); - if (error) { - union_unlock1(vp, lockvp); - error = vdead_check(vp, 0); - KASSERT(error == ENOENT); - } - mutex_exit(vp->v_interlock); return error; }
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Fri Dec 10 09:20:38 UTC 2021 Modified Files: src/sys/fs/union: union_vnops.c Log Message: Fix previous, don't copy up if the underlying node is unreadable. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vnops.c diff -u src/sys/fs/union/union_vnops.c:1.80 src/sys/fs/union/union_vnops.c:1.81 --- src/sys/fs/union/union_vnops.c:1.80 Sun Dec 5 16:16:58 2021 +++ src/sys/fs/union/union_vnops.c Fri Dec 10 09:20:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.80 2021/12/05 16:16:58 hannken Exp $ */ +/* $NetBSD: union_vnops.c,v 1.81 2021/12/10 09:20:38 hannken Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.80 2021/12/05 16:16:58 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.81 2021/12/10 09:20:38 hannken Exp $"); #include #include @@ -771,10 +771,20 @@ union_access(void *v) } } + /* + * Copy up to prevent checking (and failing) against + * underlying file system mounted read only. + * Check for read access first to prevent implicit + * copy of unaccessible underlying vnode. + */ if (un->un_uppervp == NULLVP && (un->un_lowervp->v_type == VREG) && (ap->a_accmode & VWRITE)) { - error = union_copyup(un, 1, ap->a_cred, curlwp); + vn_lock(un->un_lowervp, LK_EXCLUSIVE | LK_RETRY); + error = VOP_ACCESS(un->un_lowervp, VREAD, ap->a_cred); + VOP_UNLOCK(un->un_lowervp); + if (error == 0) + error = union_copyup(un, 1, ap->a_cred, curlwp); if (error) return error; }
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Fri Dec 10 09:20:38 UTC 2021 Modified Files: src/sys/fs/union: union_vnops.c Log Message: Fix previous, don't copy up if the underlying node is unreadable. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Sun Dec 5 16:16:58 UTC 2021 Modified Files: src/sys/fs/union: union_vnops.c Log Message: In union_access() copy up regular files before checking permissions. Unionfs is meant to provide a writable layer above a read-only layer and should not fail here just because the lower layer is mounted read-only. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Sun Dec 5 16:16:58 UTC 2021 Modified Files: src/sys/fs/union: union_vnops.c Log Message: In union_access() copy up regular files before checking permissions. Unionfs is meant to provide a writable layer above a read-only layer and should not fail here just because the lower layer is mounted read-only. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vnops.c diff -u src/sys/fs/union/union_vnops.c:1.79 src/sys/fs/union/union_vnops.c:1.80 --- src/sys/fs/union/union_vnops.c:1.79 Wed Oct 20 03:08:17 2021 +++ src/sys/fs/union/union_vnops.c Sun Dec 5 16:16:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.79 2021/10/20 03:08:17 thorpej Exp $ */ +/* $NetBSD: union_vnops.c,v 1.80 2021/12/05 16:16:58 hannken Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.79 2021/10/20 03:08:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.80 2021/12/05 16:16:58 hannken Exp $"); #include #include @@ -771,6 +771,13 @@ union_access(void *v) } } + if (un->un_uppervp == NULLVP && + (un->un_lowervp->v_type == VREG) && + (ap->a_accmode & VWRITE)) { + error = union_copyup(un, 1, ap->a_cred, curlwp); + if (error) + return error; + } if ((vp = un->un_uppervp) != NULLVP) { ap->a_vp = vp;
Re: CVS commit: src/sys/fs/union
On Mon, Dec 05, 2011 at 11:12:11AM +, Juergen Hannken-Illjes wrote: > Modified Files: > src/sys/fs/union: union_vfsops.c > > Log Message: > The union file system is as stable as other layered file systems so > no longer print a warning to the console. Erm... I'm not sure I'd say that. Given some of the known outstanding and more or less unfixable bugs, I think the warning should probably stay... although as discussed somewhere or other it should go in the mount program and not in the kernel. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/sys/fs/union
On Wed, 23 Nov 2011, J. Hannken-Illjes wrote: I used to make heavy use of unionfs, and I had no problems. [...] Do you mean `union'? I mean "mount -t union". `unionfs' was imported 2008/02/18 and was never enabled in any kernel config. No, I haven't used that one. I didn't even know about it. --apb (Alan Barrett)
Re: CVS commit: src/sys/fs/union
On Nov 23, 2011, at 11:11 AM, Alan Barrett wrote: >>> My vote would be to remove [unionfs]; it doesn't work and the only reason >>> it was ever brought in had to do with alleged locking improvements. >> >> Is anyone using it? > > I used to make heavy use of unionfs, and I had no problems. (That was on a > uniprocessor machine several years ago.) I sometimes used five layers: a > base set of sources; a unionfs layer for third party changes; a unionfs layer > for my own changes; a unionfs layer for the "obj" directories; and a final > unionfs layer for files created or changed at build time. For example, I > could easily blow away all the build products but keep the obj directories, > by unmounting the top layer unionfs, removing the files in its backing store, > and then re-mounting it. > > Today, I'd use a smarter revision control system instead of the unionfs > layers to manage the source files, but I might still want a unionfs layer to > isolate changes made at build time. > > I have not used unionfs in the past few years, but it would be a pity to lose > this functionality. Do you mean `union'? `unionfs' was imported 2008/02/18 and was never enabled in any kernel config. -- Juergen Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig (Germany)
Re: CVS commit: src/sys/fs/union
My vote would be to remove [unionfs]; it doesn't work and the only reason it was ever brought in had to do with alleged locking improvements. Is anyone using it? I used to make heavy use of unionfs, and I had no problems. (That was on a uniprocessor machine several years ago.) I sometimes used five layers: a base set of sources; a unionfs layer for third party changes; a unionfs layer for my own changes; a unionfs layer for the "obj" directories; and a final unionfs layer for files created or changed at build time. For example, I could easily blow away all the build products but keep the obj directories, by unmounting the top layer unionfs, removing the files in its backing store, and then re-mounting it. Today, I'd use a smarter revision control system instead of the unionfs layers to manage the source files, but I might still want a unionfs layer to isolate changes made at build time. I have not used unionfs in the past few years, but it would be a pity to lose this functionality. --apb (Alan Barrett)
Re: CVS commit: src/sys/fs/union
In article <2022035848.ga17...@netbsd.org>, David Holland wrote: >On Tue, Nov 22, 2011 at 01:17:43AM +, YAMAMOTO Takashi wrote: > > hi, > > > > do you have any plan on fs/unionfs? eg. remove it > >My vote would be to remove it; it doesn't work and the only reason it >was ever brought in had to do with alleged locking improvements. Is anyone using it? christos
Re: CVS commit: src/sys/fs/union
On Tue, Nov 22, 2011 at 01:17:43AM +, YAMAMOTO Takashi wrote: > hi, > > do you have any plan on fs/unionfs? eg. remove it My vote would be to remove it; it doesn't work and the only reason it was ever brought in had to do with alleged locking improvements. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/sys/fs/union
hi, do you have any plan on fs/unionfs? eg. remove it YAMAMOTO Takashi > Module Name: src > Committed By: hannken > Date: Mon Nov 21 18:29:23 UTC 2011 > > Modified Files: > src/sys/fs/union: union.h union_subr.c union_vfsops.c union_vnops.c > > Log Message: > Replace flag based union node locking with generic vnode lock, support > shared and nowait locks and protect un_uppervp and un_*sz with mutex. > > Mark file system MPSAFE. > > > To generate a diff of this commit: > cvs rdiff -u -r1.21 -r1.22 src/sys/fs/union/union.h > cvs rdiff -u -r1.52 -r1.53 src/sys/fs/union/union_subr.c > cvs rdiff -u -r1.64 -r1.65 src/sys/fs/union/union_vfsops.c > cvs rdiff -u -r1.48 -r1.49 src/sys/fs/union/union_vnops.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files.