Home | History | Annotate | Download | only in lfs
History log of /src/sys/ufs/lfs/ulfs_quota1.c
RevisionDateAuthorComments
 1.12  29-Jun-2021  dholland Add containment for the cloning devices hack in vn_open.

Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)
 1.11  20-Jun-2016  dholland branches: 1.11.34;
Merge -r1.20 and -r1.21 of ufs_quota1.c: widen before multiplying.
 1.10  20-Jun-2016  dholland More already-merged or equivalent changes:

ufs_dirhash.c 1.36 corresponds to ulfs_dirhash.c 1.8
ufs_extattr.c 1.43 corresponds to ulfs_extattr.c 1.7
ufs_lookup.c 1.126 does not apply to lfs
ufs_lookup.c 1.127 we already have
ufs_lookup.c 1.128 does not apply to lfs
ufs_lookup.c 1.129 corresponds to ulfs_lookup.c 1.19
ufs_quota1.c 1.19 corresponds to ulfs_quota1.c 1.7
ufs_quota1.c 1.20 corresponds to ulfs_quota1.c 1.8
ufs_quota2.c 1.36 we have equivalent changes for
ufs_rename.c 1.9 corresponds to lfs_rename.c 1.5
ufs_rename.c 1.10 corresponds to lfs_rename.c 1.6
ufs_vnops.c 1.219 corresponds to lfs_vnops.c 1.260 and ulfs_vnops.c 1.19
ufs_vnops.c 1.220 corresponds to lfs_vnops.c 1.261 and ulfs_vnops.c 1.20
ufs_vnops.c 1.221 was superseded by later changes
ufs_vnops.c 1.222 got fixed independently in lfs
 1.9  26-Jul-2015  hannken Remove bogus "mutex_enter(&mntvnode_lock)".
 1.8  24-May-2014  christos branches: 1.8.4;
Introduce a selector function to the vfs vnode iterator so that we don't
need to vget() vnodes that we are not interested at, and optimize locking
a bit. Iterator changes reviewed by Hannken (thanks), the rest of the bugs
are mine.
 1.7  17-Mar-2014  hannken branches: 1.7.2; 1.7.4;
Change lfsquota1_handle_cmd_quotaon() and lfs_q1sync()
to use vfs_vnode_iterator.
 1.6  28-Jul-2013  dholland Migrate the miscellaneous ulfs-level info from struct ulfsmount to
struct lfs.

Put them inside #ifdef _KERNEL there. They are not the only such
members, gross as that is. Unfortunately, moving struct lfs to
lfs_kernel.h does not work.
 1.5  08-Jun-2013  dholland branches: 1.5.2; 1.5.4;
mp->mnt_wapbl and mp->mnt_wapbl_replay are always NULL in here.
 1.4  06-Jun-2013  dholland Add lfs_ or ulfs_ in front of extern symbols lacking them, mostly
quota-related (and particularly quota2-related) stuff.
 1.3  06-Jun-2013  dholland Split lfs from ufs step 4:

Massedit all ufs symbols to be "ulfs" instead, to make sure there are
no conflicts with ufs. Confirmed with grep.

(This required changing a few comments that maybe should have been
left alone to say "ulfs", but we'll survive that.)
 1.2  06-Jun-2013  dholland Split lfs from ufs, part 2:

Change all <ufs/ufs/foo.h> includes to <ufs/lfs/ulfs_foo.h>.
 1.1  06-Jun-2013  dholland Split lfs from ufs, part 1: cut and paste 15000 lines of ufs as "ulfs".

These are verbatim copies except that I've preserved the ufs rcsids
for reference. Also,
ufs/quota.h -> ulfs_quotacommon.h
ufs/ufs_quota.h -> ulfs_quota.h

Splitting lfs from ufs was ok'd by core some years ago. This is not
from my original tree, which became unmergeable after the several sets
of quota changes; I've done the work over again over the last couple
days.
 1.5.4.2  18-May-2014  rmind sync with head
 1.5.4.1  28-Aug-2013  rmind sync with head
 1.5.2.4  03-Dec-2017  jdolecek update from HEAD
 1.5.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.2  23-Jun-2013  tls resync from head
 1.5.2.1  08-Jun-2013  tls file ulfs_quota1.c was added on branch tls-maxphys on 2013-06-23 06:18:39 +0000
 1.7.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.4.1  17-Mar-2014  yamt file ulfs_quota1.c was added on branch yamt-pagecache on 2014-05-22 11:41:19 +0000
 1.7.2.1  10-Aug-2014  tls Rebase.
 1.8.4.2  09-Jul-2016  skrll Sync with HEAD
 1.8.4.1  22-Sep-2015  skrll Sync with HEAD
 1.11.34.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed