server supports it
for this, need NT CREATE AND X a directory in smbfs_open(), so that
we get the FID handle used for DIRECTORY CHANGE NOTIFY SMB
this could eventually be used to 'watch' even regular files, by
watching its parent directory and lookup/VN_KNOTE() when we get
REMOVED/RENAMED/MODIFIED action
also reorganize the kqueue code somewhat to use simplify locking
and knote detach
having some #ifdef UNION code in vfs_vnops.c, introduce variable
'vn_union_readdir_hook' which is set to address of appropriate
vn_readdir() hook by union filesystem when it's loaded & mounted
this is basically copy of what nfs_kq.c does - a thread periodically
polls server checking if any of the wateched files changed
eventually this should be changed to take advantage of SMB Directory
Change Notify
number
bump the timeout to 5s; eventually we'd want to do some heuristics similar
to NFS, i.e. make the attribute cache timeout longer for files nor recently
changed
This is potentially fragile, since the vnode may have been reclaimed
in vflush(), and used by different filesystem. This wouldn't actually
happen due to n_parent link to parent directory, but better safe
than sorry.
Since sm_root is only and strictly cache to speed up VFS_ROOT(),
it can be acquired/dropped any time. Rearrange code to not
require sm_root set, and change smbfs_root() back to set
sm_root if it's not set yet. smbfs_unmount() now only vrele()s
the root vnode if sm_root is set, and doesn't try reacquire it
if vflush() fails.
problem with vref() after vflush() pointed out by Bill Studenmund
smbfs_setroot()
remove pointless if() and MNT_LOCAL flag handling in smbfs_unmount()
turn the check for non-null sm_root to KASSERT() in smbfs_statfs()
adjust some comments
* lock/unlock mntvnode_slock and vnode interlock appropriately
* use LK_NOWAIT for vget()
* adjust the check for vnode being dirty to check fs-private 'modified' flag,
and drop waitfor/VOP_ISLOCKED() check
former smbfs_hash() may have accessed memory past buffer (ouch!), and accessed
memory in alignment-unsafe way
as an added bonus, hash32_strn() appears to have better distribution
* make sure islastcn and lockparent is set before used when the entry is cached
* add VWRITE check for nameiop == RENAME, add necessary unlock/relock for
ISDOTDOT case
adjust smbfs_print() to have slightly nicer output
enable vnode locking
* use LK_RETRY for the vget()
* turn the check for dead parent vnode to #ifdef DIAGNOSTIC panic
* reformat the hash walk code a little, and only assign vp if entries match
* add some comments
* g/c unused members 'mount_point', 'root_path', which only take space
* rename 'dev' to 'dev_fd' to more closely match what it is
* add 'export' member to avoid changing this again if ever smbfs would
be made exportable
bump SMBFS_VERMIN - ABI/API change; mount_smbfs needs to be recompiled
to work again
make smbfs_name_{alloc|free} inline
turn some checks for smbfs code errors to KASSERT()s
KNF some
also initialize n_size in smbfs_node_alloc()
g/c write-only variable in smbfs_nget()
make smbfs_readvdir() slightly more readable, and don't adjust uio_offset
by hand
g/c the lock code around smbfs_readvdir() - a) it's not needed here b) it
didn't do anything anyway
add some KASSERTs
simplify smbfs_vinvalbuf() a bit, use plain interruptible sleep instead
of smb_proc_intr()
for different cache_lookup() semantics
fix smbfs_pathcheck() to not assume zero-ended component name
remove the bogus code in smbfs_close(), it's not needed on NetBSD
fix couple other vnop routines to do vput()/vrele()/PNBUF_PUT() as appropriate
KNF
#if 0 smbfs_hashprint(), and mark it static
do NOT reinit vp->v_lock - getnewvnode() did it for us
smbfs_reclaim(): unconditionaly do LIST_REMOVE(), and de-obfuscate parent
directory vrele() call
so that the filesystem wouldn't appear as busy when it's not, and vref()
it back if the vflush() fails
LK_DRAIN sm_hashlock before freeing the smbmount struct
g/c one meaningless check in smbfs_root()
* g/c superfluous printfs
* use vcp on one more place
* don't need to check result of allocation with M_WAITOK
* just exlicitly return (0) on the success path, rather than return (error)
terminate the check if options SMB was included
remove the #ifndef FB_CURRENT around f_mntonname; FB_CURRENT used to be defined
in netsmb headers, and this caused f_mntonname to not be initialized
terminate the messy code setting f_mntfromname, and use snprintf() instead
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.