summaryrefslogtreecommitdiffstats
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* Modify the file handle hash function in the experimental NFSrmacklem2010-10-223-1/+17
| | | | | | | | server so that it will work better for non-UFS file systems. The new function simply sums the bytes of the fh_fid field of fhandle_t. MFC after: 10 days
* Modify the experimental NFS server in a manner analagous tormacklem2010-10-211-1/+9
| | | | | | | | r214049 for the regular NFS server, so that it will not do a VOP_LOOKUP() of ".." when at the root of a file system when performing a ReaddirPlus RPC. MFC after: 10 days
* Fix the type of the 3rd argument for nm_getinfo so that it worksrmacklem2010-10-191-3/+3
| | | | | | | for architectures like sparc64. Suggested by: kib MFC after: 2 weeks
* Modify the NFS clients and the NLM so that the NLM can be usedrmacklem2010-10-194-16/+58
| | | | | | | | | | | | | by both clients. Since the NLM uses various fields of the nfsmount structure, those fields were extracted and put in a separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. This structure also has a function pointer for a function that extracts the required information from the mount point and nfs vnode for that particular client, for information stored differently by the clients. Reviewed by: jhb MFC after: 2 weeks
* Fix a possible race where the directory dirent is moved to the locationkevlo2010-10-181-3/+8
| | | | | | | | | that was used by ".." entry. This change seems fixed panic during attempt to access msdosfs data over nfs. Reviewed by: kib MFC after: 1 week
* Ignore the return value of DE_INTERNALIZE().rpaulo2010-10-131-1/+1
|
* tmpfs + sendfile: do not produce partially valid pages for vnode's tailavg2010-10-121-3/+6
| | | | | | See r213730 for details of analogous change in ZFS. MFC after: 3 days
* Format prototypes to follow style(9) more closely.jh2010-10-122-22/+25
| | | | Discussed with: kib, phk
* Try and make the nfsrv_localunlock() function in the experimentalrmacklem2010-10-111-8/+36
| | | | | | | | | | NFSv4 server more readable. Mostly changes to comments, but a case of >= is changed to >, since == can never happen. Also, I've added a couple of KASSERT()s and a slight optimization, since once the "else if" case happens, subsequent locks in the list can't have any effect. None of these changes fixes any known bug. MFC after: 2 weeks
* The r184588 changed the layout of struct export_args, causing an ABIkib2010-10-108-10/+18
| | | | | | | | | | breakage for old mount(2) syscall, since most struct <filesystem>_args embed export_args. The mount(2) is supposed to provide ABI compatibility for pre-nmount mount(8) binaries, so restore ABI to pre-r184588. Requested and reviewed by: bde MFC after: 2 weeks
* Add a comment describing the reason for calling cache_purge(fvp).kib2010-10-081-0/+7
| | | | | Requested by: danfe MFC after: 6 days
* The msdosfs lookup is case insensitive. Several aliases may be inserted forkib2010-10-071-0/+1
| | | | | | | | | | | a single directory entry. As a consequnce, name cache purge done by lookup for fvp when DELETE op for namei is specified, might be not enough to expunge all namecache entries that were installed for this direntry. Explicitely call cache_purge(fvp) when msdosfs_rename() succeeded. PR: kern/93634 MFC after: 1 week
* M_USE_RESERVE has been deprecated for a decade. Eliminate any uses thatalc2010-10-022-4/+2
| | | | have no run-time effect.
* Add a new function devfs_dev_exists() to be able to find out if ajh2010-09-272-0/+22
| | | | | | | | | specific devfs path already exists. The function will be used from kern_conf.c to detect duplicate device registrations. Callers must hold the devmtx mutex. Reviewed by: kib
* Add reference counting for devfs paths containing user created symbolicjh2010-09-275-2/+199
| | | | | | | | | | | | | | | | links. The reference counting is needed to be able to determine if a specific devfs path exists. For true device file paths we can traverse the cdevp_list but a separate directory list is needed for user created symbolic links. Add a new directory entry flag DE_USER to mark entries which should unreference their parent directory on deletion. A new function to traverse cdevp_list and the directory list will be introduced in a separate commit. Idea from: kib Reviewed by: kib
* Modify devfs_fqpn() for future use in devfs path reference countingjh2010-09-212-14/+23
| | | | | | | | | | | | | code: - Accept devfs_mount and devfs_dirent as the arguments instead of a vnode. This generalizes the function so that it can be used from contexts where vnode references are not available. - Accept NULL cnp argument. No '/' will be appended, if a NULL cnp is provided. - Make the function global and add its prototype to devfs.h. Reviewed by: kib
* Fix nfsrv_freeallnfslocks() in the experimental NFSv4 server so thatrmacklem2010-09-191-4/+7
| | | | | | | | | | | | it frees local locks correctly upon close. In order for nfsrv_localunlock() to work correctly, the lock can no longer be in the lockowner's stateid list. As such, nfsrv_freenfslock() has to be called before nfsrv_localunlock(), to get rid of the lock structure on the lockowner's stateid list. This only affected operation when local locks (vfs.newnfs.enable_locallocks=1) are enabled, which is not the default at this time. MFC after: 1 week
* Fix the experimental NFSv4 server so that it performs local VOP_ADVLOCK()rmacklem2010-09-191-3/+7
| | | | | | | | unlock operations correctly. It was passing in F_SETLK instead of F_UNLCK as the operation for the unlock case. This only affected operation when local locking (vfs.newnfs.enable_locallocks=1) was enabled. MFC after: 1 week
* - For consistency, remove "." and ".." entries from de_dlist beforejh2010-09-181-0/+4
| | | | | | | | | calling devfs_delete() (and thus possibly dropping dm_lock) in devfs_rmdir_empty(). - Assert that we don't return doomed entries from devfs_find(). [1] Suggested by: kib [1] Reviewed by: kib
* Remove empty devfs directories automatically.jh2010-09-153-17/+106
| | | | | | | | | | | | | | | | | | | | devfs_delete() now recursively removes empty parent directories unless the DEVFS_DEL_NORECURSE flag is specified. devfs_delete() can't be called anymore with a parent directory vnode lock held because the possible parent directory deletion needs to lock the vnode. Thus we unlock the parent directory vnode in devfs_remove() before calling devfs_delete(). Call devfs_populate_vp() from devfs_symlink() and devfs_vptocnp() as now directories can get removed. Add a check for DE_DOOMED flag to devfs_populate_vp() because devfs_delete() drops dm_lock before the VI_DOOMED vnode flag gets set. This ensures that devfs_populate_vp() returns an error for directories which are in progress of deletion. Reviewed by: kib Discussed on: freebsd-current (mostly silence)
* tmpfs, zfs + sendfile: mark page bits as valid after populating it with dataavg2010-09-151-0/+2
| | | | | | | | | | | | Otherwise, adding insult to injury, in addition to double-caching of data we would always copy the data into a vnode's vm object page from backend. This is specific to sendfile case only (VOP_READ with UIO_NOCOPY). PR: kern/141305 Reported by: Wiktor Niesiobedzki <bsd@vink.pl> Reviewed by: alc Tested by: tools/regression/sockets/sendfile MFC after: 2 weeks
* This patch applies one of the two fixes suggested byrmacklem2010-09-101-1/+6
| | | | | | | | | | | | zack.kirsch at isilon.com for a race between nfsrv_freeopen() and nfsrv_getlockfile() in the experimental NFS server that he found during testing. Although nfsrv_freeopen() holds a sleep lock on the lock file structure when called with cansleep != 0, nfsrv_getlockfile() could still search the list, once it acquired the NFSLOCKSTATE() mutex. I believe that acquiring the mutex in nfsrv_freeopen() fixes the race. MFC after: 2 weeks
* Fix the NFSVNO_CMPFH() macro in the experimental NFS server sormacklem2010-09-101-2/+1
| | | | | | | | | | | that it works correctly for ZFS file handles. It is possible to have two ZFS file handles that differ only in the bytes in the fid_reserved field of the generic "struct fid" and comparing the bytes in fid_data didn't catch this case. This patch changes the macro to compare all bytes of "struct fid". Tested by: gull at gull.us MFC after: 2 weeks
* Fix the experimental NFS client so that it doesn't panic whenrmacklem2010-09-091-1/+3
| | | | | | | | | | NFSv2,3 byte range locking is attempted. A fix that allows the nlm_advlock() to work with both clients is in progress, but may take a while. As such, I am doing this commit so that the kernel doesn't panic in the meantime. Submitted by: jh MFC after: 2 weeks
* Avoid "Entry can disappear before we lock fdvp" panic.ivoras2010-09-071-3/+7
| | | | | | | PR: 150143 Submitted by: Gleb Kurtsou <gk at FreeBSD.org> Pretty sure it won't blow up: mckusick MFC after: 2 weeks
* Store the full timestamp when caching timestamps of files andjhb2010-09-073-13/+11
| | | | | | | | | | directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. While here, remove the 'n_expiry' field as it is no longer used. Reviewed by: rmacklem MFC after: 1 week
* Allowed unionfs to use whiteout not supporting file system asdaichi2010-09-051-21/+0
| | | | | | | | | | | | | | | | | | | | upper layer. Until now, unionfs prevents to use that kind of file system as upper layer. This time, I changed to allow that kind of file system as upper layer. By this change, you can use whiteout not supporting file system (e.g., especially for tmpfs) as upper layer. It's very useful for combination of tmpfs as upper layer and read only file system as lower layer. By difinition, without whiteout support from the file system backing the upper layer, there is no way that delete and rename operations on lower layer objects can be done. EOPNOTSUPP is returned for this kind of operations as generated by VOP_WHITEOUT() along with any others which would make modifica tions to the lower layer, such as chmod(1). This change is suggested by ed. Submitted by: ed
* Change the code in ncl_bioread() in the experimental NFSrmacklem2010-09-051-4/+1
| | | | | | | | | | client to return an error when rabp is not set, so it behaves the same way as the regular NFS client for this case. It does not affect NFSv4, since nfs_getcacheblk() only fails for "intr" mounts and NFSv4 can't use the "intr" mount option. MFC after: 2 weeks
* Disable use of the NLM in the experimental NFS client, sincermacklem2010-09-051-1/+1
| | | | | | | it will crash the kernel because it uses the nfsmount and nfsnode structures of the regular NFS client. MFC after: 2 weeks
* - Remove duplicate comment.lulf2010-09-011-14/+0
| | | | | PR: kern/148820 Submitted by: pluknet <pluknet - at - gmail.com>
* Add a null_remove() function to nullfs, so that the v_usecountrmacklem2010-08-311-0/+27
| | | | | | | | | | | | | | | | | | | | | of the lower level vnode is incremented to greater than 1 when the upper level vnode's v_usecount is greater than one. This is necessary for the NFS clients, so that they will do a silly rename of the file instead of actually removing it when the file is still in use. It is "racy", since the v_usecount is incremented in many places in the kernel with minimal synchronization, but an extraneous silly rename is preferred to not doing a silly rename when it is required. The only other file systems that currently check the value of v_usecount in their VOP_REMOVE() functions are nwfs and smbfs. These file systems choose to fail a remove when the v_usecount is greater than 1 and I believe will function more correctly with this patch, as well. Tested by: to.my.trociny at gmail.com Submitted by: to.my.trociny at gmail.com (earlier version) Reviewed by: kib MFC after: 2 weeks
* Add acquisition of a reference count on nfsv4root_lock to thermacklem2010-08-281-1/+12
| | | | | | | | nfsd_recalldelegation() function, since this function is called by nfsd threads when they are handling NFSv2 or NFSv3 RPCs, where no reference count would have been acquired. MFC after: 2 weeks
* The timer routine in the experimental NFS server did not acquirermacklem2010-08-284-23/+28
| | | | | | | | | | | | the correct mutex when checking nfsv4root_lock. Although this could be fixed by adding mutex lock/unlock calls, zack.kirsch at isilon.com suggested a better fix that uses a non-blocking acquisition of a reference count on nfsv4root_lock. This fix allows the weird NFSLOCKSTATE(); NFSUNLOCKSTATE(); synchronization to be deleted. This patch applies this fix. Tested by: zack.kirsch at isilon.com MFC after: 2 weeks
* Set de_dir for user created symbolic links. This will be needed to bejh2010-08-261-0/+1
| | | | able to resolve their parent directories.
* Revert r210194, adding a comment explaining why calls to chgproccnt()trasz2010-08-251-0/+6
| | | | | | | in unionfs are actually needed. I have a better fix in trasz_hrl p4 branch, but now is not a good moment to commit it. Reported by: Alex Kozlov
* Call devfs_populate_vp() from devfs_getattr(). It was possible thatjh2010-08-251-1/+9
| | | | fstat(2) returned stale information through an open file descriptor.
* Introduce and use devfs_populate_vp() to unlock a vnode before callingjh2010-08-221-26/+56
| | | | | | | devfs_populate(). This is a prerequisite for the automatic removal of empty directories which will be committed in the future. Reviewed by: kib (previous version)
* Add support for whiteouts on tmpfs.ed2010-08-223-40/+116
| | | | | | | | | | | | | | Right now unionfs only allows filesystems to be mounted on top of another if it supports whiteouts. Even though I have sent a patch to daichi@ to let unionfs work without it, we'd better also add support for whiteouts to tmpfs. This patch implements .vop_whiteout and makes necessary changes to lookup() and readdir() to take them into account. We must also make sure that when adding or removing a file, we honour the componentname's DOWHITEOUT and ISWHITEOUT, to prevent duplicate filenames. MFC after: 1 month
* Add dedicated routines to toggle lockmgr flags such as LK_NOSHARE andjhb2010-08-206-6/+6
| | | | | | | | | | | | LK_CANRECURSE after a lock is created. Use them to implement macros that otherwise manipulated the flags directly. Assert that the associated lockmgr lock is exclusively locked by the current thread when manipulating these flags to ensure the flag updates are safe. This last change required some minor shuffling in a few filesystems to exclusively lock a brand new vnode slightly earlier. Reviewed by: kib MFC after: 3 days
* Call dev_rel() in error paths.jh2010-08-191-0/+3
| | | | | | Reported by: kib Reviewed by: kib MFC after: 2 weeks
* Allow user created symbolic links to cover device files and directoriesjh2010-08-123-15/+56
| | | | | | | | | | | | | | if the device file appears during or after the link creation. User created symbolic links are now inserted at the head of the directory entry list after the "." and ".." entries. A new directory entry flag DE_COVERED indicates that an entry is covered by a symbolic link. PR: kern/114057 Reviewed by: kib Idea from: kib Discussed on: freebsd-current (mostly silence)
* Properly bounds check ioctl/pioctl data arguments for Coda:rwatson2010-08-073-3/+12
| | | | | | | | | | | | | | | | | | | | | | 1. Use unsigned rather than signed lengths 2. Bound messages to/from Venus to VC_MAXMSGSIZE 3. Bound messages to/from general user processes to VC_MAXDATASIZE 4. Update comment regarding data limits for pioctl Without (1) and (3), it may be possible for unprivileged user processes to read sensitive portions of kernel memory. This issue is only present if the Coda kernel module is loaded and venus (the userspace Coda daemon) is running and has /coda mounted. As Coda is considered experimental and production use is warned against in the coda(4) man page, and because Coda must be explicitly configured for a configuration to be vulnerable, we won't be issuing a security advisory. However, if you are using Coda, then you are advised to apply these fixes. Reported by: Dan J. Rosenberg <drosenberg at vsecurity.com> Obtained from: NetBSD (Christos Zoulas) Security: Kernel memory disclosure; no advisory as feature experimental MFC after: 3 days
* Enable shared lookups and externed shared ops for devfs.kib2010-08-061-1/+2
| | | | | In collaboration with: pho MFC after: 1 month
* Add new make_dev_p(9) flag MAKEDEV_ETERNAL to inform devfs that createdkib2010-08-062-30/+34
| | | | | | | | | cdev will never be destroyed. Propagate the flag to devfs vnodes as VV_ETERNVALDEV. Use the flags to avoid acquiring devmtx and taking a thread reference on such nodes. In collaboration with: pho MFC after: 1 month
* Enable shared locks for the devfs vnodes. Honor the locking modekib2010-08-063-17/+20
| | | | | | | requested by lookup(). This should be a nop at the moment. In collaboration with: pho MFC after: 1 month
* Initialize VV_ISTTY vnode flag on the devfs vnode creation instead ofkib2010-08-061-4/+5
| | | | | | | doing it on each open. In collaboration with: pho MFC after: 1 month
* Modify the return value for nfscl_mustflush() from boolean_t,rmacklem2010-08-034-12/+12
| | | | | | | | which I mistakenly thought was correct w.r.t. style(9), back to int and add the checks for != 0. This is just a stylistic modification. MFC after: 1 week
* Move sys/nfsclient/nfs_lock.c into sys/nfs and build it as a separatermacklem2010-07-246-490/+4
| | | | | | | | | | | module that can be used by both the regular and experimental nfs clients. This fixes the problem reported by jh@ where /dev/nfslock would be registered twice when both nfs clients were used. I also defined the size of the lm_fh field to be the correct value, as it should be the maximum size of an NFSv3 file handle. Reviewed by: jh MFC after: 2 weeks
* For the experimental NFSv4 server's dumplocks operation, add thermacklem2010-07-191-1/+2
| | | | | | | | | MPSAFE flag to cn_flags so that it doesn't panic. The panics weren't seen since nfsdumpstate(8) is broken for the "-l" case, so this was never done. I'll do a separate commit to fix nfsdumpstate(8). Submitted by: zack.kirsch at isilon.com MFC after: 2 weeks
* Add a call to nfscl_mustflush() in nfs_close() of the experimentalrmacklem2010-07-181-1/+1
| | | | | | | | NFSv4 client, so that attributes are not acquired from the server when a delegation for the file is held. This can reduce the number of Getattr Ops significantly. MFC after: 2 weeks
OpenPOWER on IntegriCloud