Commit Graph

1342 Commits

Author SHA1 Message Date
njoly
a28e233447 Do set f_namemax at mount, to provide sensible value for statvfs(2)
calls.
2010-07-07 16:19:55 +00:00
pooka
fdc5aef6ab Remove groolingly spooky variable which has been haunting us for
several years without doing anything useful.
2010-07-06 17:00:06 +00:00
pooka
2c9dc3f982 remember to add the new file to the build 2010-07-06 16:13:57 +00:00
pooka
b90c150c5e Add compat to enable running puffs in a 64bit time_t kernel against
a server which runs in 32bit time_t namespace.
2010-07-06 13:47:47 +00:00
pooka
6e72f16059 ctassert size of some key structures does not change 2010-07-06 12:28:40 +00:00
pooka
013ecf4f81 Make sure that pa_spare is zero-filled and does not contain any
garbage which might disrupt future use.
2010-07-06 12:05:18 +00:00
pooka
e73db95236 union doesn't use layerfs (avoids panic in kernel bootstrap when
union is compiled in but none of the layer-using file systems are).
2010-07-05 21:27:08 +00:00
hannken
c2de422c87 LK_INTERLOCK is no longer a valid flag for VOP_LOCK(). 2010-07-02 07:56:46 +00:00
rmind
71cf548ad1 tmpfs_lookup: add comment, de-ident main path. No functional change.
tmpfs_dir_attach: add assert.
2010-07-02 03:29:47 +00:00
hannken
245651a23d Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode.  All LK_* flags move from sys/lock.h to sys/vnode.h.  Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
2010-07-01 13:00:54 +00:00
hannken
e65a328302 The directory vnode must be locked before we call VOP_WHITEOUT().
Should fix PR #23986 "problem mounting directories".
2010-06-30 13:10:35 +00:00
rmind
559464716e tmpfs_bytes_max: use MIN() rather than min(), which returns int.
Spotted by Wolfgang Solfrank.
2010-06-28 19:32:43 +00:00
rmind
bf5767dcea tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.
2010-06-26 03:38:14 +00:00
hannken
1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
reinoud
cd63900e30 Pullup changes from the write implementation:
- remove unnessisary check that would prevent it from mounting newer nilfs
  images. A field has been added in the segment summary.
- store blocks of files on their virtual block number
2010-06-24 12:15:46 +00:00
reinoud
038180ae32 Update NiLFS(2) on-disc structures from Linux version 2010-06-24 10:20:08 +00:00
hannken
f6c438ba23 Clean up vnode lock operations:
- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
   LK_SHARED and LK_NOWAIT.  LK_INTERLOCK is no longer allowed as it
   makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
  LK_EXCLOTHER.  Mark this operation as "diagnostic only".
  Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
2010-06-24 07:54:46 +00:00
rmind
fc8b3b7154 Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting.  Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944.  Fix PR/38361 while here.  OK ad@.
2010-06-22 18:32:07 +00:00
hannken
2c090918c7 Remove the concept of recursive vnode locks by eliminating
vn_setrecurse(), vn_restorerecurse() and LK_CANRECURSE.
Welcome to 5.99.31

Discussed on tech-kern.
2010-06-18 16:29:01 +00:00
pooka
eb2a46e827 Install ptyfs userspace header into user's space. 2010-06-14 14:40:47 +00:00
pooka
a784ae74af Make retval argument for pathconf a register_t to match VOP_PATHCONF.
This makes the size the same on 64bit archs.  Don't bother bumping
any version, since you'd have explicitly had to jump through some
hoops to use pathconf before.
2010-06-07 11:21:31 +00:00
hannken
62bfdd2b21 Change layered file systems to always pass the locking VOP's down to the
leaf file system.  Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
2010-06-06 08:01:30 +00:00
pooka
704f8889fa Mark files removed in the in-memory structure. This allows us
to do two things:

 1) properly set "recycle?" in inactive
 2) easily check if we are renaming a removed vnode.  without the
    check, it was possible to enter a dirent in the file system for
    a removed (and hence scheduled to be vcleaned) vnode.  this would
    lead to the succesful vget() of a clean vnode.  the use of the
    cleaned vnode was, however, less succesful, except for purposes
    of crashing.
2010-05-27 23:40:12 +00:00
pooka
32de8f7733 Release pathname buffers after use. 2010-05-27 13:22:02 +00:00
pooka
c9f42ce961 fix refcounting 2010-05-26 21:27:00 +00:00
pooka
19264c8c5c Initialize *vpp to NULL: relookup() requires it without initializing
the value before the call (yea, changing relookup would probably
be smart, but other file systems already initialize vpp, so I'm
letting someone else experiment with tylenol od).
2010-05-26 17:52:35 +00:00
pooka
2289d19ea3 Don't double unlock fvp if source file disappears during rename.
Problem found by njoly's awesome stresstester.
2010-05-25 10:15:34 +00:00
pooka
33b074be7e add option string for no attribute cache
(foreseeing the odd event I might actually implement one some day)
2010-05-21 11:29:42 +00:00
pooka
40b04abea5 Since libpuffs needs a major bump for extattr support anyway, make
some changes to the user-kernel protocol.  Namely, try to be a
little more resilient some future changes.
2010-05-21 10:40:19 +00:00
pooka
b91d2535d9 Support extended attributes. 2010-05-21 10:16:54 +00:00
pooka
18dfe9c831 Fix typo. 2010-05-20 12:09:45 +00:00
reinoud
bb702d3252 As per change in NiLFS2 spec, select the superblocks on highest checksum
number and not on their timestamp since one of the timestamps could be wrong when the
clock was set wrong for whatever reason.
2010-05-01 21:21:27 +00:00
pooka
eb097b1b96 Return correct value from union_islocked.
(XXX: anything asserting LK_SHARED will fail because union doesn't
support shared locks)
2010-05-01 10:44:59 +00:00
pooka
0c20c076ce Enforce RLIMIT_FSIZE before VOP_WRITE. This adds support to file
system drivers where it was missing from and fixes one buggy
implementation.  The arguably weird semantics of the check are
maintained (v_size vs. va_bytes, overwrite).
2010-04-23 15:38:46 +00:00
pooka
4fe640bd4d polish previous 2010-04-13 10:12:43 +00:00
pooka
b0e7c8b4f9 If getdisksize() fails (happens e.g. on fss block devices), don't
give up if we don't really need the information provided by it.
2010-04-13 10:11:08 +00:00
mlelstv
c243552ba3 The *_modcmd functions use the module name as prefix. 2010-04-11 10:26:25 +00:00
pooka
024c6fe985 Make module name match MOUNT_NAME. Inspired by PR kern/43110. 2010-04-11 06:36:25 +00:00
hannken
9b0618f1e4 Add file system suspension support (vfs_suspend(9)) to msdosfs.
Reviewed by: Antti Kantee <pooka@netbsd.org>
2010-04-09 08:09:18 +00:00
pooka
997a4cfc3c In genfs where available.
The only functional change is mknod now returning EOPNOTSUPP instead
of EINVAL.  I make this sacrifice willingly and with a clean conscience.
2010-04-08 16:04:35 +00:00
pooka
ed7e284d5c Use genfs instead of homegrown stuff where possible. 2010-04-08 15:03:33 +00:00
pooka
c8dcca6644 * Don't care about VOP_CLOSE() error in unmount. In the extremely
unlike event it did fail, the kernel would double lutz to doom
  (in failure devvp now remains unmountable until reboot.  fans
  of complicated & untested error branches may attempt to gunk this
  up.  i'm not one of them).
* cosmetic surgery: cut extra ;
2010-04-07 15:19:09 +00:00
pooka
242bf1c3e7 Stop exposing fifofs internals and leave only fifo_vnodeop_p visible. 2010-03-29 13:11:32 +00:00
pooka
6f6b6bc6df \n, police! 2010-03-27 02:37:34 +00:00
pooka
4f49fb9915 Don't generate unused fs_thefs.h headers. 2010-03-02 16:43:48 +00:00
snj
ccaf1e96be Fight the ever-increasing size of src checkouts by spelling "useful"
without an extra l.
2010-02-28 15:52:16 +00:00
reinoud
28b2fc3a6f Typo and style 2010-02-26 09:57:39 +00:00
reinoud
1196d96d39 First part of shrinking/growing metadata partition support:
- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition
2010-02-25 16:15:57 +00:00
reinoud
e1abb93a90 Rename metadata partition parameters to be less generic and add the flags. 2010-02-24 19:20:13 +00:00
reinoud
a8903501c1 Extract UDF metadata partition parameters as already done for VAT and sparable
partitions.
2010-02-24 19:14:12 +00:00
pooka
65dca8eead * add a rant about why MPSAFE isn't enabled even though puffs code is
* predict_false that we are mounting when calling statvfs
* KNF
2010-02-17 14:32:08 +00:00
mlelstv
ba0d32752c Replace individual queries for partition information with
new helper function.
2010-01-31 10:30:40 +00:00
mlelstv
61ec757e43 Drop two uses of disk label data.
msdosfs and cd9660 are the only filesystems that verify the filesystem
type in the label. This is the wrong place, sanity checks should only
rely on the inner structure of the filesystem (like signatures or
magic numbers).

msdosfs also used the device type information from the label to
deduce a filesystem parameter heuristically for the gemdos variant.
If there is no information inside the filesystem data itself, this
should be an explicit mount option.
2010-01-26 21:29:48 +00:00
joerg
816eaf9482 On broken filesystems the fillinmap inner loop may have never read a
block, so don't try to release it if bp==NULL.
2010-01-26 20:25:52 +00:00
mlelstv
02346e9564 Fetch sector size also from wedges. 2010-01-25 15:30:44 +00:00
pooka
3557ef52b9 In case the operations thread has exited, do not queue any more
operations.  This prevents kernel memory leaks (one of which happened
every time the file system was unmounted via PUFFSOP_UNMOUNT ...
and incidentally would've been trivially caught with the old
malloc(9) interface.  I wonder if the message is to use a ton of
pools instead of regression-attractive kmem interface).
2010-01-14 19:50:07 +00:00
pooka
50df98fe44 Since VOP_GETATTR() does not require a locked vnode, resolve and
reference the puffs_node before sending the request to the file
server.  This diminishes the window where the inode can be reclaimed
and be invalidated before it is accessed (but does not completely
eliminate the race, as that is a caller problem which we cannot
fix here).
2010-01-14 14:44:13 +00:00
pooka
c3183f3251 The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change
2010-01-08 11:35:07 +00:00
pooka
283c2ca905 Rename PUFFS_SOPREQ_EXIT to PUFFS_SOPREQSYS_EXIT to better signal
it comes from within the kernel instead of as a direct result of
a user request.

no functional change
2010-01-07 23:02:34 +00:00
pooka
8ed2ec74c7 Fix variable name in my commit tree too. 2010-01-07 22:59:27 +00:00
pooka
d728f5380d Add a PUFFS_UNMOUNT server->kernel request, which causes the kernel
to initiate self destruct, i.e. unmount(MNT_FORCE).  This, however,
is a semi-controlled self-destruct, since all caches are flushed
before the (possibly) violent unmount takes place.
2010-01-07 22:45:31 +00:00
mbalmer
982581e04d Remove extra semicolons. 2010-01-05 13:30:10 +00:00
mbalmer
a72f71643d Fix typo in comments, no code change. 2009-12-23 09:17:40 +00:00
pooka
4d6a407bdd Process flush requests from the file server in a separate thread
context.  This fixes a long-standing but seldomly seen deadlock,
where the kernel was holding pages busy (due to e.g. readahead
request) while waiting for the server to respond, and the server
made a callback into the kernel asking to invalidate those pages.
... or, well, theoretically fixes, since I didn't have any reliable
way of repeating the deadlock and I think I saw it only twice.
2009-12-07 20:57:55 +00:00
pooka
0ff1ef75c2 Need to send protocol layer response instead of transport layer
return value.  While there, just collapse all non-supported types
into one entry.
2009-12-07 15:51:52 +00:00
pooka
843ee69fbe Push all information cached in the vnode to the file server before
issuing INACTIVE.  PR kern/42194.
Also, send setattr in fsync asynchronously if FSYNC_WAIT is not set.
2009-12-04 20:26:35 +00:00
pooka
d630c255de vrele, not vput for unlocked devvp 2009-12-03 14:29:04 +00:00
pooka
3f331fa147 Call VOP_CLOSE() in mount error branch with the device locked to
prevent crash when specfs attempts to unlock the vnode.
2009-12-01 09:28:02 +00:00
pooka
1643f3a7a1 Introduce genfs_statvfs() as pretty much a no-info statvfs and
convert several pseudo file systems to use it.
2009-11-30 10:59:19 +00:00
pooka
0ff76018d0 Yes, you need a VOP_UNLOCK() there. 2009-11-27 16:23:23 +00:00
pooka
8b53d2f9df Fix another fine example of "if you make the kernel panic, it's
more secure".
2009-11-27 16:11:35 +00:00
pooka
85fb4c9d18 Don't spam if mount fails due to invalid file system. 2009-11-27 15:58:39 +00:00
jmmv
df61ab1eba Fix panic when trying to delete a directory entry (hi yamt!) by not
attempting to release a pnbuf that does not exist.

I.e. fixes "mkdir a ; unlink a/.".  And actually, this was caught by the
automated tests.
2009-11-22 17:09:58 +00:00
pooka
c58b208bec Send VOP_ABORTOP() in case attempting cross-dev rename, part of
PR kern/42210.  Also, fix a memory management error in said case.
2009-11-19 16:21:04 +00:00
pooka
3214542837 Send VOP_ABORTOP() as a FAF -- we don't care about the return value. 2009-11-19 15:50:49 +00:00
rmind
7c653ba04c Simplify tmpfs_itimes() and use vfs_timestamp(). Also, replace unnecessary
kmem_zalloc()s with kmem_alloc()s.
2009-11-11 09:59:41 +00:00
pooka
1d8c6c1718 Kill suspend support. It was never implemented correctly:
* it depended on the biglock (in a very cruel way)
  * it was attached to userspace transactions rather than logical
    fs operations

(If someone wants to revisit it some day, most of the stuff can be
reused from cvs history)
2009-11-05 19:42:44 +00:00
pooka
1ed7a6beef Reinstante PNODE_DYING. vmlocking had a brief hiatus when it was not
a valid optimization, but that's long gone and once VOP_INACTIVE is
called and the file server says that the vnode is going to be recycled,
it really is going to be recycled extra references gained or not.
2009-11-05 19:22:57 +00:00
bouyer
e0f9b22254 Remove closes 3 and 4 from my copyright. 2009-10-22 21:50:01 +00:00
tron
6492b9712e Add support for 64 bit file offsets to smbfs_smb_setfsize(), largely
based on code taken from FreeBSD.

This stops truncation of files larger than 4GB by VOP_SETATTR() which e.g.
happened when copying large files "rump_smbfs". Kudos to Antti Kantee
for diagnosing the problem in smbfs_smb_setfsize().
2009-10-20 20:55:01 +00:00
pooka
6f49a65bc8 Set recycle to false along with a comment screaming that it should
be set properly to recycle unused vnodes immediately.
2009-10-19 19:12:06 +00:00
tsutsui
3ef39e3a6a Apply a similar fix for mount function from ffs_vfsops.c rev 1.186:
Change cd9660_mount, in MNT_UPDATE case, to check dev_t's for equality
 instead of just vnode pointers.  Fixes erroneous "Invalid argument"
 errors from mount(8) with -u against cd9660 root in the presence of
 mfs or tmpfs /dev prepared after initial mountroot.

Tested on QEMU running cobalt Restore CD.
2009-10-19 17:53:36 +00:00
pooka
50222d88ba Bump protocol version once more to allow for previous to be pulled
to netbsd-5 (protocols are not compatible due to time_t/dev_t
change).
2009-10-17 23:22:04 +00:00
pooka
805e7ceb14 Transmit VOP_ABORTOP() to the server. 2009-10-17 23:16:05 +00:00
njoly
6a42e0741e Make tmpfs write fail when process file size limit is reached. 2009-10-17 22:20:56 +00:00
rmind
9abdb3b71e tmpfs_rename: handle hard-links correctly. Fixes PR/41236. 2009-10-06 00:17:24 +00:00
pooka
89f6fc1189 remove leading whitespace. no functional change. 2009-09-30 18:22:29 +00:00
pooka
ce467a3bc2 * fix a race i introduced almost two years ago in rev 1.116:
operations creating a node cannot be considered outgoing operations,
  since after return from userspace they modify file system state
  by creating a new node.  if we do not protect the file system by
  holding the directory lock, a lookup operation might race us into
  the kernel and create the node earlier.
* remove pnode from hashlish before sending the reclaim faf off to
  userspace.  also, hold pmp_lock while frobbing the list.
2009-09-30 18:19:17 +00:00
pooka
8f328cc813 Set SAVENAME for rmdir and remove.
Addresses an easy part of PR kern/38188
2009-09-19 11:44:19 +00:00
reinoud
c1a508d11c Rework simplistic UBC flushing. Recent changes to genfs made the old flush
system generate heaps of odd allocations since the end of write request was
overwritten by the start of the second resulting in another relocation.

Also added a full flush of the file on a VOP_CLOSE(). This automatically
flushes file tails to disc.
2009-09-14 21:10:44 +00:00
tsutsui
46d031a1e7 Fix typo:
-		pcinfo = kmem_zalloc(sizeof_puffs_cacheinfo) + runsize,
+		pcinfo = kmem_zalloc(sizeof(struct puffs_cacheinfo) + runsize,
in #ifdef'ed out code, per paired kmem_free() in the same function.
Closes PR kern/41840.
2009-09-12 18:17:55 +00:00
njoly
f86bcbdece Fix set_statvfs_info() to use UIO_SYSSPACE for fromname kernel
allocated buffer.
2009-09-07 15:12:03 +00:00
pooka
bca1bf1e84 set mntfromname in a less creative and historic fashion 2009-09-07 12:52:53 +00:00
pooka
7f37fbb7ea Install smb headers relevant for userspace and make mount_smbfs
use installed headers instead of src/sys.
2009-09-03 12:04:50 +00:00
pooka
6d7c95dd93 "kauth_action_t = KAUTH_VNODE_WRITE_FLAGS;" must be C**. However,
we still use plain ISO C, so additionally supply the variable name.
Compile-tested only, but at least that's some testing.
2009-09-03 11:22:05 +00:00
elad
a162140107 Implement the vnode scope and adapt tmpfs to use it.
Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/07/04/msg005404.html
2009-09-03 04:45:27 +00:00
pooka
3a1b983101 Set vnode size after creation(*). Fixes cp(1) from ntfs, the
complaint in the "ntfs ubc_uiomove error" (ubc_uiomove error was
not coming from ntfs but instead the "to" file system) and PR
kern/38531 (well, I assume the submitter wanted cp(1) working on
ntfs instead of mangling ntfs the way the PR title suggests).  Yes,
mmap works on ntfs like it always has.

*) well, um, and in other places too ... uuuh ... no comments.
but I guess this works as long as in-kernel ntfs doesn't grow write
support.
2009-09-01 15:16:41 +00:00
phx
8a98af75d7 Fixed fatal warnings with ADOSFS_DIAGNOSTIC. 2009-08-30 12:36:38 +00:00
elad
534b11d931 Split nilfs_access() to nilfs_check_possible() and nilfs_check_permitted(). 2009-08-26 03:40:48 +00:00
reinoud
7c5a396997 Typo fix 2009-08-05 13:45:48 +00:00
reinoud
7cbe9b45a2 Fix uid/gid check; it was checking if the old values would fit in 32 bits
instead of checking if the new values would.
2009-07-30 12:13:51 +00:00
reinoud
dde01096c4 Re-do nilfs_load_super_root() and implement crc checking of read in super root
to check for consistency.

Since a new crc-seed is chosen on each new nilfs formatting, older structures
will fail the crc check.
2009-07-29 17:06:57 +00:00
reinoud
59cef39273 Add debugging text to indicate a super root has been found while searching for
it.
2009-07-29 13:23:23 +00:00
reinoud
ad5a398ed7 Enhance/fix read support for sparse files.
Extents read in wich there were no mappings at all were defined would error
out and files beginning with a sparse area were erroring out.
2009-07-28 15:31:21 +00:00
reinoud
1f6bbe277a System nodes are not written out on becomming inactive; they should be written
out before automatically.

However, when dealing with faulty discs that fail to mount, system nodes are
of course not written out and thus may still be marked dirty, if only due to
access. Especially on sequential media this gave rise to panics on reading
trackinfo since the write track section had not yet been initialised.
2009-07-27 13:20:41 +00:00
reinoud
09d39e1a6c Issue extra synchronise caches before closing tracks or sessions. It shouldn't
be needed as the caches should already be synchronised, but better be safe.
2009-07-27 13:13:33 +00:00
reinoud
69a586f230 Import read-only part of the NiLFS (v2) implementation for NetBSD. It has been
tested with a DEBUG+DIAGNOSTIC+LOCKDEBUG kernel. To summerise NiLFS, i'll
repeat my posting to tech-kern here:

NiLFS stands for New implementation of Logging File System; LFS done
right they claim :) It is at version 2 now and is being developed by NTT, the
Japanese telecom company and recently put into the linux source tree. See
http://www.nilfs.org. The on-disc format is not completely frozen and i expect
at least one minor revision to come in time.

The benefits of NiLFS are build-in fine-grained checkpointing, persistent
snapshots, multiple mounts and very large file and media support. Every
checkpoint can be transformed into a snapshot and v.v. It is said to perform
very well on flash media since it is not overwriting pieces apart from a
incidental update of the superblock, but that might change. It is accompanied
by a cleaner to clean up the segments and recover lost space.

My work is not a port of the linux code; its a new implementation. Porting the
code would be more work since its very linux oriented and never written to be
ported outside linux. The goal is to be fully interchangable. The code is non
intrusive to other parts of the kernel. It is also very light-weight.

The current state of the code is read-only access to both clean and dirty
NiLFS partitions. On mounting a dirty partition it rolls forward the log to
the last checkpoint. Full read-write support is however planned!

Just as the linux code, mount_nilfs allows for the `head' to be mounted
read/write and allows multiple read-only snapshots/checkpoint mounts next to
it.

By allowing the RW mount at a different snapshot for read-write it should be
possible eventually to revert back to a previous state; i.e. try to upgrade a
system and being able to revert to the exact state prior to the upgrade.

Compared to other FS's its pretty light-weight, suitable for embedded use and
on flash media. The read-only code is currently 17kb object code on
NetBSD/i386. I doubt the read-write code will surpass the 50 or 60. Compared
this to FFS being 156kb, UDF being 84 kb and NFS being 130kb. Run-time memory
usage is most likely not very different from other uses though maybe a bit
higher than FFS.
2009-07-18 16:31:41 +00:00
apb
0a2587be49 Initialise the "fork" local variable in hfslib_get_file_extents().
This variable was not actually used uninitialised, but some compilers
(e.g. gcc-4.3.3) warned that the variable might be used uninitialised.
Inspired by PR 41255 from Kurt Lidl.
2009-07-14 21:12:18 +00:00
reinoud
77a7c01d68 Fix alternating oddity in RMW strategy. Even when in the reading state it
would push out elements to fillup-read only when the time had come for them.
This could then trickle feed the read queue slowly, but fast enough to prevent
it from switching state.
2009-07-08 19:04:08 +00:00
reinoud
ff90f0d37d Remove unused LIST_ENTRY()'s now replaced by the rbtree. 2009-07-08 14:53:23 +00:00
reinoud
7f0e98bc0d Since OSTA has not defined a good set of flags to cover our flags, its not
usefull to implement chflags(). Instead ignore it for now since the error
codes might confuse esp. gui's.
2009-07-08 14:46:55 +00:00
reinoud
c093c2520a Replace the old hashtable and sorted list implemenation by a RB-tree.
Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
2009-07-07 10:23:36 +00:00
reinoud
4eb9ccfea3 Re-implement read-modify-write backend strategy. This version is a lot more
clean locking-wise and will consume less CPU power on needless moving-around.
2009-07-06 17:13:38 +00:00
reinoud
0a3cb580be Reduce the number of active ecclines; low memory systems could get into
trouble otherwise.

XXX this value should be computed eventually.
2009-07-06 17:08:04 +00:00
reinoud
2f9a24b61c Make source prettier 2009-07-06 17:06:57 +00:00
cegger
d6fd22aa8b make this build w/o SMB_VNODE_DEBUG 2009-07-04 07:36:46 +00:00
elad
1d5d8311da Fix cut/paste error and put back a missing variable. 2009-07-04 00:03:22 +00:00
pgoyette
c13b143ea3 Pass the vp arg to udf_check_possible() so we can access its v_mount
member.

XXX No idea if this is the right solution to this problem, but it does
XXX at least allow thebuild to continue.  The original committed should
XXX verify that this does what was intended!

(Hello again, Elad)
2009-07-03 23:14:11 +00:00
pgoyette
c2a56cbb37 Define error before using it.
(Hello again, elad!)
2009-07-03 22:38:08 +00:00
pooka
512aa8b607 Fix utterly botched previous commit. efs compiles now and apprears
to work, but the person doing the original change should verify
that it actually works like before the change.

(hi, elad!)
2009-07-03 22:25:51 +00:00
elad
009f5d2f88 Where possible, extract the file-system's access() routine to two internal
functions: the first checking if the operation is possible (regardless of
permissions), the second checking file-system permissions, ACLs, etc.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
2009-07-03 21:17:40 +00:00
njoly
fbe16f2ec1 Directory open with NT_SMBS capability require the NOPEN bit to be set
too.
2009-07-03 18:35:33 +00:00
reinoud
2a23ff6c30 Enhance dumping on buffer screwup. Also prevent races or invalid combinations
to exist for ecclines.
2009-07-02 16:56:35 +00:00
njoly
84a85be4f9 Fix some panics while trying to umount a smbfs share.
Be sure that no other active vnodes remains, before trying to release
the root one. Likewise, do not destroy the smbmount specific structure
if the umount will fail (busy conditions).

No objection from pooka@.
2009-07-02 16:17:52 +00:00
dholland
effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
reinoud
7e99247bdd Fix corner-case in truncing files. It could forget to free the last block.
This would result in a free-space map with one block orphaned.
2009-06-27 13:42:06 +00:00
reinoud
5e29d1224f Rewrite of udf_on_rootpath(), and vop_rename() code that calls it, after the
UFS way. The tree walking is now done the same and the code hasn't locked up
on examples that made it lockup before.
2009-06-25 17:16:33 +00:00
reinoud
706de0e547 Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
2009-06-24 17:09:13 +00:00
reinoud
c2fd371267 Bump the NetBSD kernel UDF id to version 0.5 2009-06-23 20:13:37 +00:00
reinoud
75bab0f5ee Renaming in UDF was already possible but directories could only be renamed in
the same directory.

This patch finally allows a directory to be moved between parent directories.
2009-06-23 20:09:07 +00:00
elad
870920260d Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
2009-06-23 19:36:38 +00:00
njoly
0cef178686 Fix compilation with SMB_*_DEBUG options. 2009-06-22 21:13:50 +00:00
reinoud
c76ee53287 Add overlooked `cred' declaration in udf_write() when i committed the catchup
patches.
2009-06-18 15:51:44 +00:00
reinoud
8f6cc2bd0e Pass-on credentials to size reversal on aborted write due to error. It could
be that in the future this credentials need to be changed to allways-allow
since its an reverting-on-error behaviour.
2009-06-18 15:15:10 +00:00
reinoud
9cf321ebdd Fix nitpicky spacing and debug printout 2009-06-18 15:09:18 +00:00
reinoud
66e7de7ac6 Remove unneeded (and unused) inclusion of "opt_quota.h" 2009-06-18 15:06:38 +00:00
reinoud
b32db61b9b Enhance comment on node locking when writing out a node's descriptors. 2009-06-18 15:03:34 +00:00
reinoud
45929a2856 Remove unneeded wait for SYNC being finished on node disposal of deleted node;
this could interfere and lockup.
2009-06-18 15:01:34 +00:00
reinoud
ba587e2e62 Add RESERVE bitmask flag to DEBUG print constants adding another 0 prefix to
the constants already defined.
2009-06-18 14:57:50 +00:00
reinoud
96a16f2f23 Remove now unused UDF_DIRHASH constants 2009-06-18 14:56:09 +00:00
reinoud
b33f7bb0ef Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
2009-05-20 15:30:26 +00:00
reinoud
2d212d801f Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.
2009-05-20 13:25:50 +00:00
reinoud
2b1b74bba4 Account for the logical blocks recorded by the extent in the right endian! 2009-05-19 16:24:05 +00:00
reinoud
e186770777 On creation of a new node, don't forget to set the length of the allocated
space in the right endian!
2009-05-19 16:06:56 +00:00
reinoud
c3511553ae Forgot to use the udf_rw16() on the descriptor crc lengths of FID's!
Also fix a few dubiously formatted checks.
2009-05-19 15:08:42 +00:00
reinoud
fbd470bae3 A descriptor's CRC lenth is 16 bit so use udf_rw16() on tag.desc_crc_len. 2009-05-19 15:07:20 +00:00
reinoud
c469916e3d ANSI-fy. No idea why they weren't so in the first place. 2009-05-18 21:09:54 +00:00
reinoud
937ed04261 Fix *serious* bug in bswapping definitions for big endian machines. 2009-05-18 20:52:24 +00:00
reinoud
7b913c191b Make ecma167 header file compilable by pcc 2009-05-18 20:51:03 +00:00
pooka
c94cfd7632 add some todo-items, based on a file which was lingering in my
local tree for apparently almost two years now
2009-05-18 15:47:28 +00:00
elad
863a01b5c1 Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
2009-05-07 19:30:29 +00:00
elad
69db27dc69 Replace open-coded vaccess() in ntfs_access() with a call to vaccess().
Similarly to msdosfs, always add the exec bit to keep the current
behavior.

Mailing list reference:

    http://mail-index.netbsd.org/tech-kern/2009/04/21/msg004881.html
2009-04-29 22:33:33 +00:00
pooka
986e36ad6d replace outdated comment. no functional change 2009-04-29 11:01:50 +00:00
uch
c519d37fde added error check. 2009-04-26 12:41:59 +00:00
elad
f9642d24c5 Wrap some long lines in a comment, pointed out by ad@ - thanks!
While here, wrap two more long lines.
2009-04-25 21:26:20 +00:00
elad
54bf8cc67a Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:44 +00:00
elad
9670d2e41d Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:43 +00:00
elad
f68b0219b0 Per discussion on tech-kern@:
- Replace use of label/goto with returns

  - Rename, change prototype of, and move functions from vfs_subr.c to
    genfs_vnops.c
2009-04-22 22:57:08 +00:00
reinoud
91d6e78060 Fix endian related bug when using discs with a meta-data partition on
big-endian machines.
2009-04-21 16:19:00 +00:00
elad
b0745a039e Pass VREAD instead of FREAD to VOP_ACCESS().
Okay christos@.
2009-04-20 21:29:01 +00:00
elad
386808d4a0 Refactor some duplicated file-system code.
Proposed and received no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/18/msg004843.html
2009-04-20 18:06:26 +00:00
tsutsui
d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
yamt
c495a11d21 plug some pnbuf leaks. 2009-04-15 11:41:25 +00:00
markd
270aadb75a For chown make auth checks consistent with UFS. Fixes PR kern/40933. 2009-04-11 11:59:04 +00:00
perry
e4c34b0c5f SAVENAME was not set for rename and delete as required
Patch from christos, fixes pr 41183
2009-04-11 00:21:57 +00:00
yamt
63d0089e0e - tmpfs_dir_lookup: simplify.
- add some assertions.
2009-04-10 03:40:05 +00:00
pooka
6d35065877 * create only one vnode per inode
* add locking
2009-04-09 09:56:30 +00:00
pooka
42ca2fba4f VOP_CLOSE in error branches 2009-04-09 07:55:55 +00:00
pooka
f505490c8d Invariants should be tested for with KASSERT instead of semi-pretending
that them not holding is an acceptable error condition.
2009-04-05 15:10:41 +00:00
ad
4c75d20cd4 Turn up the volume on the warning message a bit and note that unionfs can
corrupt the underlying file system. This is an old problem but is now
much easier to trigger because VFS has gone fully multithreaded.
2009-04-04 10:32:49 +00:00
pooka
bb78ae5d1b Fix yet another recent crashy bug in tmpfs rename: since the source
dirent is no longer cached in lookup and we do the lookup ourselves
in rename, we are most definitely not allowed to assert that it
matches the source vnode passed as an argument.  In case the source
node does not exist or has been replaced, punt with ENOENT.

Also, nuke some misleading prehistoric comments which haven't been
valid in over a year.

Fixes PR kern/41128 by Nicolas Joly
2009-04-03 14:47:40 +00:00
pooka
696e7eae87 fix botch in previous 2009-03-27 06:35:10 +00:00
pooka
f75bcfdea3 pretend to do some sort of cleanup in error branches 2009-03-26 20:05:07 +00:00
reinoud
b9f5db933c Fix possible overshoot when allocating from a space bitmap when ffs(3) returns
a too big offset for the bitmap.
2009-03-25 20:04:52 +00:00
haad
3914ae191c Destroy mutexes used to guard hash table during vfs_detach. Fixes LOCKDEBUG
panic when ptyfs module is unloaded.
2009-03-24 22:05:24 +00:00
christos
9114dc885f Fix old userland compat. 2009-03-21 01:11:53 +00:00
reinoud
a3665ba58f Fix panic due to memory leak on symlink creation. A test copy with 3000+
symlinks could get the machine down.
2009-03-20 23:06:52 +00:00
pooka
5ac2257698 Release dvp in mknod error branch.
Nicolas Joly, PR kern/41006
2009-03-19 13:47:32 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger
164477c65a ansify function definitions 2009-03-15 22:16:09 +00:00
cegger
b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
christos
3cb697e64a Add a chroot flag, so that ptyfs can be mounted in a chrooted environment.
XXX: This is a hack, in reality we should allow multiple ptyfs mounts.
2009-03-15 16:43:55 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
yamt
b9a7e1db53 udf_write_filebuf: remove an write-only variable 2009-02-22 15:26:51 +00:00
reinoud
193ccd2d90 Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
2009-02-11 13:08:08 +00:00
reinoud
78466aa1e7 Add simplistic UBC async flushing as other FS's seem to do. Its a clutch and
needs to be addressed in UBC properly.
2009-02-10 21:24:27 +00:00
reinoud
afd8cb8795 Remove dead code and double check if its allowed to write out non-sequential
there.
2009-02-10 17:49:02 +00:00
reinoud
a02b732e06 Sequential writing goes before normal write. Its not likely to ever go wrong
but there could be a race otherwise.
2009-02-10 17:48:19 +00:00
reinoud
9609b0ed76 Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
2009-02-08 19:14:52 +00:00
reinoud
2ac9ba8c48 If mounting for read-write dont allow a session number to be specified since
its currently still misbehaving. If supported later, it would allow one or a
series of sessions on a sequential recordable media to be ignored as if they
never were created.

Also fix a small comment: its not the direct but the bootstrap disc strategy
that we close down.
2009-02-08 19:04:41 +00:00
pooka
4c7be59b17 If fdvp is tvp, do nothing. Prevents local DoS panic described in
PR kern/38219... maybe.  This is hastily concocted fix for 5.0 and
I'm not sure if it has side-effects.
2009-02-07 19:42:57 +00:00
pooka
6b5b1701a9 Specify BROKEN DIRECTORY ENTRY printf comes from udf
(can happen e.g. with medium error)
2009-02-05 19:39:08 +00:00
abs
d82fca09e4 Remove additional GEMDOS only check on fstype, and update comment 2009-02-05 18:39:15 +00:00
jmcneill
a85de6510e From FreeBSD, 10 years ago;
Now empty DOS filesystems default to long file names. Non-empty filesystems
without traces of Win95 default to short file names, as before.
2009-01-23 12:46:23 +00:00
cegger
636f235e0d buildfix: re-adapt for major/minor returning 32bit value again. 2009-01-22 16:05:03 +00:00