summaryrefslogtreecommitdiffstats
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* - Constify local path variable for chflagsat().pjd2013-03-221-1/+1
| | | | | | - Use correct format characters (%lx) for u_long. This fixes the build broken in r248599.
* - Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of typepjd2013-03-212-3/+4
| | | | | | | | | | | u_long. Before this change it was of type int for syscalls, but prototypes in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not for lchflags(2)) stated that it was u_long. Now some related functions use u_long type for flags (strtofflags(3), fflagstostr(3)). - Make path argument of type 'const char *' for consistency. Discussed on: arch Sponsored by: The FreeBSD Foundation
* Initialize the variable to avoid (false) compiler warning aboutkib2013-03-211-0/+1
| | | | | | | use of an uninitialized local. Reported by: Ivan Klymenko <fidaj@ukr.net> MFC after: 2 weeks
* Do not call vnode_pager_setsize() while a NFS node mutex iskib2013-03-211-1/+9
| | | | | | | | | | | | locked. vnode_pager_setsize() might sleep waiting for the page after EOF be unbusied. Call vnode_pager_setsize() both for the regular and directory vnodes. Reported by: mich Reviewed by: rmacklem Discussed with: avg, jhb MFC after: 2 weeks
* Fix remainder calculation when biosize is not a power of 2emaste2013-03-191-3/+3
| | | | | | | | In common configurations biosize is a power of two, but is not required to be so. Thanks to markj@ for spotting an additional case beyond my original patch. Reviewed by: rmacklem@
* Remove negative name cache entry pointing to the target name, whichkib2013-03-171-0/+1
| | | | | | | | could be instantiated while tdvp was unlocked. Reported by: Rick Miller <vmiller at hostileadmin com> Tested by: pho MFC after: 1 week
* Add currently unused flag argument to the cluster_read(),kib2013-03-145-10/+12
| | | | | | | | cluster_write() and cluster_wbuild() functions. The flags to be allowed are a subset of the GB_* flags for getblk(). Sponsored by: The FreeBSD Foundation Tested by: pho
* Revert 195703 and 195821 as this special stop handling in NFS is nowjhb2013-03-133-14/+7
| | | | | implemented via VFCF_SBDRY rather than passing PBDRY to individual sleep calls.
* Finish r243882: mechanically substitute flags from historic mbufglebius2013-03-121-8/+8
| | | | | | allocator with malloc(9) flags within sys. Sponsored by: Nginx, Inc.
* smbfs_lookup() in the DOTDOT case operates on dvp->n_parent withoutdavide2013-03-092-15/+16
| | | | | | | | | | proper locking. This doesn't prevent in any case reclaim of the vnode. Avoid this not going over-the-wire in this case and relying on subsequent smbfs_getattr() call to restore consistency. While I'm here, change a couple of SMBVDEBUG() in MPASS(). sbmfs_smb_lookup() doesn't and shouldn't know about '.' and '..' Reported by: pho's stress2 suite
* - Initialize variable in smbfs_rename() to silent compiler warningdavide2013-03-091-1/+2
| | | | | | - Fix smbfs_mkdir() return value (in case of error). Reported by: pho
* Garbage collect NWFS and NCP bits which are now completely disconnectedattilio2013-03-0910-3359/+0
| | | | | | from the tree since few months. This patch is not targeted for MFC.
* MFCattilio2013-03-0843-15789/+0
|\
| * Garbage collect NTFS bits which are now completely disconnected fromattilio2013-03-0213-4461/+0
| | | | | | | | | | | | the tree since few months. This patch is not targeted for MFC.
| * Garbage collect PORTALFS bits which are now completely disconnected fromattilio2013-03-023-916/+0
| | | | | | | | | | | | the tree since few months. This patch is not targeted for MFC.
| * Garbage collect CODAFS bits which are now completely disconnected fromattilio2013-03-0218-6056/+0
| | | | | | | | | | | | the tree since few months. This patch is not targeted for MFC.
| * Garbage collect HPFS bits which are now already completely disconnectedattilio2013-03-029-4356/+0
| | | | | | | | | | | | | | | | from the tree since few months (please note that the userland bits were already disconnected since a long time, thus there is no need to update the OLD* entries). This is not targeted for MFC.
* | MFCattilio2013-03-026-10/+9
|\ \ | |/
| * nullfs: Improve f_flags in statfs().jilles2013-03-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include some flags of the nullfs mount itself: MNT_RDONLY, MNT_NOEXEC, MNT_NOSUID, MNT_UNION, MNT_NOSYMFOLLOW. This allows userland code calling statfs() or fstatfs() to see these flags. In particular, this allows opendir() to detect that a -t nullfs -o union mount needs deduplication (otherwise at least . and .. are returned twice) and allows rtld to detect a -t nullfs -o noexec mount as noexec. Turn off the MNT_ROOTFS flag from the underlying filesystem because the nullfs mount is definitely not the root filesystem. Reviewed by: kib MFC after: 1 week
| * Merge Capsicum overhaul:pjd2013-03-025-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Capability is no longer separate descriptor type. Now every descriptor has set of its own capability rights. - The cap_new(2) system call is left, but it is no longer documented and should not be used in new code. - The new syscall cap_rights_limit(2) should be used instead of cap_new(2), which limits capability rights of the given descriptor without creating a new one. - The cap_getrights(2) syscall is renamed to cap_rights_get(2). - If CAP_IOCTL capability right is present we can further reduce allowed ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed ioctls can be retrived with cap_ioctls_get(2) syscall. - If CAP_FCNTL capability right is present we can further reduce fcntls that can be used with the new cap_fcntls_limit(2) syscall and retrive them with cap_fcntls_get(2). - To support ioctl and fcntl white-listing the filedesc structure was heavly modified. - The audit subsystem, kdump and procstat tools were updated to recognize new syscalls. - Capability rights were revised and eventhough I tried hard to provide backward API and ABI compatibility there are some incompatible changes that are described in detail below: CAP_CREATE old behaviour: - Allow for openat(2)+O_CREAT. - Allow for linkat(2). - Allow for symlinkat(2). CAP_CREATE new behaviour: - Allow for openat(2)+O_CREAT. Added CAP_LINKAT: - Allow for linkat(2). ABI: Reuses CAP_RMDIR bit. - Allow to be target for renameat(2). Added CAP_SYMLINKAT: - Allow for symlinkat(2). Removed CAP_DELETE. Old behaviour: - Allow for unlinkat(2) when removing non-directory object. - Allow to be source for renameat(2). Removed CAP_RMDIR. Old behaviour: - Allow for unlinkat(2) when removing directory. Added CAP_RENAMEAT: - Required for source directory for the renameat(2) syscall. Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR): - Allow for unlinkat(2) on any object. - Required if target of renameat(2) exists and will be removed by this call. Removed CAP_MAPEXEC. CAP_MMAP old behaviour: - Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and PROT_WRITE. CAP_MMAP new behaviour: - Allow for mmap(2)+PROT_NONE. Added CAP_MMAP_R: - Allow for mmap(PROT_READ). Added CAP_MMAP_W: - Allow for mmap(PROT_WRITE). Added CAP_MMAP_X: - Allow for mmap(PROT_EXEC). Added CAP_MMAP_RW: - Allow for mmap(PROT_READ | PROT_WRITE). Added CAP_MMAP_RX: - Allow for mmap(PROT_READ | PROT_EXEC). Added CAP_MMAP_WX: - Allow for mmap(PROT_WRITE | PROT_EXEC). Added CAP_MMAP_RWX: - Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC). Renamed CAP_MKDIR to CAP_MKDIRAT. Renamed CAP_MKFIFO to CAP_MKFIFOAT. Renamed CAP_MKNODE to CAP_MKNODEAT. CAP_READ old behaviour: - Allow pread(2). - Disallow read(2), readv(2) (if there is no CAP_SEEK). CAP_READ new behaviour: - Allow read(2), readv(2). - Disallow pread(2) (CAP_SEEK was also required). CAP_WRITE old behaviour: - Allow pwrite(2). - Disallow write(2), writev(2) (if there is no CAP_SEEK). CAP_WRITE new behaviour: - Allow write(2), writev(2). - Disallow pwrite(2) (CAP_SEEK was also required). Added convinient defines: #define CAP_PREAD (CAP_SEEK | CAP_READ) #define CAP_PWRITE (CAP_SEEK | CAP_WRITE) #define CAP_MMAP_R (CAP_MMAP | CAP_SEEK | CAP_READ) #define CAP_MMAP_W (CAP_MMAP | CAP_SEEK | CAP_WRITE) #define CAP_MMAP_X (CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL) #define CAP_MMAP_RW (CAP_MMAP_R | CAP_MMAP_W) #define CAP_MMAP_RX (CAP_MMAP_R | CAP_MMAP_X) #define CAP_MMAP_WX (CAP_MMAP_W | CAP_MMAP_X) #define CAP_MMAP_RWX (CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X) #define CAP_RECV CAP_READ #define CAP_SEND CAP_WRITE #define CAP_SOCK_CLIENT \ (CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \ CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN) #define CAP_SOCK_SERVER \ (CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \ CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \ CAP_SETSOCKOPT | CAP_SHUTDOWN) Added defines for backward API compatibility: #define CAP_MAPEXEC CAP_MMAP_X #define CAP_DELETE CAP_UNLINKAT #define CAP_MKDIR CAP_MKDIRAT #define CAP_RMDIR CAP_UNLINKAT #define CAP_MKFIFO CAP_MKFIFOAT #define CAP_MKNOD CAP_MKNODAT #define CAP_SOCK_ALL (CAP_SOCK_CLIENT | CAP_SOCK_SERVER) Sponsored by: The FreeBSD Foundation Reviewed by: Christoph Mallon <christoph.mallon@gmx.de> Many aspects discussed with: rwatson, benl, jonathan ABI compatibility discussed with: kib
| * Eliminate a duplicate #include.alc2013-02-261-1/+0
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
| * Merge from vmobj-rwlock branch:attilio2013-02-261-2/+0
| | | | | | | | | | | | | | | | Remove unused inclusion of vm/vm_pager.h and vm/vnode_pager.h. Sponsored by: EMC / Isilon storage division Tested by: pho Reviewed by: alc
| * Further refine the handling of stop signals in the NFS client. Thejhb2013-02-212-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in r246417 were incomplete as they did not add explicit calls to sigdeferstop() around all the places that previously passed SBDRY to _sleep(). In addition, nfs_getcacheblk() could trigger a write RPC from getblk() resulting in sigdeferstop() recursing. Rather than manually deferring stop signals in specific places, change the VFS_*() and VOP_*() methods to defer stop signals for filesystems which request this behavior via a new VFCF_SBDRY flag. Note that this has to be a VFC flag rather than a MNTK flag so that it works properly with VFS_MOUNT() when the mount is not yet fully constructed. For now, only the NFS clients are set this new flag in VFS_SET(). A few other related changes: - Add an assertion to ensure that TDF_SBDRY doesn't leak to userland. - When a lookup request uses VOP_READLINK() to follow a symlink, mark the request as being on behalf of the thread performing the lookup (cnp_thread) rather than using a NULL thread pointer. This causes NFS to properly handle signals during this VOP on an interruptible mount. PR: kern/176179 Reported by: Russell Cattelan (sigdeferstop() recursion) Reviewed by: kib MFC after: 1 month
* | MFCattilio2013-02-261-1/+0
| |
* | MFCattilio2013-02-212-3/+1
| |
* | MFCattilio2013-02-211-3/+1
|\ \ | |/
| * The request queue is already locked, so we don't need the splsofclock/splximp2013-02-211-3/+1
| | | | | | | | here to note future work.
* | Rename VM_OBJECT_LOCK(), VM_OBJECT_UNLOCK() and VM_OBJECT_TRYLOCK() toattilio2013-02-209-60/+60
| | | | | | | | | | | | their "write" versions. Sponsored by: EMC / Isilon storage division
* | Switch vm_object lock to be a rwlock.attilio2013-02-206-4/+8
|/ | | | | | | | * VM_OBJECT_LOCK and VM_OBJECT_UNLOCK are mapped to write operations * VM_OBJECT_SLEEP() is introduced as a general purpose primitve to get a sleep operation using a VM_OBJECT_LOCK() as protection * The approach must bear with vm_pager.h namespace pollution so many files require including directly rwlock.h
* Do not update the fsinfo block on each update of any fat block, thiskib2013-02-173-30/+45
| | | | | | | | | | | | | | is excessive. Postpone the flush of the fsinfo to VFS_SYNC(), remembering the need for update with the flag MSDOSFS_FSIMOD, stored in pm_flags. FAT32 specification describes both FSI_Free_Count and FSI_Nxt_Free as the advisory hints, not requiring them to be correct. Based on the patch from bde, modified by me. Reviewed by: bde MFC after: 2 weeks
* Revert r246791 as it needs a security review firstbapt2013-02-141-1/+1
| | | | Reported by: gavin, rwatson
* Allow fdescfs to be mounted from inside a jailbapt2013-02-141-1/+1
| | | | MFC after: 1 week
* ext2fs: Use prototype declarations for function definitionspfg2013-02-108-304/+65
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* Remove a racy checks on resident and cached pages forattilio2013-02-101-12/+0
| | | | | | | | | | | | | | | | tmpfs_mapped{read, write}() functions: - tmpfs_mapped{read, write}() are only called within VOP_{READ, WRITE}(), which check before-hand to work only on valid VREG vnodes. Also the vnode is locked for the duration of the work, making vnode reclaiming impossible, during the operation. Hence, vobj can never be NULL. - Currently check on resident pages and cached pages without vm object lock held is racy and can do even more harm than good, as a page could be transitioning between these 2 pools and then be skipped entirely. Skip the checks as lookups on empty splay trees are very cheap. Discussed with: alc Tested by: flo MFC after: 2 weeks
* ext2fs: Replace redundant EXT2_MIN_BLOCK with EXT2_MIN_BLOCK_SIZE.pfg2013-02-082-2/+1
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: make e2fs_maxcontig local and remove tautological check.pfg2013-02-082-7/+3
| | | | | | | | | | | | | | | e2fs_maxcontig was modelled after UFS when bringing the "Orlov allocator" to ext2. On UFS fs_maxcontig is kept in the superblock and is used by userland tools (fsck and growfs), In ext2 this information is volatile so it is not available for userland tools, so in this case it doesn't have sense to carry it in the in-memory superblock. Also remove a pointless check for MAX(1, x) > 0. Submitted by: Christoph Mallon MFC after: 2 weeks
* Remove unused MAXSYMLINKLEN macro.pfg2013-02-081-1/+0
| | | | | | Reviewed by: mckusick PR: kern/175794 MFC after: 1 week
* Stop translating the ERESTART error from the open(2) into EINTR.kib2013-02-071-1/+4
| | | | | | | | | | | | Posix requires that open(2) is restartable for SA_RESTART. For non-posix objects, in particular, devfs nodes, still disable automatic restart of the opens. The open call to a driver could have significant side effects for the hardware. Noted and reviewed by: jilles Discussed with: bde MFC after: 2 weeks
* Rework the handling of stop signals in the NFS client. The changes injhb2013-02-061-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 195702, 195703, and 195821 prevented a thread from suspending while holding locks inside of NFS by forcing the thread to fail sleeps with EINTR or ERESTART but defer the thread suspension to the user boundary. However, this had the effect that stopping a process during an NFS request could abort the request and trigger EINTR errors that were visible to userland processes (previously the thread would have suspended and completed the request once it was resumed). This change instead effectively masks stop signals while in the NFS client. It uses the existing TDF_SBDRY flag to effect this since SIGSTOP cannot be masked directly. Also, instead of setting PBDRY on individual sleeps, the NFS client now sets the TDF_SBDRY flag around each NFS request and stop signals are masked for all sleeps during that region (the previous change missed sleeps in lockmgr locks). The end result is that stop signals sent to threads performing an NFS request are completely ignored until after the NFS request has finished processing and the thread prepares to return to userland. This restores the behavior of stop signals being transparent to userland processes while still preventing threads from suspending while holding NFS locks. Reviewed by: kib MFC after: 1 month
* ext2fs: move assignment where it is not dead.pfg2013-02-051-2/+3
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: Remove unused em_e2fsb definition..pfg2013-02-051-1/+0
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: Remove useless rootino local variable.pfg2013-02-051-4/+3
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: Correct off-by-one errors in FFTODT() and DDTOFT().pfg2013-02-051-2/+2
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: Use nitems().pfg2013-02-051-6/+4
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: Use EXT2_LINK_MAX instead of LINK_MAXpfg2013-02-051-5/+5
| | | | | Submitted by: Christoph Mallon MFC after: 2 weeks
* ext2fs: general cleanup.pfg2013-02-027-61/+17
| | | | | | | | | | | | | | | | | | | | | | - Remove unused extern declarations in fs.h - Correct comments in ext2_dir.h - Several panic() messages showed wrong function names. - Remove commented out stray line in ext2_alloc.c. - Remove the unused macro EXT2_BLOCK_SIZE_BITS() and the then write-only member e2fs_blocksize_bits from struct m_ext2fs. - Remove the unused macro EXT2_FIRST_INO() and the then write-only member e2fs_first_inode from struct m_ext2fs. - Remove EXT2_DESC_PER_BLOCK() and the member e2fs_descpb from struct m_ext2fs. - Remove the unused members e2fs_bmask, e2fs_dbpg and e2fs_mount_opt from struct m_ext2fs - Correct harmless off-by-one error for fspath in ext2_vfsops.c. - Remove the unused and broken macros EXT2_ADDR_PER_BLOCK_BITS() and EXT2_DESC_PER_BLOCK_BITS(). - Remove the !_KERNEL versions of the EXT2_* macros. Submitted by: Christoph Mallon MFC after: 2 weeks
* The MSDOSFSMNT_WAITONFAT flag is bogus and broken. It does less thankib2013-02-011-2/+2
| | | | | | | | | | track the MNT_SYNCHRONOUS flag. It is set to the latter at mount time but not updated by MNT_UPDATE. Use MNT_SYNCHRONOUS to decide to write the FAT updates syncrhonously. Submitted by: bde MFC after: 1 week
* Backup FATs were sometimes marked dirty by copying their first blockkib2013-02-011-1/+12
| | | | | | | | from the primary FAT, and then they were not marked clean on unmount. Force marking them clean when appropriate. Submitted by: bde MFC after: 1 week
* The directory entry for dotdot was corrupted in the FAT32 case when movingkib2013-02-011-5/+13
| | | | | | | | | | | | | | | | | | | | | | a directory to a subdir of the root directory from somewhere else. For all directory moves that change the parent directory, the dotdot entry must be fixed up. For msdosfs, the root directory is magic for non-FAT32. It is less magic for FAT32, but needs the same magic for the dotdot fixup. It didn't have it. Both chkdsk and fsck_msdosfs fix the corrupt directory entries with no problems. The fix is to use the same magic for dotdot in msdosfs_rename() as in msdosfs_mkdir(). For msdosfs_mkdir(), document the magic. When writing the dotdot entry in mkdir, use explicitly set pcl variable instead on relying on the start cluster of the root directory typically has a value < 65536. Submitted by: bde MFC after: 1 week
* The mountmsdosfs() function had an insane sanity test, remove it.kib2013-02-011-2/+1
| | | | | | | | | | | | | | | | Trying FAT32 on a small partition failed to mount because pmp->pm_Sectors was nonzero. Normally, FAT32 file systems are so large that the 16-bit pm_Sectors can't hold the size. This is indicated by setting it to 0 and using only pm_HugeSectors. But at least old versions of newfs_msdos use the 16-bit field if possible, and msdosfs supports this except for breaking its own support in the sanity check. This is quite different from the handling of pm_FATsecs -- now the 16-bit value is always ignored for FAT32 except for checking that it is 0, and newfs_msdos doesn't use the 16-bit value for FAT32. Submitted by: bde MFC after: 1 week
OpenPOWER on IntegriCloud