aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of uiomove(9) errors for the NFS client.Konstantin Belousov2012-06-061-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | Do not brelse() the buffer unconditionally with BIO_ERROR set if uiomove() failed. The brelse() treats most buffers with BIO_ERROR as B_INVAL, dropping their content. Instead, if the write request covered the whole buffer, remember the cached state and brelse() with BIO_ERROR set only if the buffer was not cached previously. Update the buffer dirtyoff/dirtyend based on the progress recorded by uiomove() in passed struct uio, even in the presence of error. Otherwise, usermode could see changed data in the backed pages, but later the buffer is destroyed without write-back. If uiomove() failed for IO_UNIT request, try to truncate the vnode back to the pre-write state, and rewind the progress in passed uio accordingly, following the FFS behaviour. Reviewed by: rmacklem (some time ago) Tested by: pho MFC after: 1 month Notes: svn path=/head/; revision=236687
* Capitalize start of sentence.Konstantin Belousov2012-05-301-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=236313
* Catch a corner case where ssegs could be 0 and thus i would be 0 andMarcel Moolenaar2012-05-281-8/+7
| | | | | | | | | we index suinfo out of bounds (i.e. -1). Approved by: gber Notes: svn path=/head/; revision=236188
* Fix style and consistency:Ed Schouten2012-05-271-158/+158
| | | | | | | | | | - Use tabs, not spaces. - Add tab after #define. - Don't mix the use of BSD and ISO C unsigned integer types. Prefer the ISO C ones. Notes: svn path=/head/; revision=236140
* Use C99-style initialization for struct dirent in preparation forGleb Kurtsou2012-05-252-8/+29
| | | | | | | | | changing the structure. Sponsored by: Google Summer of Code 2011 Notes: svn path=/head/; revision=235984
* Revert devfs part of r235911. I was unaware about old but unfinishedAlexander Motin2012-05-241-45/+0
| | | | | | | discussion between kib@ and gibbs@ about it. Notes: svn path=/head/; revision=235922
* MFprojects/zfsd:Alexander Motin2012-05-241-0/+45
| | | | | | | | | | | | | | Revamp the CAM enclosure services driver. This updated driver uses an in-kernel daemon to track state changes and publishes physical path location information\for disk elements into the CAM device database. Sponsored by: Spectra Logic Corporation Sponsored by: iXsystems, Inc. Submitted by: gibbs, will, mav Notes: svn path=/head/; revision=235911
* A problem with the NFSv4 server was reported by Andrew LeonardRick Macklem2012-05-171-3/+1
| | | | | | | | | | | | | | | to freebsd-fs@, where the setfacl of an NFSv4 acl would fail. This was caused by the VOP_ACLCHECK() call for ZFS replying EOPNOTSUPP. After discussion with rwatson@, it was determined that a call to VOP_ACLCHECK() before doing VOP_SETACL() is not required. This patch fixes the problem by deleting the VOP_ACLCHECK() call. Tested by: Andrew Leonard (previous version) MFC after: 1 week Notes: svn path=/head/; revision=235568
* Import work done under project/nand (@235533) into head.Grzegorz Bernacki2012-05-1719-0/+11832
| | | | | | | | | | | | | | | | | The NAND Flash environment consists of several distinct components: - NAND framework (drivers harness for NAND controllers and NAND chips) - NAND simulator (NANDsim) - NAND file system (NAND FS) - Companion tools and utilities - Documentation (manual pages) This work is still experimental. Please use with caution. Obtained from: Semihalf Supported by: FreeBSD Foundation, Juniper Networks Notes: svn path=/head/; revision=235537
* Fix a couple of issues that appear to be inherited from the oldPedro F. Giffuni2012-05-162-12/+52
| | | | | | | | | | | | | | | | | | 8.x code: - If the lock cannot be acquired immediately unlocks 'bar' vnode and then locks both vnodes in order. - wrong vnode type panics from cache_enter_time after calls by ext2_lookup. The fix merges the fixes from ufs/ufs_lookup.c. Submitted by: Mateusz Guzik Approved by: jhb@ (mentor) Reviewed by: kib@ MFC after: 1 week Notes: svn path=/head/; revision=235508
* Skip directory entries with zero inode number during traversal.Gleb Kurtsou2012-05-161-1/+1
| | | | | | | | | | | Entries with zero inode number are considered placeholders by libc and UFS. Fix remaining uses of VOP_READDIR in kernel: vop_stdvptocnp, unionfs. Sponsored by: Google Summer of Code 2011 Notes: svn path=/head/; revision=235503
* Fix two cases in the new NFS server where a tsleep() isRick Macklem2012-05-121-6/+9
| | | | | | | | | | | | | | | | used, when the code should actually protect the tested variable with a mutex. Since the tsleep()s had a 10sec timeout, the race would have only delayed the allocation of a new clientid for a client. The sleeps will also rarely occur, since having a callback in progress when a client acquires a new clientid, is unlikely. in practice, since having a callback in progress when a fresh clientid is being acquired by a client is unlikely. MFC after: 1 month Notes: svn path=/head/; revision=235381
* PR# 165923 reported intermittent write failures for dirtyRick Macklem2012-05-124-1/+25
| | | | | | | | | | | | | | | | | | | | | | memory mapped pages being written back on an NFS mount. Since any thread can call VOP_PUTPAGES() to write back a dirty page, the credentials of that thread may not have write access to the file on an NFS server. (Often the uid is 0, which may be mapped to "nobody" in the NFS server.) Although there is no completely correct fix for this (NFS servers check access on every write RPC instead of at open/mmap time), this patch avoids the common cases by holding onto a credential that recently opened the file for writing and uses that credential for the write RPCs being done by VOP_PUTPAGES() for both NFS clients. Tested by: Joel Ray Holveck (joelh at juniper.net) PR: kern/165923 Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=235332
* Fix mount interlock oversights from the previous change in r234386.Sergey Kandaurov2012-05-101-2/+0
| | | | | | | | | | Reported by: dougb Submitted by: Mateusz Guzik <mjguzik at gmail com> Reviewed by: Kirk McKusick Tested by: pho Notes: svn path=/head/; revision=235241
* Use the common api helper routine instead of freeing the nameiJohn W. De Boskey2012-05-081-2/+1
| | | | | | | | | | buffer directly. Approved by: rmacklem (mentor) MFC after: 1 month Notes: svn path=/head/; revision=235136
* fixed a unionfs_readdir math issueDaichi GOTO2012-05-031-1/+1
| | | | | | | | PR: 132987 Submitted by: Matthew Fleming <mfleming@isilon.com> Notes: svn path=/head/; revision=234944
* - fixed a vnode lock hang-up issue.Daichi GOTO2012-05-013-115/+213
| | | | | | | | | | | | | | - fixed an incorrect lock status issue. - fixed an incorrect lock issue of unionfs root vnode removed. (pointed out by keith) - fixed an infinity loop issue. (pointed out by dumbbell) - changed to do LK_RELEASE expressly when unlocked. Submitted by: ozawa@ongs.co.jp Notes: svn path=/head/; revision=234867
* It was reported via email that some non-FreeBSD NFS serversRick Macklem2012-04-271-1/+4
| | | | | | | | | | | | | | | do not include file attributes in the reply to an NFS create RPC under certain circumstances. This resulted in a vnode of type VNON that was not usable. This patch adds an NFS getattr RPC to nfs_create() for this case, to fix the problem. It was tested by the person that reported the problem and confirmed to fix this case for their server. Tested by: Steven Haber (steven.haber at isilon.com) MFC after: 2 weeks Notes: svn path=/head/; revision=234742
* Fix a leak of namei lookup path buffers that occurs when aRick Macklem2012-04-271-0/+4
| | | | | | | | | | | | | | ZFS volume is exported via the new NFS server. The leak occurred because the new NFS server code didn't handle the case where a file system sets the SAVENAME flag in its VOP_LOOKUP() and ZFS does this for the DELETE case. Tested by: Oliver Brandmueller (ob at gruft.de), hrs PR: kern/167266 MFC after: 1 month Notes: svn path=/head/; revision=234740
* Remove unused thread argument to vrecycle().Edward Tomasz Napierala2012-04-238-12/+8
| | | | | | | Reviewed by: kib Notes: svn path=/head/; revision=234607
* Remove unused thread argument from vtruncbuf().Edward Tomasz Napierala2012-04-237-15/+13
| | | | | | | Reviewed by: kib Notes: svn path=/head/; revision=234605
* This change creates a new list of active vnodes associated withKirk McKusick2012-04-202-1/+3
| | | | | | | | | | | | | | | | | | | | | | | a mount point. Active vnodes are those with a non-zero use or hold count, e.g., those vnodes that are not on the free list. Note that this list is in addition to the list of all the vnodes associated with a mount point. To avoid adding another set of linkage pointers to the vnode structure, the active list uses the existing linkage pointers used by the free list (previously named v_freelist, now renamed v_actfreelist). This update adds the MNT_VNODE_FOREACH_ACTIVE interface that loops over just the active vnodes associated with a mount point (typically less than 1% of the vnodes associated with the mount point). Reviewed by: kib Tested by: Peter Holm MFC after: 2 weeks Notes: svn path=/head/; revision=234482
* Return EOPNOTSUPP rather than EPERM for the SF_SNAPSHOT flag becauseJaakko Heinonen2012-04-181-4/+1
| | | | | | | | | tmpfs doesn't support snapshots. Suggested by: bde Notes: svn path=/head/; revision=234422
* Replace the MNT_VNODE_FOREACH interface with MNT_VNODE_FOREACH_ALL.Kirk McKusick2012-04-175-56/+13
| | | | | | | | | | | | | | | | | | | | | | | | The primary changes are that the user of the interface no longer needs to manage the mount-mutex locking and that the vnode that is returned has its mutex locked (thus avoiding the need to check to see if its is DOOMED or other possible end of life senarios). To minimize compatibility issues for third-party developers, the old MNT_VNODE_FOREACH interface will remain available so that this change can be MFC'ed to 9. Following the MFC to 9, MNT_VNODE_FOREACH will be removed in head. The reason for this update is to prepare for the addition of the MNT_VNODE_FOREACH_ACTIVE interface that will loop over just the active vnodes associated with a mount point (typically less than 1% of the vnodes associated with the mount point). Reviewed by: kib Tested by: Peter Holm MFC after: 2 weeks Notes: svn path=/head/; revision=234386
* Sync tmpfs_chflags() with the recent changes to UFS:Jaakko Heinonen2012-04-161-13/+13
| | | | | | | | | - Add a check for unsupported file flags. - Return EPERM when an user without PRIV_VFS_SYSFLAGS privilege attempts to toggle SF_SETTABLE flags. Notes: svn path=/head/; revision=234347
* tmpfs: Allow update mounts only for certain options.Jaakko Heinonen2012-04-162-6/+15
| | | | | | | | | | | Since r230208 update mounts were allowed if the list of mount options contained the "export" option. This is not correct as tmpfs doesn't really support updating all options. Reviewed by: kevlo, trociny Notes: svn path=/head/; revision=234346
* Provide better description for vfs.tmpfs.memory_reserved sysctl.Gleb Kurtsou2012-04-151-1/+2
| | | | | | | Suggested by: Anton Yuzhaninov <citrin@citrin.ru> Notes: svn path=/head/; revision=234325
* Apply changes from r234103 to ext2fs:Jaakko Heinonen2012-04-131-8/+4
| | | | | | | | | | | | | | | Return EPERM from ext2_setattr() when an user without PRIV_VFS_SYSFLAGS privilege attempts to toggle SF_SETTABLE flags. Flags are now stored to ip->i_flags in one place after all checks. Also, remove SF_NOUNLINK from the checks because ext2fs doesn't support that flag. Reviewed by: bde Notes: svn path=/head/; revision=234203
* Restore the blank line incorrectly removed in r234104.Jaakko Heinonen2012-04-111-0/+1
| | | | | | | Pointed out by: bde Notes: svn path=/head/; revision=234139
* Apply changes from r233787 to ext2fs:Jaakko Heinonen2012-04-101-6/+5
| | | | | | | | | | | | | - Use more natural ip->i_flags instead of vap->va_flags in the final flags check. - Style improvements. No functional change intended. MFC after: 2 weeks Notes: svn path=/head/; revision=234104
* - Introduce a cache-miss optimization for consistency with otherAttilio Rao2012-04-091-1/+1
| | | | | | | | | | | | accesses of the cache member of vm_object objects. - Use novel vm_page_is_cached() for checks outside of the vm subsystem. Reviewed by: alc MFC after: 2 weeks X-MFC: r234039 Notes: svn path=/head/; revision=234064
* Add I/O accounting to msdos filesystem.Kirk McKusick2012-04-081-0/+4
| | | | | | | Suggested and reviewed by: kib Notes: svn path=/head/; revision=234025
* tmpfs supports only INT_MAX nodes due to limitations of unit numberGleb Kurtsou2012-04-071-3/+7
| | | | | | | | | | | | | | allocator. Replace UINT32_MAX checks with INT_MAX. Keeping more than 2^31 nodes in memory is not likely to become possible in foreseeable feature and would require new unit number allocator. Discussed with: delphij MFC after: 2 weeks Notes: svn path=/head/; revision=234000
* Add vfs_getopt_size. Support human readable file system options in tmpfs.Gleb Kurtsou2012-04-071-16/+13
| | | | | | | | | | Increase maximum tmpfs file system size to 4GB*PAGE_SIZE on 32 bit archs. Discussed with: delphij MFC after: 2 weeks Notes: svn path=/head/; revision=233999
* Add reserved memory limit sysctl to tmpfs.Gleb Kurtsou2012-04-073-61/+91
| | | | | | | | | | Cleanup availble and used memory functions. Check if free pages available before allocating new node. Discussed with: delphij Notes: svn path=/head/; revision=233998
* Add sysctl vfs.nfs.nfs_keep_dirty_on_error to switch the nfs clientKonstantin Belousov2012-03-172-3/+10
| | | | | | | | | | | | behaviour on error from write RPC back to behaviour of old nfs client. When set to not zero, the pages for which write failed are kept dirty. PR: kern/165927 Reviewed by: alc MFC after: 2 weeks Notes: svn path=/head/; revision=233101
* Prevent tmpfs_rename() deadlock in a way similar to UFSGleb Kurtsou2012-03-142-7/+179
| | | | | | | | | Unlock vnodes and try to lock them one by one. Relookup fvp and tvp. Approved by: mdf (mentor) Notes: svn path=/head/; revision=232960
* Don't enforce LK_RETRY to get existing vnode in tmpfs_alloc_vp()Gleb Kurtsou2012-03-141-7/+11
| | | | | | | | | | | | Doomed vnode is hardly of any use here, besides all callers handle error case. vfs_hash_get() does the same. Don't mess with vnode holdcount, vget() takes care of it already. Approved by: mdf (mentor) Notes: svn path=/head/; revision=232959
* Use NULL instead of 0Kevin Lo2012-03-134-7/+7
| | | | Notes: svn path=/head/; revision=232918
* Update comment.Konstantin Belousov2012-03-111-1/+1
| | | | | | | Submitted by: gianni Notes: svn path=/head/; revision=232823
* Remove fifo.h. The only used function declaration from the header isKonstantin Belousov2012-03-117-45/+0
| | | | | | | | | migrated to sys/vnode.h. Submitted by: gianni Notes: svn path=/head/; revision=232821
* Add support for ns timestamps and birthtime to the ext2/3 driver.Pedro F. Giffuni2012-03-087-23/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using big inodes there is sufficient space in ext3 to keep extra resolution and birthtime (creation) timestamps. The appropriate fields in the on-disk inode have been approved for a long time but support for this in ext3 has not been widely distributed. In preparation for ext4 most linux distributions have enabled by default such bigger inodes and some people use nanosecond timestamps in ext3. We now support those when the inode is big enough and while we do recognize the EXT4F_ROCOMPAT_EXTRA_ISIZE, we maintain the extra timestamps even when they are not used. An additional note by Bruce Evans: We blindly accept unrepresentable tv_nsec in VOP_SETATTR(), but all file systems have always done that. When POSIX gets around to specifying the behaviour, it will probably require certain rounding to the fs's resolution and not rejecting the request. This unfortunately means that syscalls that set times can't really tell if they succeeded without reading back the times using stat() or similar and checking that they were set close enough. Reviewed by: bde Approved by: jhb (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=232703
* Add KTR_VFS traces to track modifications to a vnode's writecount.John Baldwin2012-03-081-0/+4
| | | | Notes: svn path=/head/; revision=232701
* The pipe_poll() performs lockless access to the vnode to testKonstantin Belousov2012-03-072-14/+12
| | | | | | | | | | | | | | | fifo_iseof() condition, allowing the v_fifoinfo to be reset and freed by fifo_cleanup(). Precalculate EOF at the places were fo_wgen is changed, and cache the state in a new pipe state flag PIPE_SAMEWGEN. Reported and tested by: bf Submitted by: gianni MFC after: 1 week (a backport) Notes: svn path=/head/; revision=232641
* Apply inlined vn_vget_ino() algorithm for ".." lookup in pseudofs.Konstantin Belousov2012-03-051-5/+32
| | | | | | | | Reported and tested by: pho MFC after: 2 weeks Notes: svn path=/head/; revision=232541
* Remove unneeded cast to u_int. The values as small enough to fit intoKonstantin Belousov2012-03-041-2/+1
| | | | | | | | | | int, beside the use of MIN macro which performs type promotions. Submitted by: bde MFC after: 3 weeks Notes: svn path=/head/; revision=232493
* Remove unnecessary castsKevin Lo2012-03-041-2/+2
| | | | Notes: svn path=/head/; revision=232485
* Clean up style(9) nitsKevin Lo2012-03-043-10/+10
| | | | Notes: svn path=/head/; revision=232483
* The name caching changes of r230394 exposed an intermittent bugRick Macklem2012-03-031-0/+1
| | | | | | | | | | | | | | | in the new NFS server for NFSv4, where it would report ENOENT when the file actually existed on the server. This turned out to be caused by not initializing ni_topdir before calling lookup() and there was a rare case where the value on the stack location assigned to ni_topdir happened to be a pointer to a ".." entry, such that "dp == ndp->ni_topdir" succeeded in lookup(). This patch initializes ni_topdir to fix the problem. MFC after: 5 days Notes: svn path=/head/; revision=232467
* Post r230394, the Lookup RPC counts for both NFS clients increasedRick Macklem2012-03-032-22/+34
| | | | | | | | | | | | | | | | | | | | | | | | significantly. Upon investigation this was caused by name cache misses for lookups of "..". For name cache entries for non-".." directories, the cache entry serves double duty. It maps both the named directory plus ".." for the parent of the directory. As such, two ctime values (one for each of the directory and its parent) need to be saved in the name cache entry. This patch adds an entry for ctime of the parent directory to the name cache. It also adds an additional uma zone for large entries with this time value, in order to minimize memory wastage. As well, it fixes a couple of cases where the mtime of the parent directory was being saved instead of ctime for positive name cache entries. With this patch, Lookup RPC counts return to values similar to pre-r230394 kernels. Reported by: bde Discussed with: kib Reviewed by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=232420