Commit Graph

128 Commits

Author SHA1 Message Date
jdolecek aaba5c2cd4 unify the statvfs-reporting related code to single smbfs_smb_statvfs routine
for easier maintenance; the decision to use either
SMB_TRANS2_QUERY_FS_INFORMATION or SMB_COM_QUERY_INFORMATION_DISK
is done inside it, the code for populating struct statvfs with values
is shared
2004-06-05 07:36:25 +00:00
jdolecek 88edd838ec set 'frag' size to the same value as the file system block size, so
that userland would pick up correct size of unit (it uses lower of
these values as the size of one 'block' for f_blocks et.al.)
fixes PR bin/25319 by Juan RP
2004-06-05 06:28:11 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 53c625655c Sysctl descriptions under vfs subtree 2004-05-25 04:44:43 +00:00
jdolecek 58218d4f0f add comments for values returned from the SMB request info used for statvfs 2004-05-23 11:18:28 +00:00
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +00:00
atatat 1d3a6a329e Explicitly call pool_init() (and pool_destroy()) when being built as
an _LKM.

This adds pools to the list of things that lkms must do manually
because they're set up with link sets.  Not that there's anything
wrong with link sets, but that we need to try harder to remember that
lkms are second class citizens.  Of a sort.
2004-05-20 05:39:34 +00:00
jrf 5f626331c1 caddr_t -> void * and removal of some more casts. 2004-05-12 02:07:37 +00:00
jrf e3a43961ff Remove caddr_t inlines. Approved by christos@NetBSD.org. 2004-05-04 13:26:58 +00:00
jrf fc97fd571a First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

	- removed casts from unionfs, deadfs and fdesc
	  (there are more to hunt down still)
	- changed vfs_quotactl args argumet from caddr_t to void *
	- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
2004-04-27 17:37:30 +00:00
christos 9ec61a4e56 fix compile error (thanks Juan RP) 2004-04-26 20:38:22 +00:00
christos c30382f197 fix fragment size. 2004-04-26 17:08:45 +00:00
christos 85a8e7acfa fill namemax 2004-04-26 17:08:34 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
jdolecek 2c39ad3ea5 remove apparently meaningless part of one debug printf insmbfs_lookup() 2004-03-22 16:40:48 +00:00
jdolecek e36d8bbf0f in smbfs_smb_lookup(), check the returned (found) file name matches
exactly the filename we wanted to lookup, so that file names differing
in case are refused right away

resolves the chdir part of PR kern/22835 by Rob Quinn (cd succeeded when
it was supposed to fail)
2004-03-21 16:04:07 +00:00
jdolecek 93afaf4fc0 use SMBVDEBUG() instead of #ifdef SMB_VNODE_DEBUG 2004-03-21 13:43:46 +00:00
jdolecek 76763df930 no need of #ifdef SMB_VNODE_DEBUG around SMBVDEBUG() 2004-03-21 13:43:09 +00:00
jdolecek 8c5dfdc365 Allow the [, ], and = characters in non-8.3 filenames since they
are allowed by Windows (ref: MS KB article 120138).

Change follows FreeBSD rev. 1.40
2004-03-21 10:24:01 +00:00
jdolecek 64022a06e1 Add missing permission checks to the smbfs VOP_SETATTR vnode op for the
case where the caller requests to change access or modification times.
Change obtained from FreeBSD rev. 1.30
2004-03-20 21:03:42 +00:00
jdolecek bfa09b45ff ditch busted access check in smbfs_access(), and use vaccess() instead;
also normalize function contents to resemble other filesystems,
and add a SMBVDEBUG() to ease eventual future debugging

partially based on FreeBSD rev. 1.29

fixes PR kern/23373 by Piotr Stolc
2004-03-20 20:26:28 +00:00
jdolecek f3503f30a7 escape the backslash in badchars so that smbfs_pathcheck() correctly
rejects pathnames with backslashes in them (and to avoid a syntax error)

change from FreeBSD
2004-03-20 19:48:30 +00:00
jdolecek edb0fb0a4c pullup FreeBSD change rev. 1.44 - restore closing of SMB find handle
in smbfs_close(); it's necessary to overcome limitation of the current
directory lookup code

this fixes problem where ls wouldn't show newly created files, such as:
> touch a b c
> ls
>

problem and fix pointed out by YAMAMOTO Takashi
2004-03-20 18:41:02 +00:00
jdolecek 1c8e4dd167 add comment to smbfs_remove() regarding the limitation to only remove
unreferenced files
2004-02-29 12:19:15 +00:00
jdolecek b4b58e65b1 print info about active vnodes in reclaim/inactive if prtactive is set 2004-02-29 12:17:39 +00:00
jdolecek 1a3236aefa close the SMB handle when vnode is inactivated, rather than on file close,
so that mmap()ped regions remain accessible even when the file descriptor
is closed
g/c smbnode's n_opencount, and have single NOPEN flag instead

fixes PR kern/24516 by Lloyd Parkes

change obtained from FreeBSD, with only minor adjustments
2004-02-29 11:47:08 +00:00
jdolecek 8af8547957 smbfs_rename(): #ifdef notyet some code related to disabled smbfs_smb_move(),
and also fix a return in the code section - we need to do vnode cleanup
before returning error
2004-02-28 09:19:53 +00:00
jdolecek 0a48f48a91 smbfs_rename(): only touch attribute cache properties if the operation
is carried out; particularily, don't touch it if the rename files
due to EXDEV - the 'from' or 'to' vnode may not be on smbfs filesystem
at all in that case
this is the final fix for PR kern/24455 by Milos Urbanek
2004-02-28 09:04:00 +00:00
jdolecek 756045a44e fix PNBUF_PUT() calls:
* it should not be called for rmdir or remove vop
* for create and mkdir, it should only be called on error, or when
  SAVESTART flag is not set

fixes PR kern/24455 by Milos Urbanek
2004-02-22 11:14:08 +00:00
hannken d6170777cf Fix xxx_strategy() to use the vnode arg instead of bp->b_vp. 2004-01-26 10:39:29 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
christos bbda852cff FIx uninitialized variable warnings 2003-10-25 18:33:37 +00:00
christos d4ca1c7d1e fix uninitialized variable 2003-10-25 08:39:05 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
martin b13abb2046 Fix a few small glitches (struct proc -> struct lwp) 2003-06-29 12:17:21 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
martin 864f19482a #ifdef _KERNEL_OPT police 2003-06-23 14:59:21 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
jdolecek d135e24e2d fix couple more simple lock issues on smbfs_close() code path:
* vinvalbuf needs to be called without simplelocks held
* need to release the lock in opencount > 0 case
* need to release the lock before smbfs_findclose(), since that
  can send a request to SMB server and attempt to pool_get() a request buffer
problem path found & testing by Martin Husemann, fix adresses PR kern/21067
2003-04-09 18:57:29 +00:00
jdolecek 1ae0467918 back to passing magic '1' as lock id in smbfs_advlock() - the number
is used to setup a 'PID' for the lock; if a SMB write request is sent
to server, it returns EDEADLK if it doesn't have same PID. since we
use '1' as request PID (see smb_rq_new()), we must use '1' here too,
for now
add a comment what is the ID used for, to avoid similar mistake in future

this partially back off rev 1.5, and makes advisory locking work
on SMB shares mounted from Windows again (sigh)
2003-04-08 21:06:33 +00:00
jdolecek a66d80ca2a smbfs_remove(): undo broken condition change from rev. 1.3 - apparently
the condition was changed to be true when the file _should_ be removed,
but ended up wrong way

this fixes a problem where it wasn't possible to remove regular files
from mounted smbfs share
2003-04-08 19:01:00 +00:00
jdolecek 3068339e18 fix locking issues uncovered by LOCKDEBUG, reorganize code a bit so that
even the initial directory notify request is sent by smbkq thread
problems found during LOCKDEBUG hunt, adresses PR kern/21067 by Martin Husemann
2003-04-08 18:16:01 +00:00
jdolecek 9e423ce633 release the vnode interlock sooner in smbfs_close[l](), before calling
smbfs_smb_close() - that routine allocates memory and could sleep
problem found with LOCKDEBUG, change adresses PR kern/21067 by Martin Husemann

g/c unneeded VOP_GETATTR() call from smbfs_closel()
2003-04-08 17:09:22 +00:00
jdolecek 293074e648 attach/detach also malloc type M_SMBFSHASH ('oops') 2003-04-08 16:26:31 +00:00
jdolecek 1cd92a1660 use pools instead of malloc(9) for allocation of smb request structures
convert all code to use smb_{rq|t2}_alloc() instead of allocating
structures on stack, make smb_rq_init()/smb_t2_init() static and not
exported outside smb_rq.c
2003-04-07 19:35:39 +00:00