summaryrefslogtreecommitdiffstats
path: root/sys/fs/smbfs
Commit message (Collapse)AuthorAgeFilesLines
* MFC r293679:ae2016-01-183-6/+8
| | | | | | | | | | | | Change the type of newsize argument in the smbfs_smb_setfsize() function from int to int64. MSDN says that SMB_SET_FILE_END_OF_FILE_INFO uses signed 64-bit integer to specify offset, but since smbfs_smb_setfsize() has used plain int, a value was truncated in case when offset was larger than 2G. https://msdn.microsoft.com/en-us/library/ff469975.aspx In particular, now `truncate -s 10G` will work correctly on the mounted SMB share.
* MFC r277953:dim2015-02-091-2/+2
| | | | | Fix a -Wcast-qual warning in smbfs_subr.c, by using __DECONST. No functional change.
* MFC r274784:trasz2014-12-211-2/+0
| | | | | | | | | | Fix smbfs to not zero out statfs f_flags field. Previously, this made getmntinfo() return empty flags for smbfs filesystems when called with MNT_WAIT. It's not visible with mount(8), since it uses MNT_NOWAIT, but broke autounmount(8) operation. PR: 195161 Sponsored by: The FreeBSD Foundation
* MFC r264494:ae2014-05-023-18/+64
| | | | | | | | | | | | Use SMB_QUERY_FS_SIZE_INFO request to populate statfs structure. When server doesn't support this request, try to use SMB_INFO_ALLOCATION. And use SMB_COM_QUERY_INFORMATION_DISK request as fallback. MFC r264600: Remove redundant unlock. This code was removed from the opensolaris and darwin's netsmb implementations, in DfBSD it also has been disabled.
* Expand the use of stat(2) flags to allow storing some Windows/DOSken2013-08-212-10/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and CIFS file attributes as BSD stat(2) flags. This work is intended to be compatible with ZFS, the Solaris CIFS server's interaction with ZFS, somewhat compatible with MacOS X, and of course compatible with Windows. The Windows attributes that are implemented were chosen based on the attributes that ZFS already supports. The summary of the flags is as follows: UF_SYSTEM: Command line name: "system" or "usystem" ZFS name: XAT_SYSTEM, ZFS_SYSTEM Windows: FILE_ATTRIBUTE_SYSTEM This flag means that the file is used by the operating system. FreeBSD does not enforce any special handling when this flag is set. UF_SPARSE: Command line name: "sparse" or "usparse" ZFS name: XAT_SPARSE, ZFS_SPARSE Windows: FILE_ATTRIBUTE_SPARSE_FILE This flag means that the file is sparse. Although ZFS may modify this in some situations, there is not generally any special handling for this flag. UF_OFFLINE: Command line name: "offline" or "uoffline" ZFS name: XAT_OFFLINE, ZFS_OFFLINE Windows: FILE_ATTRIBUTE_OFFLINE This flag means that the file has been moved to offline storage. FreeBSD does not have any special handling for this flag. UF_REPARSE: Command line name: "reparse" or "ureparse" ZFS name: XAT_REPARSE, ZFS_REPARSE Windows: FILE_ATTRIBUTE_REPARSE_POINT This flag means that the file is a Windows reparse point. ZFS has special handling code for reparse points, but we don't currently have the other supporting infrastructure for them. UF_HIDDEN: Command line name: "hidden" or "uhidden" ZFS name: XAT_HIDDEN, ZFS_HIDDEN Windows: FILE_ATTRIBUTE_HIDDEN This flag means that the file may be excluded from a directory listing if the application honors it. FreeBSD has no special handling for this flag. The name and bit definition for UF_HIDDEN are identical to the definition in MacOS X. UF_READONLY: Command line name: "urdonly", "rdonly", "readonly" ZFS name: XAT_READONLY, ZFS_READONLY Windows: FILE_ATTRIBUTE_READONLY This flag means that the file may not written or appended, but its attributes may be changed. ZFS currently enforces this flag, but Illumos developers have discussed disabling enforcement. The behavior of this flag is different than MacOS X. MacOS X uses UF_IMMUTABLE to represent the DOS readonly permission, but that flag has a stronger meaning than the semantics of DOS readonly permissions. UF_ARCHIVE: Command line name: "uarch", "uarchive" ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE Windows name: FILE_ATTRIBUTE_ARCHIVE The UF_ARCHIVED flag means that the file has changed and needs to be archived. The meaning is same as the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. msdosfs and ZFS have special handling for this flag. i.e. they will set it when the file changes. sys/param.h: Bump __FreeBSD_version to 1000047 for the addition of new stat(2) flags. chflags.1: Document the new command line flag names (e.g. "system", "hidden") available to the user. ls.1: Reference chflags(1) for a list of file flags and their meanings. strtofflags.c: Implement the mapping between the new command line flag names and new stat(2) flags. chflags.2: Document all of the new stat(2) flags, and explain the intended behavior in a little more detail. Explain how they map to Windows file attributes. Different filesystems behave differently with respect to flags, so warn the application developer to take care when using them. zfs_vnops.c: Add support for getting and setting the UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN, UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags. All of these flags are implemented using attributes that ZFS already supports, so the on-disk format has not changed. ZFS currently doesn't allow setting the UF_REPARSE flag, and we don't really have the other infrastructure to support reparse points. msdosfs_denode.c, msdosfs_vnops.c: Add support for getting and setting UF_HIDDEN, UF_SYSTEM and UF_READONLY in MSDOSFS. It supported SF_ARCHIVED, but this has been changed to be UF_ARCHIVE, which has the same semantics as the DOS archive attribute instead of inverse semantics like SF_ARCHIVED. After discussion with Bruce Evans, change several things in the msdosfs behavior: Use UF_READONLY to indicate whether a file is writeable instead of file permissions, but don't actually enforce it. Refuse to change attributes on the root directory, because it is special in FAT filesystems, but allow most other attribute changes on directories. Don't set the archive attribute on a directory when its modification time is updated. Windows and DOS don't set the archive attribute in that scenario, so we are now bug-for-bug compatible. smbfs_node.c, smbfs_vnops.c: Add support for UF_HIDDEN, UF_SYSTEM, UF_READONLY and UF_ARCHIVE in SMBFS. This is similar to changes that Apple has made in their version of SMBFS (as of smb-583.8, posted on opensource.apple.com), but not quite the same. We map SMB_FA_READONLY to UF_READONLY, because UF_READONLY is intended to match the semantics of the DOS readonly flag. The MacOS X code maps both UF_IMMUTABLE and SF_IMMUTABLE to SMB_FA_READONLY, but the immutable flags have stronger meaning than the DOS readonly bit. stat.h: Add definitions for UF_SYSTEM, UF_SPARSE, UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY and UF_HIDDEN. The definition of UF_HIDDEN is the same as the MacOS X definition. Add commented-out definitions of UF_COMPRESSED and UF_TRACKED. They are defined in MacOS X (as of 10.8.2), but we do not implement them (yet). ufs_vnops.c: Add support for getting and setting UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY, UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS. Alphabetize the flags that are supported. These new flags are only stored, UFS does not take any action if the flag is set. Sponsored by: Spectra Logic Reviewed by: bde (earlier version)
* - Fix double frees/user after free.davide2013-07-031-113/+56
| | | | | | | - Allocate using smb_rq_alloc() instead of inlining it. Reported by: uqs Found with: Coverity Scan
* Properly use v_data field. This magically worked (even if wrong) untildavide2013-06-281-1/+1
| | | | | now because v_data is the first field of the structure, but it's not something we should rely on.
* Garbage collect an useless check. smp should be never NULL.davide2013-06-281-5/+0
|
* Plug a couple of leakages in smbfs_lookup().davide2013-06-281-3/+6
|
* Change VM_OBJECT_LOCK/UNLOCK() -> VM_OBJECT_WLOCK/WUNLOCK() to reflectdavide2013-05-041-8/+9
| | | | | | the recent switch of the vm object lock to a rwlock. Reported by: attilio
* Overhaul locking in netsmb, getting rid of the obsolete lockmgr() primitive.davide2013-05-041-2/+2
| | | | | | This solves a long standing LOR between smb_conn and smb_vc. Tested by: martymac, pho (previous version)
* Completely rewrite the interface to smbdev switching from dev_clonedavide2013-05-042-10/+30
| | | | | | | | | to cdevpriv(9). This commit changes the semantic of mount_smbfs in userland as well, which now passes file descriptor in order to to mount a specific filesystem istance. Reviewed by: attilio, ed Tested by: martymac
* 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
* - smbfs_rename() might return an error value without correctly upgradingdavide2012-11-262-2/+3
| | | | | | | | the vnode use count, and this might cause the kernel to panic if compiled with WITNESS enable. - Be sure to put the '\0' terminator to the rpath string. Sponsored by: iXsystems inc.
* - Remove reset of vpp pointer in some places as long as it's not reallydavide2012-11-223-5/+0
| | | | | | | | useful and has the side effect of obfuscating the code a bit. - Remove spurious references to simple_lock. Reported by: attilio [1] Sponsored by: iXsystems inc.
* Until now, smbfs_fullpath() computed the full path starting from thedavide2012-11-225-60/+63
| | | | | | | | | | | | | vnode and following back the chain of n_parent pointers up to the root, without acquiring the locks of the n_parent vnodes analyzed during the computation. This is immediately wrong because if the vnode lock is not held there's no guarantee on the validity of the vnode pointer or the data. In order to fix, store the whole path in the smbnode structure so that smbfs_fullpath() can use this information. Discussed with: kib Reported and tested by: pho Sponsored by: iXsystems inc.
* Get rid of some old debug code. It provides checks similar to the onedavide2012-11-142-40/+0
| | | | | | offered by RedZone so there's no need to keep it. Sponsored by: iXsystems inc.
* Fix the lookup in the DOTDOT case in the same way as other filesystems do,davide2012-11-141-0/+21
| | | | | | i.e. inlining the vn_vget_ino() algorithm. Sponsored by: iXsystems inc.
* - Do not put in the mntqueue half-constructed vnodes.davide2012-10-314-123/+69
| | | | | | | | | | - Change the code so that it relies on vfs_hash rather than on a home-made hashtable. - There's no need to inline fnv_32_buf(). Reviewed by: delphij Tested by: pho Sponsored by: iXsystems inc.
* Fix panic due to page faults while in kernel mode, under conditions ofdavide2012-10-317-169/+326
| | | | | | | | | VM pressure. The reason is that in some codepaths pointers to stack variables were passed from one thread to another. In collaboration with: pho Reported by: pho's stress2 suite Sponsored by: iXsystems inc.
* Change the code to use %jd as printf() placeholder for uio_offset anddavide2012-10-312-4/+7
| | | | | | | cast to intmax_t. Suggested by: pjd Sponsored by: iXsystems inc.
* Fix build in case we have SMBVDEBUG turned on.davide2012-10-252-4/+5
| | | | | | Reviewed by: gnn Approved by: gnn Sponsored by: iXsystems inc.
* - Remove the references to the deprecated zalloc kernel interfacedavide2012-10-252-36/+2
| | | | | | | | - Use M_ZERO flag in malloc() rather than bzero() - malloc() with M_NOWAIT can't return NULL so there's no need to check Reviewed by: alc Approved by: alc
* Do not leave invalid pages in the object after the short read for akib2012-08-141-1/+1
| | | | | | | | | | | | | | network file systems (not only NFS proper). Short reads cause pages other then the requested one, which were not filled by read response, to stay invalid. Change the vm_page_readahead_finish() interface to not take the error code, but instead to make a decision to free or to (de)activate the page only by its validity. As result, not requested invalid pages are freed even if the read RPC indicated success. Noted and reviewed by: alc MFC after: 1 week
* After the PHYS_TO_VM_PAGE() function was de-inlined, the main reasonkib2012-08-051-0/+1
| | | | | | | | | | | | | to pull vm_param.h was removed. Other big dependency of vm_page.h on vm_param.h are PA_LOCK* definitions, which are only needed for in-kernel code, because modules use KBI-safe functions to lock the pages. Stop including vm_param.h into vm_page.h. Include vm_param.h explicitely for the kernel code which needs it. Suggested and reviewed by: alc MFC after: 2 weeks
* Reduce code duplication and exposure of direct access to structkib2012-08-041-30/+2
| | | | | | | | | vm_page oflags by providing helper function vm_page_readahead_finish(), which handles completed reads for pages with indexes other then the requested one, for VOP_GETPAGES(). Reviewed by: alc MFC after: 1 week
* Simply error handling by moving the allocation of np down to where it isbrueffer2012-07-161-8/+6
| | | | | | | actually used. While here, improve style a little. Submitted by: mjg MFC after: 2 weeks
* Save a bzero() by using M_ZERO.brueffer2012-07-151-2/+1
| | | | | Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) MFC after: 2 weeks
* Remove unused thread argument to vrecycle().trasz2012-04-231-1/+1
| | | | Reviewed by: kib
* Rename cache_lookup_times() to cache_lookup() and retire the old API andjhb2012-02-061-1/+1
| | | | ABI stub for cache_lookup().
* Make sure all intermediate variables holding mount flags (mnt_flag)mckusick2012-01-171-1/+1
| | | | | | | and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC after: 2 weeks
* Use strchr() and strrchr().ed2012-01-022-7/+7
| | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel.
* Rename vm_page_set_valid() to vm_page_set_valid_range().kib2011-11-301-1/+1
| | | | | | | The vm_page_set_valid() is the most reasonable name for the m->valid accessor. Reviewed by: attilio, alc
* Add unicode support to msdosfs and smbfs; original pathes from imura,kevlo2011-11-182-11/+61
| | | | | | bug fixes by Kuan-Chung Chiu <buganini at gmail dot com>. Tested by me in production for several days at work.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-071-1/+1
| | | | This means that their use is restricted to a single C file.
* Remove MALLOC_DECLAREs of nonexisting malloc-pools.ed2011-11-061-4/+0
| | | | | After careful grepping, it seems none of these pools can be found in our source tree. They are not in use, nor are they defined.
* This update changes the mnt_flag field in the mount structure frommckusick2011-07-241-1/+1
| | | | | | | | | | 32 bits to 64 bits and eliminates the unused mnt_xflag field. The existing mnt_flag field is completely out of bits, so this update gives us room to expand. Note that the f_flags field in the statfs structure is already 64 bits, so the expanded mnt_flag field can be exported without having to make any changes in the statfs structure. Approved by: re (bz)
* Make a comment more accurate.jonathan2011-07-071-1/+1
| | | | | | | | | This comment refers to CAP_NT_SMBS, which does not exist; it should refer to SMB_CAP_NT_SMBS. Fixing this comment makes it easier for people interested in Capsicum to grep around for capability rights, whose identifiers are of the form 'CAP_[A-Z_]'. Approved by: mentor (rwatson), re (Capsicum blanket) Sponsored by: Google Inc
* In the VOP_PUTPAGES() implementations, change the default error fromkib2011-06-011-8/+3
| | | | | | | | | | | | | | | | VM_PAGER_AGAIN to VM_PAGER_ERROR for the uwritten pages. Return VM_PAGER_AGAIN for the partially written page. Always forward at least one page in the loop of vm_object_page_clean(). VM_PAGER_ERROR causes the page reactivation and does not clear the page dirty state, so the write is not lost. The change fixes an infinite loop in vm_object_page_clean() when the filesystem returns permanent errors for some page writes. Reported and tested by: gavin Reviewed by: alc, rmacklem MFC after: 1 week
* M_USE_RESERVE has been deprecated for a decade. Eliminate any uses thatalc2010-10-021-2/+1
| | | | have no run-time effect.
* Add dedicated routines to toggle lockmgr flags such as LK_NOSHARE andjhb2010-08-201-1/+1
| | | | | | | | | | | | 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
* Eliminate unnecessary page queues locking.alc2010-06-181-2/+0
|
* Push down the page queues lock into vm_page_activate().alc2010-05-071-8/+9
|
* Eliminate page queues locking around most calls to vm_page_free().alc2010-05-061-4/+0
|
* Acquire the page lock around all remaining calls to vm_page_free() onalc2010-05-051-6/+12
| | | | | | | | | | | | | managed pages that didn't already have that lock held. (Freeing an unmanaged page, such as the various pmaps use, doesn't require the page lock.) This allows a change in vm_page_remove()'s locking requirements. It now expects the page lock to be held instead of the page queues lock. Consequently, the page queues lock is no longer required at all by callers to vm_page_rename(). Discussed with: kib
* Move checking against RLIMIT_FSIZE into one place, vn_rlimit_fsize().trasz2010-05-051-14/+4
| | | | Reviewed by: kib
* Lock the page around vm_page_activate() and vm_page_deactivate() callskib2010-05-031-2/+6
| | | | | | | where it was missed. The wrapped fragments now protect wire_count with page lock. Reviewed by: alc
* Switch to our preferred 2-clause BSD license.joel2010-04-079-60/+6
| | | | Approved by: bp
* Remove unused smbfs_smb_qpathinfo().trasz2010-01-081-110/+0
|
OpenPOWER on IntegriCloud