Deleted Added
full compact
1/*-
2 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3 * Authors: Doug Rabson <dfr@rabson.org>
4 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include "opt_inet6.h"
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/nlm/nlm_prot_impl.c 230801 2012-01-31 02:11:05Z rmacklem $");
31__FBSDID("$FreeBSD: head/sys/nlm/nlm_prot_impl.c 241896 2012-10-22 17:50:54Z kib $");
32
33#include <sys/param.h>
34#include <sys/fail.h>
35#include <sys/fcntl.h>
36#include <sys/kernel.h>
37#include <sys/kthread.h>
38#include <sys/lockf.h>
39#include <sys/malloc.h>

--- 1724 unchanged lines hidden (view full) ---

1764nlm_convert_to_fhandle_t(fhandle_t *fhp, struct netobj *p)
1765{
1766 memcpy(fhp, p->n_bytes, sizeof(fhandle_t));
1767}
1768
1769struct vfs_state {
1770 struct mount *vs_mp;
1771 struct vnode *vs_vp;
1772 int vs_vfslocked;
1772 int vs_vnlocked;
1773};
1774
1775static int
1776nlm_get_vfs_state(struct nlm_host *host, struct svc_req *rqstp,
1777 fhandle_t *fhp, struct vfs_state *vs, accmode_t accmode)
1778{
1779 int error, exflags;
1780 struct ucred *cred = NULL, *credanon = NULL;
1781
1782 memset(vs, 0, sizeof(*vs));
1783
1784 vs->vs_mp = vfs_getvfs(&fhp->fh_fsid);
1785 if (!vs->vs_mp) {
1786 return (ESTALE);
1787 }
1789 vs->vs_vfslocked = VFS_LOCK_GIANT(vs->vs_mp);
1788
1789 /* accmode == 0 means don't check, since it is an unlock. */
1790 if (accmode != 0) {
1791 error = VFS_CHECKEXP(vs->vs_mp,
1792 (struct sockaddr *)&host->nh_addr, &exflags, &credanon,
1793 NULL, NULL);
1794 if (error)
1795 goto out;

--- 59 unchanged lines hidden (view full) ---

1855 if (vs->vs_vp) {
1856 if (vs->vs_vnlocked)
1857 vput(vs->vs_vp);
1858 else
1859 vrele(vs->vs_vp);
1860 }
1861 if (vs->vs_mp)
1862 vfs_rel(vs->vs_mp);
1865 VFS_UNLOCK_GIANT(vs->vs_vfslocked);
1863}
1864
1865static nlm4_stats
1866nlm_convert_error(int error)
1867{
1868
1869 if (error == ESTALE)
1870 return nlm4_stale_fh;

--- 580 unchanged lines hidden ---