diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-18 18:09:44 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-18 18:09:44 +0000 |
commit | 14a75551ab8adecfa8504f866b3039a514eba589 (patch) | |
tree | 97bad1a2e1e4f025760e484fea8d1a14281e6c34 | |
parent | 3082708bb92c9b5a6ab11c44aaa464f490ba02f3 (diff) |
Remove remaining whiteout tentacles; OK deraadt@ miod@ weingart@
-rw-r--r-- | include/dirent.h | 4 | ||||
-rw-r--r-- | lib/libc/sys/getdirentries.2 | 5 | ||||
-rw-r--r-- | share/man/man5/dir.5 | 3 | ||||
-rw-r--r-- | sys/compat/linux/linux_getcwd.c | 5 | ||||
-rw-r--r-- | sys/compat/netbsd/netbsd_getcwd.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_cache.c | 13 | ||||
-rw-r--r-- | sys/nfs/nfs_serv.c | 14 | ||||
-rw-r--r-- | sys/sys/dirent.h | 3 | ||||
-rw-r--r-- | sys/sys/namei.h | 4 | ||||
-rw-r--r-- | sys/sys/stat.h | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 45 | ||||
-rw-r--r-- | sys/ufs/ufs/dinode.h | 10 | ||||
-rw-r--r-- | sys/ufs/ufs/dir.h | 3 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_lookup.c | 58 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 8 |
15 files changed, 32 insertions, 152 deletions
diff --git a/include/dirent.h b/include/dirent.h index a01f7853e95..e32e1f0cea4 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.13 2003/08/01 17:38:33 avsm Exp $ */ +/* $OpenBSD: dirent.h,v 1.14 2005/06/18 18:09:42 millert Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -72,9 +72,7 @@ typedef struct _dirdesc { #define dirfd(dirp) ((dirp)->dd_fd) /* flags for opendir2 */ -#define DTF_HIDEW 0x0001 /* hide whiteout entries */ #define DTF_NODUP 0x0002 /* don't return duplicate names */ -#define DTF_REWIND 0x0004 /* rewind after reading union stack */ #define __DTF_READALL 0x0008 /* everything has been read */ #ifndef NULL diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index 896803c3353..e41581625a4 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getdirentries.2,v 1.18 2005/02/23 20:24:57 robert Exp $ +.\" $OpenBSD: getdirentries.2,v 1.19 2005/06/18 18:09:42 millert Exp $ .\" $NetBSD: getdirentries.2,v 1.7 1995/10/12 15:40:50 jtc Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -91,9 +91,8 @@ is the type of file, where the following are possible types: .Dv DT_BLK , .Dv DT_REG , .Dv DT_LNK , -.Dv DT_SOCK , and -.Dv DT_WHT . +.Dv DT_SOCK . .Pp The .Fa d_namlen diff --git a/share/man/man5/dir.5 b/share/man/man5/dir.5 index 7b728aaad9d..4357a4b3243 100644 --- a/share/man/man5/dir.5 +++ b/share/man/man5/dir.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dir.5,v 1.11 2005/06/15 17:51:35 millert Exp $ +.\" $OpenBSD: dir.5,v 1.12 2005/06/18 18:09:42 millert Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -100,7 +100,6 @@ struct dirent { #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 -#define DT_WHT 14 /* * Convert between stat structure types and directory types. diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index 8038ca2c9cf..ef81e15392a 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_getcwd.c,v 1.6 2005/05/26 00:33:45 pedro Exp $ */ +/* $OpenBSD: linux_getcwd.c,v 1.7 2005/06/18 18:09:42 millert Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ /*- @@ -250,8 +250,7 @@ unionread: * but getting the locking games for that * right would be heinous. */ - if ((dp->d_type != DT_WHT) && - (dp->d_fileno == fileno)) { + if (dp->d_fileno == fileno) { char *bp = *bpp; bp -= dp->d_namlen; diff --git a/sys/compat/netbsd/netbsd_getcwd.c b/sys/compat/netbsd/netbsd_getcwd.c index 330e7d405b5..35e0da2ae60 100644 --- a/sys/compat/netbsd/netbsd_getcwd.c +++ b/sys/compat/netbsd/netbsd_getcwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netbsd_getcwd.c,v 1.8 2005/05/26 00:33:45 pedro Exp $ */ +/* $OpenBSD: netbsd_getcwd.c,v 1.9 2005/06/18 18:09:42 millert Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ /*- @@ -244,8 +244,7 @@ unionread: * but getting the locking games for that * right would be heinous. */ - if ((dp->d_type != DT_WHT) && - (dp->d_fileno == fileno)) { + if (dp->d_fileno == fileno) { char *bp = *bpp; bp -= dp->d_namlen; diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 588af4c9d25..259182ecefb 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_cache.c,v 1.17 2005/05/28 07:28:07 marius Exp $ */ +/* $OpenBSD: vfs_cache.c,v 1.18 2005/06/18 18:09:42 millert Exp $ */ /* $NetBSD: vfs_cache.c,v 1.13 1996/02/04 02:18:09 christos Exp $ */ /* @@ -142,10 +142,6 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) nchstats.ncs_badhits++; goto remove; } else if (ncp->nc_vp == NULL) { - /* - * Restore the ISWHITEOUT flag saved earlier. - */ - cnp->cn_flags |= ncp->nc_vpid; if (cnp->cn_nameiop != CREATE || (cnp->cn_flags & ISLASTCN) == 0) { nchstats.ncs_neghits++; @@ -368,13 +364,6 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) ncp->nc_vp = vp; if (vp) ncp->nc_vpid = vp->v_id; - else { - /* - * For negative hits, save the ISWHITEOUT flag so we can - * restore it later when the cache entry is used again. - */ - ncp->nc_vpid = cnp->cn_flags & ISWHITEOUT; - } /* fill in cache info */ ncp->nc_dvp = dvp; ncp->nc_dvpid = dvp->v_id; diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 853369c71f5..049b1a3e3dc 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.38 2004/06/24 19:35:26 tholo Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.39 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -2330,8 +2330,6 @@ out: * - it trims out records with d_fileno == 0 * this doesn't matter for Unix clients, but they might confuse clients * for other os'. - * - it trims out records with d_type == DT_WHT - * these cannot be seen through NFS (unless we extend the protocol) * NB: It is tempting to set eof to true if the VOP_READDIR() reads less * than requested, but this may not apply to all filesystems. For * example, client NFS does not { although it is never remote mounted @@ -2508,8 +2506,7 @@ again: dp = (struct dirent *)cpos; cookiep = cookies; - while (cpos < cend && ncookies > 0 && - (dp->d_fileno == 0 || dp->d_type == DT_WHT)) { + while (cpos < cend && ncookies > 0 && dp->d_fileno == 0) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -2534,7 +2531,7 @@ again: /* Loop through the records and build reply */ while (cpos < cend && ncookies > 0) { - if (dp->d_fileno != 0 && dp->d_type != DT_WHT) { + if (dp->d_fileno != 0) { nlen = dp->d_namlen; rem = nfsm_rndup(nlen)-nlen; len += (4 * NFSX_UNSIGNED + nlen + rem); @@ -2764,8 +2761,7 @@ again: dp = (struct dirent *)cpos; cookiep = cookies; - while (cpos < cend && ncookies > 0 && - (dp->d_fileno == 0 || dp->d_type == DT_WHT)) { + while (cpos < cend && ncookies > 0 && dp->d_fileno == 0) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -2800,7 +2796,7 @@ again: /* Loop through the records and build reply */ while (cpos < cend && ncookies > 0) { - if (dp->d_fileno != 0 && dp->d_type != DT_WHT) { + if (dp->d_fileno != 0) { nlen = dp->d_namlen; rem = nfsm_rndup(nlen)-nlen; diff --git a/sys/sys/dirent.h b/sys/sys/dirent.h index 81d887ac12e..d212affe094 100644 --- a/sys/sys/dirent.h +++ b/sys/sys/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.5 2003/06/02 23:28:21 millert Exp $ */ +/* $OpenBSD: dirent.h,v 1.6 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: dirent.h,v 1.12 1996/04/09 20:55:25 cgd Exp $ */ /*- @@ -67,7 +67,6 @@ struct dirent { #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 -#define DT_WHT 14 /* * Convert between stat structure types and directory types. diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 83027454fb2..5c611d1c14f 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namei.h,v 1.14 2005/05/26 22:40:52 marius Exp $ */ +/* $OpenBSD: namei.h,v 1.15 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */ /* @@ -132,8 +132,6 @@ struct nameidata { #define MAKEENTRY 0x004000 /* entry is to be added to name cache */ #define ISLASTCN 0x008000 /* this is last component of pathname */ #define ISSYMLINK 0x010000 /* symlink needs interpretation */ -#define ISWHITEOUT 0x020000 /* found whiteout */ -#define DOWHITEOUT 0x040000 /* do whiteouts */ #define REQUIREDIR 0x080000 /* must be a directory */ #define STRIPSLASHES 0x100000 /* strip trailing slashes */ #define PDIRUNLOCK 0x200000 /* vfs_lookup() unlocked parent dir */ diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 37ce7d58f87..d4a39f6fb4d 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stat.h,v 1.14 2004/07/13 21:04:29 millert Exp $ */ +/* $OpenBSD: stat.h,v 1.15 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: stat.h,v 1.20 1996/05/16 22:17:49 cgd Exp $ */ /*- @@ -162,7 +162,6 @@ struct stat { #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_IFSOCK 0140000 /* socket */ -#define S_IFWHT 0160000 /* whiteout */ #define S_ISVTX 0001000 /* save swapped text even after use */ #endif @@ -174,7 +173,6 @@ struct stat { #ifndef _POSIX_SOURCE #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ -#define S_ISWHT(m) ((m & 0170000) == 0160000) /* whiteout */ #endif #ifndef _POSIX_SOURCE diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8cd281c25a7..62ba576934e 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_softdep.c,v 1.57 2005/06/10 17:37:40 pedro Exp $ */ +/* $OpenBSD: ffs_softdep.c,v 1.58 2005/06/18 18:09:43 millert Exp $ */ /* * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved. * @@ -2444,15 +2444,6 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp) struct inodedep *inodedep; struct mkdir *mkdir1, *mkdir2; - /* - * Whiteouts have no dependencies. - */ - if (newinum == WINO) { - if (newdirbp != NULL) - bdwrite(newdirbp); - return; - } - fs = dp->i_fs; lbn = lblkno(fs, diroffset); offset = blkoff(fs, diroffset); @@ -2802,18 +2793,12 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir) struct inodedep *inodedep; offset = blkoff(dp->i_fs, dp->i_offset); - - /* - * Whiteouts do not need diradd dependencies. - */ - if (newinum != WINO) { - dap = pool_get(&diradd_pool, PR_WAITOK); - bzero(dap,sizeof(struct diradd)); - dap->da_list.wk_type = D_DIRADD; - dap->da_state = DIRCHG | ATTACHED | DEPCOMPLETE; - dap->da_offset = offset; - dap->da_newinum = newinum; - } + dap = pool_get(&diradd_pool, PR_WAITOK); + bzero(dap,sizeof(struct diradd)); + dap->da_list.wk_type = D_DIRADD; + dap->da_state = DIRCHG | ATTACHED | DEPCOMPLETE; + dap->da_offset = offset; + dap->da_newinum = newinum; /* * Allocate a new dirrem and ACQUIRE_LOCK. @@ -2836,22 +2821,6 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir) dirrem->dm_state |= DIRCHG; /* - * Whiteouts have no additional dependencies, - * so just put the dirrem on the correct list. - */ - if (newinum == WINO) { - if ((dirrem->dm_state & COMPLETE) == 0) { - LIST_INSERT_HEAD(&pagedep->pd_dirremhd, dirrem, - dm_next); - } else { - dirrem->dm_dirinum = pagedep->pd_ino; - add_to_worklist(&dirrem->dm_list); - } - FREE_LOCK(&lk); - return; - } - - /* * If the COMPLETE flag is clear, then there were no active * entries and we want to roll back to the previous inode until * the new inode is committed to disk. If the COMPLETE flag is diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h index df721d2602c..125d4cba69c 100644 --- a/sys/ufs/ufs/dinode.h +++ b/sys/ufs/ufs/dinode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dinode.h,v 1.9 2004/01/20 03:44:06 tedu Exp $ */ +/* $OpenBSD: dinode.h,v 1.10 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: dinode.h,v 1.7 1995/06/15 23:22:48 cgd Exp $ */ /* @@ -49,14 +49,6 @@ #define ROOTINO ((ino_t)2) /* - * The Whiteout inode# is a dummy non-zero inode number which will - * never be allocated to a real file. It is used as a place holder - * in the directory entry which has been tagged as a DT_W entry. - * See the comments about ROOTINO above. - */ -#define WINO ((ino_t)1) - -/* * A dinode contains all the meta-data associated with a UFS file. * This structure defines the on-disk format of a dinode. Since * this structure describes an on-disk structure, all its fields diff --git a/sys/ufs/ufs/dir.h b/sys/ufs/ufs/dir.h index 0b7560cacd8..b32b93d3951 100644 --- a/sys/ufs/ufs/dir.h +++ b/sys/ufs/ufs/dir.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.h,v 1.9 2003/12/28 17:20:16 tedu Exp $ */ +/* $OpenBSD: dir.h,v 1.10 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: dir.h,v 1.8 1996/03/09 19:42:41 scottr Exp $ */ /* @@ -95,7 +95,6 @@ struct direct { #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 -#define DT_WHT 14 /* * Convert between stat structure types and directory types. diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 206e11534c2..544e1b89d76 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_lookup.c,v 1.29 2005/06/10 17:37:41 pedro Exp $ */ +/* $OpenBSD: ufs_lookup.c,v 1.30 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */ /* @@ -350,33 +350,6 @@ foundentry: * reclen in ndp->ni_ufs area, and release * directory buffer. */ - if (vdp->v_mount->mnt_maxsymlinklen > 0 && - ep->d_type == DT_WHT) { - slotstatus = FOUND; - slotoffset = dp->i_offset; - slotsize = ep->d_reclen; - dp->i_reclen = slotsize; - /* - * This is used to set dp->i_endoff, - * which may be used by ufs_direnter2() - * as a length to truncate the - * directory to. Therefore, it must - * point past the end of the last - * non-empty directory entry. We don't - * know where that is in this case, so - * we effectively disable shrinking by - * using the existing size of the - * directory. - * - * Note that we wouldn't expect to - * shrink the directory while rewriting - * an existing entry anyway. - */ - enduseful = endsearch; - ap->a_cnp->cn_flags |= ISWHITEOUT; - numdirpasses--; - goto notfound; - } dp->i_ino = ep->d_ino; dp->i_reclen = ep->d_reclen; goto found; @@ -406,10 +379,7 @@ notfound: * directory has not been removed, then can consider * allowing file to be created. */ - if ((nameiop == CREATE || nameiop == RENAME || - (nameiop == DELETE && - (ap->a_cnp->cn_flags & DOWHITEOUT) && - (ap->a_cnp->cn_flags & ISWHITEOUT))) && + if ((nameiop == CREATE || nameiop == RENAME) && (flags & ISLASTCN) && dp->i_effnlink != 0) { /* * Access for write is interpreted as allowing @@ -903,9 +873,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp) * Update the pointer fields in the previous entry (if any), * copy in the new entry, and write out the block. */ - if (ep->d_ino == 0 || - (ep->d_ino == WINO && - bcmp(ep->d_name, dirp->d_name, dirp->d_namlen) == 0)) { + if (ep->d_ino == 0) { if (spacefree + dsize < newentrysize) panic("ufs_direnter: compact1"); dirp->d_reclen = spacefree + dsize; @@ -990,19 +958,6 @@ ufs_dirremove(dvp, ip, flags, isrmdir) dp = VTOI(dvp); - if (flags & DOWHITEOUT) { - /* - * Whiteout entry: set d_ino to WINO. - */ - error = UFS_BUFATOFF(dp, (off_t)dp->i_offset, (char **)&ep, - &bp); - if (error) - return (error); - ep->d_ino = WINO; - ep->d_type = DT_WHT; - goto out; - } - if ((error = UFS_BUFATOFF(dp, (off_t)(dp->i_offset - dp->i_count), (char **)&ep, &bp)) != 0) return (error); @@ -1033,7 +988,6 @@ ufs_dirremove(dvp, ip, flags, isrmdir) ((dp->i_offset - dp->i_count) & (DIRBLKSIZ - 1)), dp->i_offset & ~(DIRBLKSIZ - 1)); #endif -out: if (DOINGSOFTDEP(dvp)) { if (ip) { ip->i_effnlink--; @@ -1052,9 +1006,7 @@ out: ip->i_ffs_nlink--; ip->i_flag |= IN_CHANGE; } - if (flags & DOWHITEOUT) - error = bwrite(bp); - else if (DOINGASYNC(dvp) && dp->i_count != 0) { + if (DOINGASYNC(dvp) && dp->i_count != 0) { bdwrite(bp); error = 0; } else @@ -1142,7 +1094,7 @@ ufs_dirempty(ip, parentino, cred) if (dp->d_reclen == 0) return (0); /* skip empty entries */ - if (dp->d_ino == 0 || dp->d_ino == WINO) + if (dp->d_ino == 0) continue; /* accept only "." and ".." */ # if (BYTE_ORDER == LITTLE_ENDIAN) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index d1596699ad2..32d477f80df 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.64 2005/06/10 17:37:41 pedro Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.65 2005/06/18 18:09:43 millert Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1251,9 +1251,6 @@ ufs_mkdir(v) if (DOINGSOFTDEP(tvp)) softdep_change_linkcnt(ip, 0); - if (cnp->cn_flags & ISWHITEOUT) - ip->i_ffs_flags |= UF_OPAQUE; - /* * Bump link count in parent directory to reflect work done below. * Should be done before reference is create so cleanup is @@ -2088,9 +2085,6 @@ ufs_makeinode(mode, dvp, vpp, cnp) suser_ucred(cnp->cn_cred)) ip->i_ffs_mode &= ~ISGID; - if (cnp->cn_flags & ISWHITEOUT) - ip->i_ffs_flags |= UF_OPAQUE; - /* * Make sure inode goes to disk before directory entry. */ |