summaryrefslogtreecommitdiff
path: root/sys/fs/fuse
Commit message (Collapse)AuthorAgeFilesLines
* If a local (AF_LOCAL, AF_UNIX) socket creation (bind) is attemptedRick Macklem2016-05-181-3/+4
| | | | | | | | | | | | | | | on a fuse mounted file system, it will crash. Although it may be possible to make this work correctly, this patch avoids the crash in the meantime. I removed the MPASS(), since panicing for the FIFO case didn't make a lot of sense when it returns an error for the others. PR: 195000 Submitted by: henry.hu.sh@gmail.com (earlier version) MFC after: 2 weeks Notes: svn path=/head/; revision=300169
* Fix fuse for "cp" of a mode 0444 file to the file system.Rick Macklem2016-05-153-1/+24
| | | | | | | | | | | | | | | | | | When "cp" of a file with read-only (mode 0444) to a fuse mounted file system was attempted it would fail with EACCES. This was because fuse would attempt to open the file WRONLY and the open would fail. This patch changes the fuse_vnop_open() to test for an extant read-write open and use that, if it is available. This makes the "cp" of a read-only file to the fuse mounted file system work ok. There are simpler ways to fix this than adding the fuse_filehandle_validrw() function, but this function is useful for future patches related to exporting a fuse filesystem via NFS. MFC after: 2 weeks Notes: svn path=/head/; revision=299872
* Fix fuse so that stale buffer cache data isn't read.Rick Macklem2016-05-151-0/+2
| | | | | | | | | | | | | When I/O on a file under fuse is switched from buffered to DIRECT_IO, it was possible to read stale (before a recent modification) data from the buffer cache. This patch invalidates the buffer cache for the file to fix this. PR: 194293 MFC after: 2 weeks Notes: svn path=/head/; revision=299816
* Fix fuse to use DIRECT_IO when required.Rick Macklem2016-05-142-2/+23
| | | | | | | | | | | | | | | | | When a file is opened write-only and a partial block was written, buffered I/O would try and read the whole block in. This would result in a hung thread, since there was no open (fuse filehandle) that allowed reading. This patch avoids the problem by forcing DIRECT_IO for this case. It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO flag in its reply to the open. Tested by: nishida@asusa.net, freebsd@moosefs.com PR: 194293, 206238 MFC after: 2 weeks Notes: svn path=/head/; revision=299753
* sys/fs: spelling fixes in comments.Pedro F. Giffuni2016-04-292-6/+6
| | | | | | | No functional change. Notes: svn path=/head/; revision=298806
* Fix breakage caused by r292373 in ZFS/FUSE/NFS/SMBFS.Gleb Smirnoff2015-12-161-14/+10
| | | | | | | | | | | | | With the new VOP_GETPAGES() KPI the "count" argument counts pages already, and doesn't need to be translated from bytes to pages. While here make it consistent that *rbehind and *rahead are updated only if we doesn't return error. Pointy hat to: glebius Notes: svn path=/head/; revision=292386
* A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES().Gleb Smirnoff2015-12-161-30/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o With new KPI consumers can request contiguous ranges of pages, and unlike before, all pages will be kept busied on return, like it was done before with the 'reqpage' only. Now the reqpage goes away. With new interface it is easier to implement code protected from race conditions. Such arrayed requests for now should be preceeded by a call to vm_pager_haspage() to make sure that request is possible. This could be improved later, making vm_pager_haspage() obsolete. Strenghtening the promises on the business of the array of pages allows us to remove such hacks as swp_pager_free_nrpage() and vm_pager_free_nonreq(). o New KPI accepts two integer pointers that may optionally point at values for read ahead and read behind, that a pager may do, if it can. These pages are completely owned by pager, and not controlled by the caller. This shifts the UFS-specific readahead logic from vm_fault.c, which should be file system agnostic, into vnode_pager.c. It also removes one VOP_BMAP() request per hard fault. Discussed with: kib, alc, jeff, scottl Sponsored by: Nginx, Inc. Sponsored by: Netflix Notes: svn path=/head/; revision=292373
* File systems that do not use the buffer cache (such as ZFS) mustRick Macklem2015-04-151-0/+1
| | | | | | | | | | | | | | | | use VOP_FSYNC() to perform the NFS server's Commit operation. This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which is set by file systems that use the buffer cache. If this flag is not set, the NFS server always does a VOP_FSYNC(). This should be ok for old file system modules that do not set MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although it might not be optimal for file systems that use the buffer cache. Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=281562
* Fix white spaces.Jung-uk Kim2015-03-021-18/+18
| | | | Notes: svn path=/head/; revision=279537
* Make fuse(4) respect FOPEN_DIRECT_IO. This is required for correctEdward Tomasz Napierala2015-03-023-1/+29
| | | | | | | | | | | | | operation of GlusterFS. PR: 192701 Submitted by: harsha at harshavardhana.net Reviewed by: kib@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=279536
* The VOP_LOOKUP() implementations for CREATE op do not put the nameKonstantin Belousov2014-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | into namecache, to avoid cache trashing when doing large operations. E.g., tar archive extraction is not usually followed by access to many of the files created. Right now, each VOP_LOOKUP() implementation explicitely knowns about this quirk and tests for both MAKEENTRY flag presence and op != CREATE to make the call to cache_enter(). Centralize the handling of the quirk into VFS, by deciding to cache only by MAKEENTRY flag in VOP. VFS now sets NOCACHE flag for CREATE namei() calls. Note that the change in semantic is backward-compatible and could be merged to the stable branch, and is compatible with non-changed third-party filesystems which correctly handle MAKEENTRY. Suggested by: Chris Torek <torek@pi-coral.com> Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=275897
* Fix multiple incorrect SYSCTL arguments in the kernel:Hans Petter Selasky2014-10-212-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=273377
* Remove unused arguments for VOP_GETPAGES(), VOP_PUTPAGES().Gleb Smirnoff2014-09-101-1/+0
| | | | Notes: svn path=/head/; revision=271387
* Update kernel inclusions of capability.h to use capsicum.h instead; someRobert Watson2014-03-161-1/+1
| | | | | | | | | | | further refinement is required as some device drivers intended to be portable over FreeBSD versions rely on __FreeBSD_version to decide whether to include capability.h. MFC after: 3 weeks Notes: svn path=/head/; revision=263233
* Change the cap_rights_t type from uint64_t to a structure that we can extendPawel Jakub Dawidek2013-09-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the future in a backward compatible (API and ABI) way. The cap_rights_t represents capability rights. We used to use one bit to represent one right, but we are running out of spare bits. Currently the new structure provides place for 114 rights (so 50 more than the previous cap_rights_t), but it is possible to grow the structure to hold at least 285 rights, although we can make it even larger if 285 rights won't be enough. The structure definition looks like this: struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; }; The initial CAP_RIGHTS_VERSION is 0. The top two bits in the first element of the cr_rights[] array contain total number of elements in the array - 2. This means if those two bits are equal to 0, we have 2 array elements. The top two bits in all remaining array elements should be 0. The next five bits in all array elements contain array index. Only one bit is used and bit position in this five-bits range defines array index. This means there can be at most five array elements in the future. To define new right the CAPRIGHT() macro must be used. The macro takes two arguments - an array index and a bit to set, eg. #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL) We still support aliases that combine few rights, but the rights have to belong to the same array element, eg: #define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL) #define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP) There is new API to manage the new cap_rights_t structure: cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); Capability rights to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions are provided by separating them with commas, eg: cap_rights_t rights; cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT); There is no need to terminate the list of rights, as those functions are actually macros that take care of the termination, eg: #define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...); Thanks to using one bit as an array index we can assert in those functions that there are no two rights belonging to different array elements provided together. For example this is illegal and will be detected, because CAP_LOOKUP belongs to element 0 and CAP_PDKILL to element 1: cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL); Providing several rights that belongs to the same array's element this way is correct, but is not advised. It should only be used for aliases definition. This commit also breaks compatibility with some existing Capsicum system calls, but I see no other way to do that. This should be fine as Capsicum is still experimental and this change is not going to 9.x. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=255219
* The soft and hard busy mechanism rely on the vm object lock to work.Attilio Rao2013-08-091-30/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify the 2 concept into a real, minimal, sxlock where the shared acquisition represent the soft busy and the exclusive acquisition represent the hard busy. The old VPO_WANTED mechanism becames the hard-path for this new lock and it becomes per-page rather than per-object. The vm_object lock becames an interlock for this functionality: it can be held in both read or write mode. However, if the vm_object lock is held in read mode while acquiring or releasing the busy state, the thread owner cannot make any assumption on the busy state unless it is also busying it. Also: - Add a new flag to directly shared busy pages while vm_page_alloc and vm_page_grab are being executed. This will be very helpful once these functions happen under a read object lock. - Move the swapping sleep into its own per-object flag The KPI is heavilly changed this is why the version is bumped. It is very likely that some VM ports users will need to change their own code. Sponsored by: EMC / Isilon storage division Discussed with: alc Reviewed by: jeff, kib Tested by: gavin, bapt (older version) Tested by: pho, scottl Notes: svn path=/head/; revision=254138
* fuse: revert kernel_header update.Pedro F. Giffuni2013-07-241-86/+10
| | | | | | | | | | It seems to be causing problems due to the lack of the new features. Found by: bapt Pointed hat: pfg Notes: svn path=/head/; revision=253619
* fuse: revert birthtime support.Pedro F. Giffuni2013-07-202-6/+3
| | | | | | | | | | | | The creation time support breaks the data structures used in linux fuse. libfuse carries it's own header. Revert the changes for now. We will try to get an agreement with the fuse upstream maintainers to avoid having to patch the library headers all the time. Notes: svn path=/head/; revision=253498
* Adjust outsizes:Pedro F. Giffuni2013-07-201-2/+2
| | | | | | | | | | | Recalculate FUSE_COMPAT_ENTRY_OUT_SIZE and COMPAT_ATTR_OUT_SIZE. These were wrong in the previous commit. They are actually unused in FreeBSD though. Pointed out by: Jan Beich Notes: svn path=/head/; revision=253479
* Adjust outsizes:Pedro F. Giffuni2013-07-201-2/+2
| | | | | | | | | | | When birthtime was added (r253331) we missed adding the weight of the new fields in FUSE_COMPAT_ENTRY_OUT_SIZE and COMPAT_ATTR_OUT_SIZE. Adjust them accordingly. Pointed out by: Jan Beich Notes: svn path=/head/; revision=253478
* Update fuse_kernel header.Pedro F. Giffuni2013-07-151-11/+85
| | | | | | | | | | | | | | | | | | | | | Bring in the changes from the FUSE kernel interface 7.10 (available under a BSD license). After 7.10 the linux FUSE developers added support for a controversial CUSE driver and some linux especific features that are unlikely to find its way into FreeBSD. We currently don't implement any of the new features so we are *not* bumping the FUSE_KERNEL_MINOR_VERSION. The header should, nevertheless, serve as a template to add the new features in a compatible manner. While here adopt some minor cleanups from the upstream version like removing FUSE_MAJOR and FUSE_MINOR which were never used. Also add multiple inclusion header guards, Notes: svn path=/head/; revision=253344
* Add creation timestamp (birthtime) support for fuse.Pedro F. Giffuni2013-07-131-4/+1
| | | | | | | | | | | | | | I was keeping this #ifdef'd for reference with the MacFUSE change[1] but on second thought, this is a FreeBSD-only header so the SVN history should be enough. Add missing padding while here. Reference [1]: http://code.google.com/p/macfuse/source/detail?spec=svn1686&r=1360 Notes: svn path=/head/; revision=253331
* Add creation timestamp (birthtime) support for fuse.Pedro F. Giffuni2013-07-122-0/+8
| | | | | | | This is based on similar support in MacFUSE. Notes: svn path=/head/; revision=253276
* Switch the vm_object mutex to be a rwlock. This will enable in theAttilio Rao2013-03-092-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho Notes: svn path=/head/; revision=248084
* Eliminate a duplicate #include.Alan Cox2013-02-261-1/+0
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=247312
* Merge from vmobj-rwlock branch:Attilio Rao2013-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 Notes: svn path=/head/; revision=247297
* Add support for IO_APPEND flag in fuseBaptiste Daroussin2013-01-081-3/+5
| | | | | | | | | This make open(..., O_APPEND) actually works on fuse filesystem. Reviewed by: attilio Notes: svn path=/head/; revision=245164
* - Protect mnt_data and mnt_flags under the mount interlockAttilio Rao2012-11-101-7/+7
| | | | | | | | | | | | | - Move mp->mnt_stat manipulation where all of them happens Reported by: davide Discussed with: kib Tested by: flo MFC after: 2 months X-MFC: 241519, 242536,242616, 242727 Notes: svn path=/head/; revision=242875
* Complete MPSAFE VFS interface and remove MNTK_MPSAFE flag.Attilio Rao2012-11-091-1/+0
| | | | | | | | Porters should refer to __FreeBSD_version 1000021 for this change as it may have happened at the same timeframe. Notes: svn path=/head/; revision=242833
* - Current caching mode is completely broken because it simply reliesAttilio Rao2012-11-087-150/+16
| | | | | | | | | | | | | | | | on timing of the operations and not real lookup, bringing too many false positives. Remove the whole mechanism. If it needs to be implemented, next time it should really be done in the proper way. - Fix VOP_GETATTR() in order to cope with userland bugs that would change the type of file and not panic. Instead it gets the entry as if it is not existing. Reported and tested by: flo MFC after: 2 months X-MFC: 241519, 242536,242616 Notes: svn path=/head/; revision=242727
* fuse_io* must be able to crunch also VDIR vnodes.Attilio Rao2012-11-051-2/+2
| | | | | | | | | | | Update assert appropriately. Reported and Tested by: flo MFC after: 2 months X-MFC: 241519,242536 Notes: svn path=/head/; revision=242616
* Fix a bug where operations was carried on even if not implemented,Attilio Rao2012-11-031-6/+4
| | | | | | | | | | | leading to handling of an invalid fdip object. Reported and tested by: flo MFC after: 2 months X-MFC: 241519 Notes: svn path=/head/; revision=242536
* Remove unneeded D_NEEDMINOR.Ed Schouten2012-10-181-1/+0
| | | | | | | This is only needed when using clonelists. This got remove in r238693. Notes: svn path=/head/; revision=241702
* Rename s/DEBUG()/FS_DEBUG() and s/DEBUG2G()/FS_DEBUG2G() in order toAttilio Rao2012-10-148-84/+84
| | | | | | | | | | avoid a name clash in sparc64. MFC after: 2 months X-MFC: r241519 Notes: svn path=/head/; revision=241521
* Import a FreeBSD port of the FUSE Linux module.Attilio Rao2012-10-1318-0/+8167
This has been developed during 2 summer of code mandates and being revived by gnn recently. The functionality in this commit mirrors entirely content of fusefs-kmod port, which doesn't need to be installed anymore for -CURRENT setups. In order to get some sparse technical notes, please refer to: http://lists.freebsd.org/pipermail/freebsd-fs/2012-March/013876.html or to the project branch: svn://svn.freebsd.org/base/projects/fuse/ which also contains granular history of changes happened during port refinements. This commit does not came from the branch reintegration itself because it seems svn is not behaving properly for this functionaly at the moment. Partly Sponsored by: Google, Summer of Code program 2005, 2011 Originally submitted by: ilya, Csaba Henk <csaba-ml AT creo DOT hu > In collabouration with: pho Tested by: flo, gnn, Gustau Perez, Kevin Oberman <rkoberman AT gmail DOT com> MFC after: 2 months Notes: svn path=/head/; revision=241519