Commit Graph

2397 Commits

Author SHA1 Message Date
Andriy Gapon
d52023c1d3 MFC r208671: udf_readlink: fix malloc call with uninitialized size
parameter

Found by:	clang static analyzer
Approved by:	re(kib)
2010-06-09 10:13:59 +00:00
Robert Watson
ef9bfed8fb Merge r205010 from head to stable/8:
Update nfsrv_getsocksndseq() for changes in TCP internals since FreeBSD 6.x:

  - so_pcb is now guaranteed to be non-NULL and valid if a valid socket
    reference is held.

  - Need to check INP_TIMEWAIT and INP_DROPPED before assuming inp_ppcb is a
    tcpcb, as it might be a tcptw or NULL otherwise.

  - tp can never be NULL by the end of the function, so only check
    TCPS_ESTABLISHED before extracting tcpcb fields.

  The NFS server arguably incorporates too many assumptions about TCP
  internals, but fixing that is left for another day.

  Reviewed by:		bz
  Reviewed and tested by:	rmacklem
  Sponsored by:		Juniper Networks

Approved by:	re (kib)
2010-06-03 09:15:52 +00:00
Robert Watson
2300da982a Merge r206210 from head to stable/7:
Synchronize Coda kernel module definitions in our coda.h to Coda 6's
  coda.h:

  - CodaFid typdef -> struct CodaFid throughout.
  - Use unsigned int instead of unsigned long for venus_dirent and other
    cosmetic fixes.
  - Introduce cuid_t and cgid_t and use instead of uid_t and gid_t in RPCs.
  - Synchronize comments and macros.
  - Use u_int32_t instead of unsigned long for coda_out_hdr.

  With these changes, a 64-bit Coda kernel module now works with
  coda6_client, whereas previous userspace and kernel versions of RPCs
  differed sufficiently to prevent using the file system.  This has been
  verified only with casual testing, but /coda is now usable for at least
  basic operations on amd64.

Approved by:	re (kensmith)
2010-06-01 14:29:26 +00:00
Robert Watson
9770cc486f Merge r206206 from head to stable/8:
Correct definition of CIOC_KERNEL_VERSION Coda ioctl() for systems
  where sizeof(int) != sizeof(sizeof(int)), or the ioctl will return
  EINVAL.

Approved by:	re (kib)
2010-06-01 13:57:58 +00:00
Rick Macklem
5ea4f2ba9f MFC: r208254
Allow the experimental NFSv4 client to use cached attributes
when a write delegation is held. Also, add a missing
mtx_unlock() call for the ACL debugging code.
2010-05-23 02:55:59 +00:00
Rick Macklem
591aafd12e MFC: r208234
Add a sanity check for a negative args.fhsize to the experimental
NFS client.
2010-05-22 01:01:59 +00:00
Konstantin Belousov
c67c645d9d MFC r207729:
Add MAKEDEV_NOWAIT flag for make_dev_credf(9).
2010-05-20 09:38:15 +00:00
Konstantin Belousov
4fa8113f97 MFC r207848:
The thread_unsuspend() requires both process mutex and process spinlock
locked. Postpone the process unlock till the thread_unsuspend() is called.
2010-05-17 08:15:04 +00:00
Konstantin Belousov
c32fbf547b MFC r207847:
For detach procfs ctl command, also clear P_STOPPED_TRACE process stop
flag, and for each thread, TDB_SUSPEND debug flag, same as it is done by
exit1() for orphaned debugee.
2010-05-17 08:11:23 +00:00
Rick Macklem
e6c7d81538 MFC: r207785
Fix typos in macros.
2010-05-17 02:01:22 +00:00
Rick Macklem
4406606105 MFC: r207764
Patch the experimental NFS client so that it works for NFSv2
by adding the necessary mapping from NFSv3 procedure numbers
to NFSv2 procedure numbers when doing NFSv2 RPCs.
2010-05-17 01:41:11 +00:00
Rick Macklem
175abb7ed7 MFC: r207350
For the experimental NFS client, it should always flush dirty
buffers before closing the NFSv4 opens, as the comment states.
This patch deletes the call to nfscl_mustflush() which would
return 0 for the case where a delegation still exists, which
was incorrect and could cause crashes during recovery from
an expired lease.
2010-05-06 01:08:36 +00:00
Rick Macklem
5783c9fe30 MFC: r207349
Delete a diagnostic statement that is no longer useful from
the experimental NFS client.
2010-05-06 00:49:10 +00:00
Konstantin Belousov
22df1496d2 MFC r206894:
The cache_enter(9) function shall not be called for doomed dvp.
Assert this.

Verify that dvp is not reclaimed before calling cache_enter().
2010-05-04 05:25:48 +00:00
Rick Macklem
227b9ebe26 MFC: r207170
An NFSv4 server will reply NFSERR_GRACE for non-recovery RPCs
during the grace period after startup. This grace period must
be at least the lease duration, which is typically 1-2 minutes.
It seems prudent for the experimental NFS client to wait a few
seconds before retrying such an RPC, so that the server isn't
flooded with non-recovery RPCs during recovery. This patch adds
an argument to nfs_catnap() to implement a 5 second delay
for this case.
2010-05-01 00:50:51 +00:00
Rick Macklem
52d8bf8926 MFC: r207082
When the experimental NFS client is handling an NFSv4 server reboot
with delegations enabled, the recovery could fail if the renew
thread is trying to return a delegation, since it will not do the
recovery. This patch fixes the above by having nfscl_recalldeleg()
fail with the I/O operations returning EIO, so that they will be
attempted later. Most of the patch consists of adding an argument
to various functions to indicate the delegation recall case where
this needs to be done.
2010-04-29 23:48:09 +00:00
Rick Macklem
91f671cf92 MFC: r206880
For the experimental NFS client doing an NFSv4 mount,
set the NFSCLFLAGS_RECVRINPROG while doing recovery from an expired
lease in a manner similar to r206818 for server reboot recovery.
This will prevent the function that acquires stateids for I/O
operations from acquiring out of date stateids during recovery.
Also, fix up mutex locking on the nfsc_flags field.
2010-04-27 01:00:22 +00:00
Rick Macklem
a862e504da MFC: r206818
Avoid extraneous recovery cycles in the experimental NFS client
when an NFSv4 server reboots, by doing two things.
1 - Make the function that acquires a stateid for I/O operations
    block until recovery is complete, so that it doesn't acquire
    out of date stateids.
2 - Only allow a recovery once every 1/2 of a lease duration, since
    the NFSv4 server must provide a recovery grace period of at
    least a lease duration. This should avoid recoveries caused
    by an out of date stateid that was acquired for an I/O op.
    just before a recovery cycle started.
2010-04-25 01:56:31 +00:00
Rick Macklem
bf129106d7 MFC: r206690
Add mutex lock calls to 2 cases in the experimental NFS client's
renew thread where they were missing.
2010-04-23 00:34:59 +00:00
Rick Macklem
4a9c979c0f MFC: r206688
The experimental NFS client was not filling in recovery credentials
for opens done locally in the client when a delegation for the file
was held. This could cause the client to crash in crsetgroups() when
recovering from a server crash/reboot. This patch fills in the
recovery credentials for this case, in order to avoid the client crash.
Also, add KASSERT()s to the credential copy functions, to catch any
other cases where the credentials aren't filled in correctly.
2010-04-23 00:12:23 +00:00
Rick Macklem
0c58adb2fa MFC: r206236
Harden the experimental NFS server a little, by adding range
checks on the length of the client's open/lock owner name. Also,
add free()'s for one case where they were missing and would
have caused a leak if NFSERR_BADXDR had been replied. Probably
never happens, but the leak is now plugged, just in case.
2010-04-20 01:25:18 +00:00
Rick Macklem
cf66cfa0b1 MFC: r206170
Harden the experimental NFS server a little, by adding extra checks
in the readdir functions for non-positive byte count arguments.
For the negative case, set it to the maximum allowable, since it
was actually a large positive value (unsigned) on the wire.
Also, fix up the readdir function comment a bit.
2010-04-18 22:51:15 +00:00
Rick Macklem
4e76f29635 MFC: r206063
For the experimental NFS server, add a call to free the lookup
path buffer for one case where it was missing when doing mkdir.
This could have conceivably resulted in a leak of a buffer, but
a leak was never observed during testing, so I suspect it would
have occurred rarely, if ever, in practice.
2010-04-16 02:16:58 +00:00
Rick Macklem
2d2fef10c5 MFC: r206061
Add SAVENAME to the cn_flags for all cases in the experimental
NFS server for the CREATE cn_nameiop where SAVESTART isn't set.
I was not aware that this needed to be done by the caller until
recently.
2010-04-16 01:39:30 +00:00
Rick Macklem
066adacfb1 MFC: r205941
This patch should fix handling of byte range locks locally
on the server for the experimental nfs server. When enabled
by setting vfs.newnfs.locallocks_enable to non-zero, the
experimental nfs server will now acquire byte range locks
on the file on behalf of NFSv4 clients, such that lock
conflicts between the NFSv4 clients and processes running
locally on the server, will be recognized and handled correctly.
2010-04-14 03:13:02 +00:00
Andriy Gapon
8d5ce86fd6 MFC r206098: mountmsdosfs: reject too high value of bytes per cluster 2010-04-12 20:53:17 +00:00
Konstantin Belousov
bb9a8424a3 MFC r206093:
Add function vop_rename_fail(9) that performs needed cleanup for locks
and references of the VOP_RENAME(9) arguments. Use vop_rename_fail()
in deadfs_rename().
2010-04-09 08:39:28 +00:00
Rick Macklem
5b41805237 MFC: r205663
Patch the experimental NFS server in a manner analagous to r205661
for the regular NFS server, to ensure that ESTALE is
returned to the client for all errors returned by VFS_FHTOVP().
2010-04-09 01:33:12 +00:00
Rick Macklem
0bbe1d9baa MFC: r205572
Fix the experimental NFS subsystem so that it uses the correct
preprocessor macro name for not requiring strict data alignment.
2010-04-07 15:19:52 +00:00
Nathan Whitehorn
4ccf64eb2b MFC r205014,205015:
Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

This MFC is required for MFCs of later changes to the freebsd32
compatibility from HEAD.

Requested by:	kib
2010-04-07 02:24:41 +00:00
Edward Tomasz Napierala
bd7ae20991 MFC r197680:
Provide default implementation for VOP_ACCESS(9), so that filesystems which
want to provide VOP_ACCESSX(9) don't have to implement both.  Note that
this commit makes implementation of either of these two mandatory.

Reviewed by:	kib
2010-03-27 17:22:11 +00:00
Edward Tomasz Napierala
e8db802864 MFC r197650:
Fix typo in the comment.
2010-03-27 16:35:25 +00:00
Konstantin Belousov
9e211e5715 MFC r204475:
Mark msdosfs as mpsafe.
2010-03-24 14:56:56 +00:00
Konstantin Belousov
3d9ee8abe2 MFC r204589:
Do not leak vnode lock when msdosfs mount is updated and specified
device is different from the device used to the original mount.
2010-03-24 14:53:28 +00:00
Konstantin Belousov
a8428ad0f1 MFC r204474:
Fix the race between dotdot lookup and forced unmount, by using
msdosfs-specific variant of vn_vget_ino(), msdosfs_deget_dotdot().

As was done for UFS, relookup the dotdot denode after the call to
msdosfs_deget_dotdot(), because vnode lock is dropped and directory
might be moved.

MFC r204675:
When returning error from msdosfs_lookup(), make sure that *vpp is NULL.
2010-03-24 14:50:04 +00:00
Konstantin Belousov
7825951721 MFC r204473:
Use pm_fatlock to protect per-filesystem rb tree used to allocate fileno
on the large FAT volumes.
2010-03-24 14:45:50 +00:00
Konstantin Belousov
255ca65791 MFC r204472:
Add assertions for FAT bitmap state.
2010-03-24 14:43:19 +00:00
Konstantin Belousov
05ecce0c28 MFC r204471:
Use pm_fatlock to protect fat bitmap.
2010-03-24 14:37:17 +00:00
Konstantin Belousov
3a141f45c5 MFC r204470:
Add per-mountpoint lockmgr lock for msdosfs.

MFC r204576:
Only destroy pm_fatlock on error if it was initialized.
2010-03-24 14:25:15 +00:00
Konstantin Belousov
670baf9dfe MFC r204469:
In msdosfs deget(), properly handle the case when the vnode is found in hash.
2010-03-24 14:18:10 +00:00
Konstantin Belousov
ac8743bcd3 MFC r204468:
In msdosfs_inactive(), reclaim the vnodes both for SLOT_DELETED and
SLOT_EMPTY deName[0] values.
2010-03-24 14:15:46 +00:00
Konstantin Belousov
b2c1c014b3 MFC r204467:
Remove seemingly unneeded unlock/relock of the dvp in msdosfs_rmdir,
causing LOR.
2010-03-24 14:13:27 +00:00
Konstantin Belousov
1a07617f97 MFC r204466:
Assert that the msdosfs vnode is (e)locked in several places.
Change the check and return on impossible condition into KASSERT().
2010-03-24 14:10:08 +00:00
Konstantin Belousov
99cb1f2430 MFC r204465:
Remove unused global statistic about fat cache usage.
2010-03-24 14:08:01 +00:00
Jung-uk Kim
a0bc6d1ca6 MFC: r205223
Fix a long standing regression of readdir(3) in fdescfs(5) introduced
in r1.48.  We were stopping at the first null pointer when multiple file
descriptors were opened and one in the middle was closed.  This restores
traditional behaviour of fdescfs.
2010-03-22 20:36:35 +00:00
Konstantin Belousov
e623216f38 MFC r203827:
- Add idempotency guards so the structures can be used in other utilities.
- Update bpb structs with reserved fields.
- In direntry struct join deName with deExtension. Although a
  fix was attempted in the past, these fields were being overflowed,
  Now this is consistent with the spec, and we can now share the
  WinChksum code with NetBSD.
2010-02-27 16:51:23 +00:00
Konstantin Belousov
3588e7da23 MFC r203866:
Invalid filesystem might cause the bp to be never read.
2010-02-21 11:13:15 +00:00
Konstantin Belousov
fe5e746617 MFC r203826:
Use M_ZERO instead of calling bzero().
Fix function name in the comment.

MFC r203828:
Fix function name in the comment in the second location too.
2010-02-20 11:58:19 +00:00
Konstantin Belousov
bc6c9c912c MFC r203822:
Remove unused macros.
2010-02-20 11:54:18 +00:00
Rick Macklem
3ed680d8da MFC: r203849
Change the default value for vfs.newnfs.enable_locallocks to 0 for
the experimental NFS server, since local locking is known to be
broken and the patch to fix it is still a work in progress.
2010-02-19 16:36:08 +00:00