Commit Graph

1201 Commits

Author SHA1 Message Date
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