Changes in 4.9.311 USB: serial: pl2303: add IBM device IDs USB: serial: simple: add Nokia phone driver netdevice: add the case if dev is NULL virtio_console: break out of buf poll on remove ethernet: sun: Free the coherent when failing in probing af_key: add __GFP_ZERO flag for compose_sadb_supported in function pfkey_register block: Add a helper to validate the block size virtio-blk: Use blk_validate_block_size() to validate block size USB: usb-storage: Fix use of bitfields for hardware data in ene_ub6250.c coresight: Fix TRCCONFIGR.QE sysfs interface iio: inkern: apply consumer scale on IIO_VAL_INT cases iio: inkern: make a best effort on offset calculation clk: uniphier: Fix fixed-rate initialization ptrace: Check PTRACE_O_SUSPEND_SECCOMP permission on PTRACE_SEIZE SUNRPC: avoid race between mod_timer() and del_timer_sync() NFSD: prevent underflow in nfssvc_decode_writeargs() can: ems_usb: ems_usb_start_xmit(): fix double dev_kfree_skb() in error path jffs2: fix use-after-free in jffs2_clear_xattr_subsystem jffs2: fix memory leak in jffs2_do_mount_fs jffs2: fix memory leak in jffs2_scan_medium mm/pages_alloc.c: don't create ZONE_MOVABLE beyond the end of a node mempolicy: mbind_range() set_policy() after vma_merge() scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands Revert "Input: clear BTN_RIGHT/MIDDLE on buttonpads" ALSA: cs4236: fix an incorrect NULL check on list iterator drivers: hamradio: 6pack: fix UAF bug caused by mod_timer() video: fbdev: sm712fb: Fix crash in smtcfb_read() video: fbdev: atari: Atari 2 bpp (STe) palette bugfix ARM: dts: exynos: fix UART3 pins configuration in Exynos5250 ARM: dts: exynos: add missing HDMI supplies on SMDK5250 ARM: dts: exynos: add missing HDMI supplies on SMDK5420 carl9170: fix missing bit-wise or operator for tx_params thermal: int340x: Increase bitmap size lib/raid6/test: fix multiple definition linking error DEC: Limit PMAX memory probing to R3k systems media: davinci: vpif: fix unbalanced runtime PM get brcmfmac: firmware: Allocate space for default boardrev in nvram brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio PCI: pciehp: Clear cmd_busy bit in polling mode crypto: authenc - Fix sleep in atomic context in decrypt_tail crypto: mxs-dcp - Fix scatterlist processing spi: tegra114: Add missing IRQ check in tegra_spi_probe selftests/x86: Add validity check and allow field splitting hwmon: (pmbus) Add mutex to regulator ops hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNING PM: hibernate: fix __setup handler error handling PM: suspend: fix return value of __setup handler crypto: vmx - add missing dependencies crypto: ccp - ccp_dmaengine_unregister release dma channels hwmon: (pmbus) Add Vin unit off handling clocksource: acpi_pm: fix return value of __setup handler sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa perf/core: Fix address filter parser for multiple filters perf/x86/intel/pt: Fix address filter config for 32-bit kernel video: fbdev: smscufx: Fix null-ptr-deref in ufx_usb_probe() video: fbdev: fbcvt.c: fix printing in fb_cvt_print_name() ARM: dts: qcom: ipq4019: fix sleep clock soc: ti: wkup_m3_ipc: Fix IRQ check in wkup_m3_ipc_probe media: usb: go7007: s2250-board: fix leak in probe() ASoC: ti: davinci-i2s: Add check for clk_enable() ALSA: spi: Add check for clk_enable() arm64: dts: ns2: Fix spi-cpol and spi-cpha property arm64: dts: broadcom: Fix sata nodename printk: fix return value of printk.devkmsg __setup handler ASoC: mxs-saif: Handle errors for clk_enable ASoC: atmel_ssc_dai: Handle errors for clk_enable memory: emif: Add check for setup_interrupts memory: emif: check the pointer temp in get_device_details() ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction ASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe ASoC: wm8350: Handle error for wm8350_register_irq ASoC: fsi: Add check for clk_enable video: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of ASoC: dmaengine: do not use a NULL prepare_slave_config() callback ASoC: mxs: Fix error handling in mxs_sgtl5000_probe ASoC: imx-es8328: Fix error return code in imx_es8328_probe() mtd: onenand: Check for error irq drm/edid: Don't clear formats if using deep color ath9k_htc: fix uninit value bugs ray_cs: Check ioremap return value power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init HID: i2c-hid: fix GET/SET_REPORT for unnumbered reports iwlwifi: Fix -EIO error code that is never returned scsi: pm8001: Fix command initialization in pm80XX_send_read_log() scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req() scsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config() scsi: pm8001: Fix abort all task initialization TOMOYO: fix __setup handlers return values ext2: correct max file size computing drm/tegra: Fix reference leak in tegra_dsi_ganged_probe KVM: x86: Fix emulation in writing cr8 KVM: x86/emulator: Defer not-present segment check in __load_segment_descriptor() i2c: xiic: Make bus names unique power: supply: wm8350-power: Handle error for wm8350_register_irq power: supply: wm8350-power: Add missing free in free_charger_irq powerpc/sysdev: fix incorrect use to determine if list is empty mfd: mc13xxx: Add check for mc13xxx_irq_request MIPS: RB532: fix return value of __setup handler USB: storage: ums-realtek: fix error code in rts51x_read_mem() af_netlink: Fix shift out of bounds in group mask calculation i2c: mux: demux-pinctrl: do not deactivate a master that is not active mfd: asic3: Add missing iounmap() on error asic3_mfd_probe mxser: fix xmit_buf leak in activate when LSR == 0xff pwm: lpc18xx-sct: Initialize driver data and hardware before pwmchip_add() iio: adc: Add check for devm_request_threaded_irq clk: qcom: clk-rcg2: Update the frac table for pixel clock remoteproc: qcom_wcnss: Add missing of_node_put() in wcnss_alloc_memory_region clk: loongson1: Terminate clk_div_table with sentinel element clk: clps711x: Terminate clk_div_table with sentinel element clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver NFS: remove unneeded check in decode_devicenotify_args() pinctrl: mediatek: Fix missing of_node_put() in mtk_pctrl_init pinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe pinctrl/rockchip: Add missing of_node_put() in rockchip_pinctrl_probe tty: hvc: fix return value of __setup handler kgdboc: fix return value of __setup handler kgdbts: fix return value of __setup handler jfs: fix divide error in dbNextAG netfilter: nf_conntrack_tcp: preserve liberal flag in tcp options net: phy: broadcom: Fix brcm_fet_config_init() qlcnic: dcb: default to returning -EOPNOTSUPP net/x25: Fix null-ptr-deref caused by x25_disconnect selinux: use correct type for context length loop: use sysfs_emit() in the sysfs xxx show() Fix incorrect type in assignment of ipv6 port for audit irqchip/nvic: Release nvic_base upon failure ACPICA: Avoid walking the ACPI Namespace if it is not there ACPI/APEI: Limit printable size of BERT table data PM: core: keep irq flags in device_pm_check_callbacks() spi: tegra20: Use of_device_get_match_data() ext4: don't BUG if someone dirty pages without asking ext4 first ntfs: add sanity check on allocation size video: fbdev: nvidiafb: Use strscpy() to prevent buffer overflow video: fbdev: w100fb: Reset global state video: fbdev: cirrusfb: check pixclock to avoid divide by zero video: fbdev: omapfb: acx565akm: replace snprintf with sysfs_emit ARM: dts: qcom: fix gic_irq_domain_translate warnings for msm8960 ARM: dts: bcm2837: Add the missing L1/L2 cache information video: fbdev: omapfb: panel-dsi-cm: Use sysfs_emit() instead of snprintf() video: fbdev: omapfb: panel-tpo-td043mtea1: Use sysfs_emit() instead of snprintf() ASoC: soc-core: skip zero num_dai component in searching dai name media: cx88-mpeg: clear interrupt status register before streaming video ARM: tegra: tamonten: Fix I2C3 pad setting ARM: mmp: Fix failure to remove sram device video: fbdev: sm712fb: Fix crash in smtcfb_write() media: hdpvr: initialize dev->worker at hdpvr_register_videodev mmc: host: Return an error when ->enable_sdio_irq() ops is missing scsi: qla2xxx: Fix incorrect reporting of task management failure KVM: Prevent module exit until all VMs are freed ubifs: Add missing iput if do_tmpfile() failed in rename whiteout ubifs: setflags: Make dirtied_ino_d 8 bytes aligned gfs2: Make sure FITRIM minlen is rounded up to fs block size pinctrl: pinconf-generic: Print arguments for bias-pull-* ACPI: CPPC: Avoid out of bounds access when parsing _CPC data mm/mmap: return 1 from stack_guard_gap __setup() handler mm/memcontrol: return 1 from cgroup.memory __setup() handler ubi: fastmap: Return error code if memory allocation fails in add_aeb() ASoC: topology: Allow TLV control to be either read or write ARM: dts: spear1340: Update serial node properties ARM: dts: spear13xx: Update SPI dma properties openvswitch: Fixed nd target mask field in the flow dump. KVM: x86: Forbid VMM to set SYNIC/STIMER MSRs when SynIC wasn't activated rtc: wm8350: Handle error for wm8350_register_irq ARM: 9187/1: JIVE: fix return value of __setup handler KVM: x86/svm: Clear reserved bits written to PerfEvtSeln MSRs ath5k: fix OOB in ath5k_eeprom_read_pcal_info_5111 ptp: replace snprintf with sysfs_emit powerpc: dts: t104xrdb: fix phy type for FMAN 4/5 scsi: mvsas: Replace snprintf() with sysfs_emit() scsi: bfa: Replace snprintf() with sysfs_emit() iommu/arm-smmu-v3: fix event handling soft lockup dm ioctl: prevent potential spectre v1 gadget scsi: pm8001: Fix pm8001_mpi_task_abort_resp() scsi: aha152x: Fix aha152x_setup() __setup handler return value bnxt_en: Eliminate unintended link toggle during FW reset MIPS: fix fortify panic when copying asm exception handlers scsi: libfc: Fix use after free in fc_exch_abts_resp() usb: dwc3: omap: fix "unbalanced disables for smps10_out1" on omap5evm xtensa: fix DTC warning unit_address_format Bluetooth: Fix use after free in hci_send_acl init/main.c: return 1 from handled __setup() functions w1: w1_therm: fixes w1_seq for ds28ea00 sensors SUNRPC/call_alloc: async tasks mustn't block waiting for memory serial: samsung_tty: do not unlock port->lock for uart_write_wakeup() virtio_console: eliminate anonymous module_init & module_exit jfs: prevent NULL deref in diFree mm: fix race between MADV_FREE reclaim and blkdev direct IO read scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one() net: stmmac: Fix unset max_speed difference between DT and non-DT platforms drm/imx: Fix memory leak in imx_pd_connector_get_modes drbd: Fix five use after free bugs in get_initial_state mmmremap.c: avoid pointless invalidate_range_start/end on mremap(old_size=0) mm/mempolicy: fix mpol_new leak in shared_policy_replace x86/pm: Save the MSR validity status at context setup x86/speculation: Restore speculation related MSRs during S3 resume arm64: patch_text: Fixup last cpu should be master tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts dmaengine: Revert "dmaengine: shdma: Fix runtime PM imbalance on error" mm: don't skip swap entry even if zap_details specified arm64: module: remove (NOLOAD) from linker script xfrm: policy: match with both mark and mask on user interfaces veth: Ensure eth header is in skb's linear part net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link nfc: nci: add flush_workqueue to prevent uaf cifs: potential buffer overflow in handling symlinks drm/amdkfd: Check for potential null return of kmalloc_array() scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024 net: micrel: fix KS8851_MLL Kconfig gpu: ipu-v3: Fix dev_dbg frequency output scsi: mvsas: Add PCI ID of RocketRaid 2640 drivers: net: slip: fix NPD bug in sl_tx_timeout() mm, page_alloc: fix build_zonerefs_node() mm: kmemleak: take a full lowmem check in kmemleak_*_phys() ALSA: pcm: Test for "silence" field in struct "pcm_format_data" ARM: davinci: da850-evm: Avoid NULL pointer dereference smp: Fix offline cpu check in flush_smp_call_function_queue() i2c: pasemi: Wait for write xfers to finish gcc-plugins: latent_entropy: use /dev/urandom Linux 4.9.311 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ia8f55c5ae2f0eb71b0893d8271a10dfd3c78b3b8
805 lines
22 KiB
C
805 lines
22 KiB
C
/*
|
|
* Process version 2 NFS requests.
|
|
*
|
|
* Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
|
|
*/
|
|
|
|
#include <linux/namei.h>
|
|
|
|
#include "cache.h"
|
|
#include "xdr.h"
|
|
#include "vfs.h"
|
|
|
|
typedef struct svc_rqst svc_rqst;
|
|
typedef struct svc_buf svc_buf;
|
|
|
|
#define NFSDDBG_FACILITY NFSDDBG_PROC
|
|
|
|
|
|
static __be32
|
|
nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
|
|
{
|
|
return nfs_ok;
|
|
}
|
|
|
|
static __be32
|
|
nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
|
|
{
|
|
if (err) return err;
|
|
return fh_getattr(&resp->fh, &resp->stat);
|
|
}
|
|
static __be32
|
|
nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
|
|
{
|
|
if (err) return err;
|
|
return fh_getattr(&resp->fh, &resp->stat);
|
|
}
|
|
/*
|
|
* Get a file's attributes
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
|
|
struct nfsd_attrstat *resp)
|
|
{
|
|
__be32 nfserr;
|
|
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
nfserr = fh_verify(rqstp, &resp->fh, 0,
|
|
NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
|
|
return nfsd_return_attrs(nfserr, resp);
|
|
}
|
|
|
|
/*
|
|
* Set a file's attributes
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
|
|
struct nfsd_attrstat *resp)
|
|
{
|
|
struct iattr *iap = &argp->attrs;
|
|
struct svc_fh *fhp;
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n",
|
|
SVCFH_fmt(&argp->fh),
|
|
argp->attrs.ia_valid, (long) argp->attrs.ia_size);
|
|
|
|
fhp = fh_copy(&resp->fh, &argp->fh);
|
|
|
|
/*
|
|
* NFSv2 does not differentiate between "set-[ac]time-to-now"
|
|
* which only requires access, and "set-[ac]time-to-X" which
|
|
* requires ownership.
|
|
* So if it looks like it might be "set both to the same time which
|
|
* is close to now", and if setattr_prepare fails, then we
|
|
* convert to "set to now" instead of "set to explicit time"
|
|
*
|
|
* We only call setattr_prepare as the last test as technically
|
|
* it is not an interface that we should be using.
|
|
*/
|
|
#define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
|
|
#define MAX_TOUCH_TIME_ERROR (30*60)
|
|
if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET &&
|
|
iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) {
|
|
/*
|
|
* Looks probable.
|
|
*
|
|
* Now just make sure time is in the right ballpark.
|
|
* Solaris, at least, doesn't seem to care what the time
|
|
* request is. We require it be within 30 minutes of now.
|
|
*/
|
|
time_t delta = iap->ia_atime.tv_sec - get_seconds();
|
|
|
|
nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP);
|
|
if (nfserr)
|
|
goto done;
|
|
|
|
if (delta < 0)
|
|
delta = -delta;
|
|
if (delta < MAX_TOUCH_TIME_ERROR &&
|
|
setattr_prepare(fhp->fh_dentry, iap) != 0) {
|
|
/*
|
|
* Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME.
|
|
* This will cause notify_change to set these times
|
|
* to "now"
|
|
*/
|
|
iap->ia_valid &= ~BOTH_TIME_SET;
|
|
}
|
|
}
|
|
|
|
nfserr = nfsd_setattr(rqstp, fhp, iap, 0, (time_t)0);
|
|
done:
|
|
return nfsd_return_attrs(nfserr, resp);
|
|
}
|
|
|
|
/*
|
|
* Look up a path name component
|
|
* Note: the dentry in the resp->fh may be negative if the file
|
|
* doesn't exist yet.
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
|
|
struct nfsd_diropres *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: LOOKUP %s %.*s\n",
|
|
SVCFH_fmt(&argp->fh), argp->len, argp->name);
|
|
|
|
fh_init(&resp->fh, NFS_FHSIZE);
|
|
nfserr = nfsd_lookup(rqstp, &argp->fh, argp->name, argp->len,
|
|
&resp->fh);
|
|
|
|
fh_put(&argp->fh);
|
|
return nfsd_return_dirop(nfserr, resp);
|
|
}
|
|
|
|
/*
|
|
* Read a symlink.
|
|
*/
|
|
static __be32
|
|
nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
|
|
struct nfsd_readlinkres *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
/* Read the symlink. */
|
|
resp->len = NFS_MAXPATHLEN;
|
|
nfserr = nfsd_readlink(rqstp, &argp->fh, argp->buffer, &resp->len);
|
|
|
|
fh_put(&argp->fh);
|
|
return nfserr;
|
|
}
|
|
|
|
/*
|
|
* Read a portion of a file.
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
|
|
struct nfsd_readres *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: READ %s %d bytes at %d\n",
|
|
SVCFH_fmt(&argp->fh),
|
|
argp->count, argp->offset);
|
|
|
|
/* Obtain buffer pointer for payload. 19 is 1 word for
|
|
* status, 17 words for fattr, and 1 word for the byte count.
|
|
*/
|
|
|
|
if (NFSSVC_MAXBLKSIZE_V2 < argp->count) {
|
|
char buf[RPC_MAX_ADDRBUFLEN];
|
|
printk(KERN_NOTICE
|
|
"oversized read request from %s (%d bytes)\n",
|
|
svc_print_addr(rqstp, buf, sizeof(buf)),
|
|
argp->count);
|
|
argp->count = NFSSVC_MAXBLKSIZE_V2;
|
|
}
|
|
svc_reserve_auth(rqstp, (19<<2) + argp->count + 4);
|
|
|
|
resp->count = argp->count;
|
|
nfserr = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh),
|
|
argp->offset,
|
|
rqstp->rq_vec, argp->vlen,
|
|
&resp->count);
|
|
|
|
if (nfserr) return nfserr;
|
|
return fh_getattr(&resp->fh, &resp->stat);
|
|
}
|
|
|
|
/*
|
|
* Write data to a file
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
|
|
struct nfsd_attrstat *resp)
|
|
{
|
|
__be32 nfserr;
|
|
int stable = 1;
|
|
unsigned long cnt = argp->len;
|
|
|
|
dprintk("nfsd: WRITE %s %u bytes at %d\n",
|
|
SVCFH_fmt(&argp->fh),
|
|
argp->len, argp->offset);
|
|
|
|
nfserr = nfsd_write(rqstp, fh_copy(&resp->fh, &argp->fh), NULL,
|
|
argp->offset,
|
|
rqstp->rq_vec, argp->vlen,
|
|
&cnt,
|
|
&stable);
|
|
return nfsd_return_attrs(nfserr, resp);
|
|
}
|
|
|
|
/*
|
|
* CREATE processing is complicated. The keyword here is `overloaded.'
|
|
* The parent directory is kept locked between the check for existence
|
|
* and the actual create() call in compliance with VFS protocols.
|
|
* N.B. After this call _both_ argp->fh and resp->fh need an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
|
|
struct nfsd_diropres *resp)
|
|
{
|
|
svc_fh *dirfhp = &argp->fh;
|
|
svc_fh *newfhp = &resp->fh;
|
|
struct iattr *attr = &argp->attrs;
|
|
struct inode *inode;
|
|
struct dentry *dchild;
|
|
int type, mode;
|
|
__be32 nfserr;
|
|
int hosterr;
|
|
dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size);
|
|
|
|
dprintk("nfsd: CREATE %s %.*s\n",
|
|
SVCFH_fmt(dirfhp), argp->len, argp->name);
|
|
|
|
/* First verify the parent file handle */
|
|
nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_EXEC);
|
|
if (nfserr)
|
|
goto done; /* must fh_put dirfhp even on error */
|
|
|
|
/* Check for NFSD_MAY_WRITE in nfsd_create if necessary */
|
|
|
|
nfserr = nfserr_exist;
|
|
if (isdotent(argp->name, argp->len))
|
|
goto done;
|
|
hosterr = fh_want_write(dirfhp);
|
|
if (hosterr) {
|
|
nfserr = nfserrno(hosterr);
|
|
goto done;
|
|
}
|
|
|
|
fh_lock_nested(dirfhp, I_MUTEX_PARENT);
|
|
dchild = lookup_one_len(argp->name, dirfhp->fh_dentry, argp->len);
|
|
if (IS_ERR(dchild)) {
|
|
nfserr = nfserrno(PTR_ERR(dchild));
|
|
goto out_unlock;
|
|
}
|
|
fh_init(newfhp, NFS_FHSIZE);
|
|
nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp);
|
|
if (!nfserr && d_really_is_negative(dchild))
|
|
nfserr = nfserr_noent;
|
|
dput(dchild);
|
|
if (nfserr) {
|
|
if (nfserr != nfserr_noent)
|
|
goto out_unlock;
|
|
/*
|
|
* If the new file handle wasn't verified, we can't tell
|
|
* whether the file exists or not. Time to bail ...
|
|
*/
|
|
nfserr = nfserr_acces;
|
|
if (!newfhp->fh_dentry) {
|
|
printk(KERN_WARNING
|
|
"nfsd_proc_create: file handle not verified\n");
|
|
goto out_unlock;
|
|
}
|
|
}
|
|
|
|
inode = d_inode(newfhp->fh_dentry);
|
|
|
|
/* Unfudge the mode bits */
|
|
if (attr->ia_valid & ATTR_MODE) {
|
|
type = attr->ia_mode & S_IFMT;
|
|
mode = attr->ia_mode & ~S_IFMT;
|
|
if (!type) {
|
|
/* no type, so if target exists, assume same as that,
|
|
* else assume a file */
|
|
if (inode) {
|
|
type = inode->i_mode & S_IFMT;
|
|
switch(type) {
|
|
case S_IFCHR:
|
|
case S_IFBLK:
|
|
/* reserve rdev for later checking */
|
|
rdev = inode->i_rdev;
|
|
attr->ia_valid |= ATTR_SIZE;
|
|
|
|
/* FALLTHROUGH */
|
|
case S_IFIFO:
|
|
/* this is probably a permission check..
|
|
* at least IRIX implements perm checking on
|
|
* echo thing > device-special-file-or-pipe
|
|
* by doing a CREATE with type==0
|
|
*/
|
|
nfserr = nfsd_permission(rqstp,
|
|
newfhp->fh_export,
|
|
newfhp->fh_dentry,
|
|
NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS);
|
|
if (nfserr && nfserr != nfserr_rofs)
|
|
goto out_unlock;
|
|
}
|
|
} else
|
|
type = S_IFREG;
|
|
}
|
|
} else if (inode) {
|
|
type = inode->i_mode & S_IFMT;
|
|
mode = inode->i_mode & ~S_IFMT;
|
|
} else {
|
|
type = S_IFREG;
|
|
mode = 0; /* ??? */
|
|
}
|
|
|
|
attr->ia_valid |= ATTR_MODE;
|
|
attr->ia_mode = mode;
|
|
|
|
/* Special treatment for non-regular files according to the
|
|
* gospel of sun micro
|
|
*/
|
|
if (type != S_IFREG) {
|
|
if (type != S_IFBLK && type != S_IFCHR) {
|
|
rdev = 0;
|
|
} else if (type == S_IFCHR && !(attr->ia_valid & ATTR_SIZE)) {
|
|
/* If you think you've seen the worst, grok this. */
|
|
type = S_IFIFO;
|
|
} else {
|
|
/* Okay, char or block special */
|
|
if (!rdev)
|
|
rdev = wanted;
|
|
}
|
|
|
|
/* we've used the SIZE information, so discard it */
|
|
attr->ia_valid &= ~ATTR_SIZE;
|
|
|
|
/* Make sure the type and device matches */
|
|
nfserr = nfserr_exist;
|
|
if (inode && type != (inode->i_mode & S_IFMT))
|
|
goto out_unlock;
|
|
}
|
|
|
|
nfserr = 0;
|
|
if (!inode) {
|
|
/* File doesn't exist. Create it and set attrs */
|
|
nfserr = nfsd_create_locked(rqstp, dirfhp, argp->name,
|
|
argp->len, attr, type, rdev, newfhp);
|
|
} else if (type == S_IFREG) {
|
|
dprintk("nfsd: existing %s, valid=%x, size=%ld\n",
|
|
argp->name, attr->ia_valid, (long) attr->ia_size);
|
|
/* File already exists. We ignore all attributes except
|
|
* size, so that creat() behaves exactly like
|
|
* open(..., O_CREAT|O_TRUNC|O_WRONLY).
|
|
*/
|
|
attr->ia_valid &= ATTR_SIZE;
|
|
if (attr->ia_valid)
|
|
nfserr = nfsd_setattr(rqstp, newfhp, attr, 0, (time_t)0);
|
|
}
|
|
|
|
out_unlock:
|
|
/* We don't really need to unlock, as fh_put does it. */
|
|
fh_unlock(dirfhp);
|
|
fh_drop_write(dirfhp);
|
|
done:
|
|
fh_put(dirfhp);
|
|
return nfsd_return_dirop(nfserr, resp);
|
|
}
|
|
|
|
static __be32
|
|
nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
|
|
void *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh),
|
|
argp->len, argp->name);
|
|
|
|
/* Unlink. -SIFDIR means file must not be a directory */
|
|
nfserr = nfsd_unlink(rqstp, &argp->fh, -S_IFDIR, argp->name, argp->len);
|
|
fh_put(&argp->fh);
|
|
return nfserr;
|
|
}
|
|
|
|
static __be32
|
|
nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
|
|
void *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: RENAME %s %.*s -> \n",
|
|
SVCFH_fmt(&argp->ffh), argp->flen, argp->fname);
|
|
dprintk("nfsd: -> %s %.*s\n",
|
|
SVCFH_fmt(&argp->tfh), argp->tlen, argp->tname);
|
|
|
|
nfserr = nfsd_rename(rqstp, &argp->ffh, argp->fname, argp->flen,
|
|
&argp->tfh, argp->tname, argp->tlen);
|
|
fh_put(&argp->ffh);
|
|
fh_put(&argp->tfh);
|
|
return nfserr;
|
|
}
|
|
|
|
static __be32
|
|
nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
|
|
void *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: LINK %s ->\n",
|
|
SVCFH_fmt(&argp->ffh));
|
|
dprintk("nfsd: %s %.*s\n",
|
|
SVCFH_fmt(&argp->tfh),
|
|
argp->tlen,
|
|
argp->tname);
|
|
|
|
nfserr = nfsd_link(rqstp, &argp->tfh, argp->tname, argp->tlen,
|
|
&argp->ffh);
|
|
fh_put(&argp->ffh);
|
|
fh_put(&argp->tfh);
|
|
return nfserr;
|
|
}
|
|
|
|
static __be32
|
|
nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
|
|
void *resp)
|
|
{
|
|
struct svc_fh newfh;
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n",
|
|
SVCFH_fmt(&argp->ffh), argp->flen, argp->fname,
|
|
argp->tlen, argp->tname);
|
|
|
|
fh_init(&newfh, NFS_FHSIZE);
|
|
/*
|
|
* Crazy hack: the request fits in a page, and already-decoded
|
|
* attributes follow argp->tname, so it's safe to just write a
|
|
* null to ensure it's null-terminated:
|
|
*/
|
|
argp->tname[argp->tlen] = '\0';
|
|
nfserr = nfsd_symlink(rqstp, &argp->ffh, argp->fname, argp->flen,
|
|
argp->tname, &newfh);
|
|
|
|
fh_put(&argp->ffh);
|
|
fh_put(&newfh);
|
|
return nfserr;
|
|
}
|
|
|
|
/*
|
|
* Make directory. This operation is not idempotent.
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
*/
|
|
static __be32
|
|
nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
|
|
struct nfsd_diropres *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
|
|
|
|
if (resp->fh.fh_dentry) {
|
|
printk(KERN_WARNING
|
|
"nfsd_proc_mkdir: response already verified??\n");
|
|
}
|
|
|
|
argp->attrs.ia_valid &= ~ATTR_SIZE;
|
|
fh_init(&resp->fh, NFS_FHSIZE);
|
|
nfserr = nfsd_create(rqstp, &argp->fh, argp->name, argp->len,
|
|
&argp->attrs, S_IFDIR, 0, &resp->fh);
|
|
fh_put(&argp->fh);
|
|
return nfsd_return_dirop(nfserr, resp);
|
|
}
|
|
|
|
/*
|
|
* Remove a directory
|
|
*/
|
|
static __be32
|
|
nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
|
|
void *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
|
|
|
|
nfserr = nfsd_unlink(rqstp, &argp->fh, S_IFDIR, argp->name, argp->len);
|
|
fh_put(&argp->fh);
|
|
return nfserr;
|
|
}
|
|
|
|
/*
|
|
* Read a portion of a directory.
|
|
*/
|
|
static __be32
|
|
nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
|
|
struct nfsd_readdirres *resp)
|
|
{
|
|
int count;
|
|
__be32 nfserr;
|
|
loff_t offset;
|
|
|
|
dprintk("nfsd: READDIR %s %d bytes at %d\n",
|
|
SVCFH_fmt(&argp->fh),
|
|
argp->count, argp->cookie);
|
|
|
|
/* Shrink to the client read size */
|
|
count = (argp->count >> 2) - 2;
|
|
|
|
/* Make sure we've room for the NULL ptr & eof flag */
|
|
count -= 2;
|
|
if (count < 0)
|
|
count = 0;
|
|
|
|
resp->buffer = argp->buffer;
|
|
resp->offset = NULL;
|
|
resp->buflen = count;
|
|
resp->common.err = nfs_ok;
|
|
/* Read directory and encode entries on the fly */
|
|
offset = argp->cookie;
|
|
nfserr = nfsd_readdir(rqstp, &argp->fh, &offset,
|
|
&resp->common, nfssvc_encode_entry);
|
|
|
|
resp->count = resp->buffer - argp->buffer;
|
|
if (resp->offset)
|
|
*resp->offset = htonl(offset);
|
|
|
|
fh_put(&argp->fh);
|
|
return nfserr;
|
|
}
|
|
|
|
/*
|
|
* Get file system info
|
|
*/
|
|
static __be32
|
|
nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
|
|
struct nfsd_statfsres *resp)
|
|
{
|
|
__be32 nfserr;
|
|
|
|
dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats,
|
|
NFSD_MAY_BYPASS_GSS_ON_ROOT);
|
|
fh_put(&argp->fh);
|
|
return nfserr;
|
|
}
|
|
|
|
/*
|
|
* NFSv2 Server procedures.
|
|
* Only the results of non-idempotent operations are cached.
|
|
*/
|
|
struct nfsd_void { int dummy; };
|
|
|
|
#define ST 1 /* status */
|
|
#define FH 8 /* filehandle */
|
|
#define AT 18 /* attributes */
|
|
|
|
static struct svc_procedure nfsd_procedures2[18] = {
|
|
[NFSPROC_NULL] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_null,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_void,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_void),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_GETATTR] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_getattr,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_fhandle,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_attrstat,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST+AT,
|
|
},
|
|
[NFSPROC_SETATTR] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_setattr,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_sattrargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_attrstat,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_sattrargs),
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
.pc_xdrressize = ST+AT,
|
|
},
|
|
[NFSPROC_ROOT] = {
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_void,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_void),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_LOOKUP] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_lookup,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_diropargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_diropres,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST+FH+AT,
|
|
},
|
|
[NFSPROC_READLINK] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_readlink,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_readlinkargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_readlinkres,
|
|
.pc_argsize = sizeof(struct nfsd_readlinkargs),
|
|
.pc_ressize = sizeof(struct nfsd_readlinkres),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST+1+NFS_MAXPATHLEN/4,
|
|
},
|
|
[NFSPROC_READ] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_read,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_readargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_readres,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_readargs),
|
|
.pc_ressize = sizeof(struct nfsd_readres),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
|
|
},
|
|
[NFSPROC_WRITECACHE] = {
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_void,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_void),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_WRITE] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_write,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_writeargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_attrstat,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_writeargs),
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
.pc_xdrressize = ST+AT,
|
|
},
|
|
[NFSPROC_CREATE] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_create,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_createargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_diropres,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_createargs),
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
.pc_xdrressize = ST+FH+AT,
|
|
},
|
|
[NFSPROC_REMOVE] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_remove,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_diropargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_RENAME] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_rename,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_renameargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_renameargs),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_LINK] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_link,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_linkargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_linkargs),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_SYMLINK] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_symlink,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_symlinkargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_symlinkargs),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_MKDIR] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_mkdir,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_createargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_diropres,
|
|
.pc_release = (kxdrproc_t) nfssvc_release_fhandle,
|
|
.pc_argsize = sizeof(struct nfsd_createargs),
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
.pc_xdrressize = ST+FH+AT,
|
|
},
|
|
[NFSPROC_RMDIR] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_rmdir,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_diropargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_void,
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
|
.pc_ressize = sizeof(struct nfsd_void),
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
.pc_xdrressize = ST,
|
|
},
|
|
[NFSPROC_READDIR] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_readdir,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_readdirargs,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_readdirres,
|
|
.pc_argsize = sizeof(struct nfsd_readdirargs),
|
|
.pc_ressize = sizeof(struct nfsd_readdirres),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
},
|
|
[NFSPROC_STATFS] = {
|
|
.pc_func = (svc_procfunc) nfsd_proc_statfs,
|
|
.pc_decode = (kxdrproc_t) nfssvc_decode_fhandle,
|
|
.pc_encode = (kxdrproc_t) nfssvc_encode_statfsres,
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
|
.pc_ressize = sizeof(struct nfsd_statfsres),
|
|
.pc_cachetype = RC_NOCACHE,
|
|
.pc_xdrressize = ST+5,
|
|
},
|
|
};
|
|
|
|
|
|
struct svc_version nfsd_version2 = {
|
|
.vs_vers = 2,
|
|
.vs_nproc = 18,
|
|
.vs_proc = nfsd_procedures2,
|
|
.vs_dispatch = nfsd_dispatch,
|
|
.vs_xdrsize = NFS2_SVC_XDRSIZE,
|
|
};
|
|
|
|
/*
|
|
* Map errnos to NFS errnos.
|
|
*/
|
|
__be32
|
|
nfserrno (int errno)
|
|
{
|
|
static struct {
|
|
__be32 nfserr;
|
|
int syserr;
|
|
} nfs_errtbl[] = {
|
|
{ nfs_ok, 0 },
|
|
{ nfserr_perm, -EPERM },
|
|
{ nfserr_noent, -ENOENT },
|
|
{ nfserr_io, -EIO },
|
|
{ nfserr_nxio, -ENXIO },
|
|
{ nfserr_fbig, -E2BIG },
|
|
{ nfserr_acces, -EACCES },
|
|
{ nfserr_exist, -EEXIST },
|
|
{ nfserr_xdev, -EXDEV },
|
|
{ nfserr_mlink, -EMLINK },
|
|
{ nfserr_nodev, -ENODEV },
|
|
{ nfserr_notdir, -ENOTDIR },
|
|
{ nfserr_isdir, -EISDIR },
|
|
{ nfserr_inval, -EINVAL },
|
|
{ nfserr_fbig, -EFBIG },
|
|
{ nfserr_nospc, -ENOSPC },
|
|
{ nfserr_rofs, -EROFS },
|
|
{ nfserr_mlink, -EMLINK },
|
|
{ nfserr_nametoolong, -ENAMETOOLONG },
|
|
{ nfserr_notempty, -ENOTEMPTY },
|
|
#ifdef EDQUOT
|
|
{ nfserr_dquot, -EDQUOT },
|
|
#endif
|
|
{ nfserr_stale, -ESTALE },
|
|
{ nfserr_jukebox, -ETIMEDOUT },
|
|
{ nfserr_jukebox, -ERESTARTSYS },
|
|
{ nfserr_jukebox, -EAGAIN },
|
|
{ nfserr_jukebox, -EWOULDBLOCK },
|
|
{ nfserr_jukebox, -ENOMEM },
|
|
{ nfserr_io, -ETXTBSY },
|
|
{ nfserr_notsupp, -EOPNOTSUPP },
|
|
{ nfserr_toosmall, -ETOOSMALL },
|
|
{ nfserr_serverfault, -ESERVERFAULT },
|
|
{ nfserr_serverfault, -ENFILE },
|
|
{ nfserr_io, -EUCLEAN },
|
|
{ nfserr_perm, -ENOKEY },
|
|
};
|
|
int i;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
|
|
if (nfs_errtbl[i].syserr == errno)
|
|
return nfs_errtbl[i].nfserr;
|
|
}
|
|
WARN_ONCE(1, "nfsd: non-standard errno: %d\n", errno);
|
|
return nfserr_io;
|
|
}
|
|
|