License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 17:07:57 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Process version 2 NFS requests.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/namei.h>
|
|
|
|
|
2009-12-03 21:30:56 +03:00
|
|
|
#include "cache.h"
|
|
|
|
#include "xdr.h"
|
2009-11-05 02:12:35 +03:00
|
|
|
#include "vfs.h"
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#define NFSDDBG_FACILITY NFSDDBG_PROC
|
|
|
|
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_null(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a file's attributes
|
|
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_getattr(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_attrstat *resp = rqstp->rq_resp;
|
2020-10-02 01:59:49 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = fh_verify(rqstp, &resp->fh, 0,
|
|
|
|
NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
|
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set a file's attributes
|
|
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_setattr(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_sattrargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_attrstat *resp = rqstp->rq_resp;
|
2015-05-09 01:37:57 +03:00
|
|
|
struct iattr *iap = &argp->attrs;
|
2022-07-26 09:45:30 +03:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = iap,
|
|
|
|
};
|
2015-05-09 01:37:57 +03:00
|
|
|
struct svc_fh *fhp;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->attrs.ia_valid, (long) argp->attrs.ia_size);
|
|
|
|
|
2015-05-09 01:37:57 +03:00
|
|
|
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
|
2016-05-26 17:55:18 +03:00
|
|
|
* is close to now", and if setattr_prepare fails, then we
|
2015-05-09 01:37:57 +03:00
|
|
|
* convert to "set to now" instead of "set to explicit time"
|
|
|
|
*
|
2016-05-26 17:55:18 +03:00
|
|
|
* We only call setattr_prepare as the last test as technically
|
2015-05-09 01:37:57 +03:00
|
|
|
* 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.
|
|
|
|
*/
|
2019-11-03 20:06:52 +03:00
|
|
|
time64_t delta = iap->ia_atime.tv_sec - ktime_get_real_seconds();
|
2015-05-09 01:37:57 +03:00
|
|
|
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP);
|
|
|
|
if (resp->status != nfs_ok)
|
2020-10-02 22:52:44 +03:00
|
|
|
goto out;
|
2015-05-09 01:37:57 +03:00
|
|
|
|
|
|
|
if (delta < 0)
|
|
|
|
delta = -delta;
|
|
|
|
if (delta < MAX_TOUCH_TIME_ERROR &&
|
2021-01-21 16:19:26 +03:00
|
|
|
setattr_prepare(&init_user_ns, fhp->fh_dentry, iap) != 0) {
|
2015-05-09 01:37:57 +03:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-26 09:45:30 +03:00
|
|
|
resp->status = nfsd_setattr(rqstp, fhp, &attrs, 0, (time64_t)0);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2020-10-02 01:58:56 +03:00
|
|
|
/* Obsolete, replaced by MNTPROC_MNT. */
|
|
|
|
static __be32
|
|
|
|
nfsd_proc_root(struct svc_rqst *rqstp)
|
|
|
|
{
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2020-10-02 01:58:56 +03:00
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_lookup(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_diropargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_diropres *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: LOOKUP %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh), argp->len, argp->name);
|
|
|
|
|
|
|
|
fh_init(&resp->fh, NFS_FHSIZE);
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfsd_lookup(rqstp, &argp->fh, argp->name, argp->len,
|
|
|
|
&resp->fh);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a symlink.
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_readlink(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2020-10-21 19:21:25 +03:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_readlinkres *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
|
|
|
|
/* Read the symlink. */
|
|
|
|
resp->len = NFS_MAXPATHLEN;
|
2020-10-23 22:41:09 +03:00
|
|
|
resp->page = *(rqstp->rq_next_page++);
|
|
|
|
resp->status = nfsd_readlink(rqstp, &argp->fh,
|
|
|
|
page_address(resp->page), &resp->len);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
fh_put(&argp->fh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a portion of a file.
|
|
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_read(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_readargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_readres *resp = rqstp->rq_resp;
|
2020-10-21 19:15:51 +03:00
|
|
|
unsigned int len;
|
2019-08-26 20:03:11 +03:00
|
|
|
u32 eof;
|
2020-10-21 19:15:51 +03:00
|
|
|
int v;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: READ %s %d bytes at %d\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->count, argp->offset);
|
|
|
|
|
2020-10-21 19:15:51 +03:00
|
|
|
argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2);
|
2022-09-01 22:10:18 +03:00
|
|
|
argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
|
2020-10-21 19:15:51 +03:00
|
|
|
|
|
|
|
v = 0;
|
|
|
|
len = argp->count;
|
2020-10-23 23:40:11 +03:00
|
|
|
resp->pages = rqstp->rq_next_page;
|
2020-10-21 19:15:51 +03:00
|
|
|
while (len > 0) {
|
|
|
|
struct page *page = *(rqstp->rq_next_page++);
|
|
|
|
|
|
|
|
rqstp->rq_vec[v].iov_base = page_address(page);
|
|
|
|
rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
|
|
|
|
len -= rqstp->rq_vec[v].iov_len;
|
|
|
|
v++;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* Obtain buffer pointer for payload. 19 is 1 word for
|
|
|
|
* status, 17 words for fattr, and 1 word for the byte count.
|
|
|
|
*/
|
2007-05-09 13:34:50 +04:00
|
|
|
svc_reserve_auth(rqstp, (19<<2) + argp->count + 4);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
resp->count = argp->count;
|
2020-10-21 19:15:51 +03:00
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
|
|
|
|
rqstp->rq_vec, v, &resp->count, &eof);
|
2020-10-02 22:52:44 +03:00
|
|
|
if (resp->status == nfs_ok)
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
else if (resp->status == nfserr_jukebox)
|
|
|
|
return rpc_drop_reply;
|
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2020-10-02 01:58:56 +03:00
|
|
|
/* Reserved */
|
|
|
|
static __be32
|
|
|
|
nfsd_proc_writecache(struct svc_rqst *rqstp)
|
|
|
|
{
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2020-10-02 01:58:56 +03:00
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Write data to a file
|
|
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_write(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_writeargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_attrstat *resp = rqstp->rq_resp;
|
2009-03-06 04:16:14 +03:00
|
|
|
unsigned long cnt = argp->len;
|
2018-03-27 17:54:07 +03:00
|
|
|
unsigned int nvecs;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2022-03-15 13:30:09 +03:00
|
|
|
dprintk("nfsd: WRITE %s %u bytes at %d\n",
|
2005-04-17 02:20:36 +04:00
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len, argp->offset);
|
|
|
|
|
2021-10-01 00:06:21 +03:00
|
|
|
nvecs = svc_fill_write_vector(rqstp, &argp->payload);
|
2020-10-02 01:59:49 +03:00
|
|
|
|
|
|
|
resp->status = nfsd_write(rqstp, fh_copy(&resp->fh, &argp->fh),
|
|
|
|
argp->offset, rqstp->rq_vec, nvecs,
|
|
|
|
&cnt, NFS_DATA_SYNC, NULL);
|
2020-10-02 22:52:44 +03:00
|
|
|
if (resp->status == nfs_ok)
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
else if (resp->status == nfserr_jukebox)
|
|
|
|
return rpc_drop_reply;
|
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_create(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_createargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_diropres *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
svc_fh *dirfhp = &argp->fh;
|
|
|
|
svc_fh *newfhp = &resp->fh;
|
|
|
|
struct iattr *attr = &argp->attrs;
|
2022-07-26 09:45:30 +03:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = attr,
|
|
|
|
};
|
2005-04-17 02:20:36 +04:00
|
|
|
struct inode *inode;
|
|
|
|
struct dentry *dchild;
|
2006-10-20 10:29:00 +04:00
|
|
|
int type, mode;
|
2012-06-12 18:20:33 +04:00
|
|
|
int hosterr;
|
2005-04-17 02:20:36 +04:00
|
|
|
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 */
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_EXEC);
|
|
|
|
if (resp->status != nfs_ok)
|
2005-04-17 02:20:36 +04:00
|
|
|
goto done; /* must fh_put dirfhp even on error */
|
|
|
|
|
2008-06-16 15:20:29 +04:00
|
|
|
/* Check for NFSD_MAY_WRITE in nfsd_create if necessary */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfserr_exist;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (isdotent(argp->name, argp->len))
|
|
|
|
goto done;
|
2012-06-12 18:20:33 +04:00
|
|
|
hosterr = fh_want_write(dirfhp);
|
|
|
|
if (hosterr) {
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfserrno(hosterr);
|
2012-06-12 18:20:33 +04:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2022-07-26 09:45:30 +03:00
|
|
|
inode_lock_nested(dirfhp->fh_dentry->d_inode, I_MUTEX_PARENT);
|
2005-04-17 02:20:36 +04:00
|
|
|
dchild = lookup_one_len(argp->name, dirfhp->fh_dentry, argp->len);
|
|
|
|
if (IS_ERR(dchild)) {
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfserrno(PTR_ERR(dchild));
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
fh_init(newfhp, NFS_FHSIZE);
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp);
|
|
|
|
if (!resp->status && d_really_is_negative(dchild))
|
|
|
|
resp->status = nfserr_noent;
|
2005-04-17 02:20:36 +04:00
|
|
|
dput(dchild);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status) {
|
|
|
|
if (resp->status != nfserr_noent)
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out_unlock;
|
|
|
|
/*
|
|
|
|
* If the new file handle wasn't verified, we can't tell
|
|
|
|
* whether the file exists or not. Time to bail ...
|
|
|
|
*/
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfserr_acces;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (!newfhp->fh_dentry) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"nfsd_proc_create: file handle not verified\n");
|
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 01:25:59 +03:00
|
|
|
inode = d_inode(newfhp->fh_dentry);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2005-04-17 02:20:36 +04:00
|
|
|
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
|
|
|
|
*/
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfsd_permission(rqstp,
|
2007-07-17 15:04:48 +04:00
|
|
|
newfhp->fh_export,
|
2005-04-17 02:20:36 +04:00
|
|
|
newfhp->fh_dentry,
|
2008-06-16 15:20:29 +04:00
|
|
|
NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status && resp->status != nfserr_rofs)
|
2005-04-17 02:20:36 +04:00
|
|
|
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 */
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfserr_exist;
|
2021-03-02 04:37:10 +03:00
|
|
|
if (inode && inode_wrong_type(inode, type))
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfs_ok;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (!inode) {
|
|
|
|
/* File doesn't exist. Create it and set attrs */
|
2022-09-06 03:42:19 +03:00
|
|
|
resp->status = nfsd_create_locked(rqstp, dirfhp, &attrs, type,
|
|
|
|
rdev, newfhp);
|
2005-04-17 02:20:36 +04:00
|
|
|
} 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)
|
2022-07-26 09:45:30 +03:00
|
|
|
resp->status = nfsd_setattr(rqstp, newfhp, &attrs, 0,
|
2020-10-02 01:59:49 +03:00
|
|
|
(time64_t)0);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
out_unlock:
|
2022-07-26 09:45:30 +03:00
|
|
|
inode_unlock(dirfhp->fh_dentry->d_inode);
|
2012-06-12 18:20:33 +04:00
|
|
|
fh_drop_write(dirfhp);
|
2005-04-17 02:20:36 +04:00
|
|
|
done:
|
|
|
|
fh_put(dirfhp);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_remove(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_diropargs *argp = rqstp->rq_argp;
|
2020-10-02 22:52:44 +03:00
|
|
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len, argp->name);
|
|
|
|
|
|
|
|
/* Unlink. -SIFDIR means file must not be a directory */
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfsd_unlink(rqstp, &argp->fh, -S_IFDIR,
|
|
|
|
argp->name, argp->len);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_rename(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_renameargs *argp = rqstp->rq_argp;
|
2020-10-02 22:52:44 +03:00
|
|
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfsd_rename(rqstp, &argp->ffh, argp->fname, argp->flen,
|
|
|
|
&argp->tfh, argp->tname, argp->tlen);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->ffh);
|
|
|
|
fh_put(&argp->tfh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_link(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_linkargs *argp = rqstp->rq_argp;
|
2020-10-02 22:52:44 +03:00
|
|
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: LINK %s ->\n",
|
|
|
|
SVCFH_fmt(&argp->ffh));
|
|
|
|
dprintk("nfsd: %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->tfh),
|
|
|
|
argp->tlen,
|
|
|
|
argp->tname);
|
|
|
|
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfsd_link(rqstp, &argp->tfh, argp->tname, argp->tlen,
|
|
|
|
&argp->ffh);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->ffh);
|
|
|
|
fh_put(&argp->tfh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_symlink(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_symlinkargs *argp = rqstp->rq_argp;
|
2020-10-02 22:52:44 +03:00
|
|
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
2022-07-26 09:45:30 +03:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2005-04-17 02:20:36 +04:00
|
|
|
struct svc_fh newfh;
|
|
|
|
|
2020-10-02 01:59:49 +03:00
|
|
|
if (argp->tlen > NFS_MAXPATHLEN) {
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfserr_nametoolong;
|
2020-10-02 01:59:49 +03:00
|
|
|
goto out;
|
|
|
|
}
|
2018-03-27 17:54:21 +03:00
|
|
|
|
|
|
|
argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
|
2018-07-27 18:19:10 +03:00
|
|
|
page_address(rqstp->rq_arg.pages[0]),
|
2018-03-27 17:54:21 +03:00
|
|
|
argp->tlen);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (IS_ERR(argp->tname)) {
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfserrno(PTR_ERR(argp->tname));
|
2020-10-02 01:59:49 +03:00
|
|
|
goto out;
|
|
|
|
}
|
2018-03-27 17:54:21 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->ffh), argp->flen, argp->fname,
|
|
|
|
argp->tlen, argp->tname);
|
|
|
|
|
|
|
|
fh_init(&newfh, NFS_FHSIZE);
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfsd_symlink(rqstp, &argp->ffh, argp->fname, argp->flen,
|
2022-07-26 09:45:30 +03:00
|
|
|
argp->tname, &attrs, &newfh);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2018-07-27 18:19:10 +03:00
|
|
|
kfree(argp->tname);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->ffh);
|
|
|
|
fh_put(&newfh);
|
2020-10-02 01:59:49 +03:00
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make directory. This operation is not idempotent.
|
|
|
|
* N.B. After this call resp->fh needs an fh_put
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_mkdir(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_createargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_diropres *resp = rqstp->rq_resp;
|
2022-07-26 09:45:30 +03:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
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);
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfsd_create(rqstp, &argp->fh, argp->name, argp->len,
|
2022-07-26 09:45:30 +03:00
|
|
|
&attrs, S_IFDIR, 0, &resp->fh);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 01:59:49 +03:00
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
resp->status = fh_getattr(&resp->fh, &resp->stat);
|
|
|
|
out:
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove a directory
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_rmdir(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_diropargs *argp = rqstp->rq_argp;
|
2020-10-02 22:52:44 +03:00
|
|
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
|
|
|
|
|
2020-10-02 22:52:44 +03:00
|
|
|
resp->status = nfsd_unlink(rqstp, &argp->fh, S_IFDIR,
|
|
|
|
argp->name, argp->len);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2020-11-14 01:03:49 +03:00
|
|
|
static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp,
|
|
|
|
struct nfsd_readdirres *resp,
|
2021-12-16 19:12:11 +03:00
|
|
|
u32 count)
|
2020-11-14 01:03:49 +03:00
|
|
|
{
|
2020-11-14 21:45:35 +03:00
|
|
|
struct xdr_buf *buf = &resp->dirlist;
|
|
|
|
struct xdr_stream *xdr = &resp->xdr;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(*buf));
|
2020-11-14 01:03:49 +03:00
|
|
|
|
2020-11-14 21:45:35 +03:00
|
|
|
/* Reserve room for the NULL ptr & eof flag (-2 words) */
|
2022-09-01 22:10:05 +03:00
|
|
|
buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), (u32)PAGE_SIZE);
|
|
|
|
buf->buflen -= XDR_UNIT * 2;
|
2020-11-14 21:45:35 +03:00
|
|
|
buf->pages = rqstp->rq_next_page;
|
2020-11-14 01:03:49 +03:00
|
|
|
rqstp->rq_next_page++;
|
2020-11-14 21:45:35 +03:00
|
|
|
|
2022-09-13 00:22:56 +03:00
|
|
|
xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
|
2020-11-14 01:03:49 +03:00
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Read a portion of a directory.
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_readdir(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_readdirargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_readdirres *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
loff_t offset;
|
|
|
|
|
|
|
|
dprintk("nfsd: READDIR %s %d bytes at %d\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->count, argp->cookie);
|
|
|
|
|
2020-11-14 01:03:49 +03:00
|
|
|
nfsd_init_dirlist_pages(rqstp, resp, argp->count);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
resp->common.err = nfs_ok;
|
2020-11-14 21:45:35 +03:00
|
|
|
resp->cookie_offset = 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
offset = argp->cookie;
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfsd_readdir(rqstp, &argp->fh, &offset,
|
2020-11-15 22:30:13 +03:00
|
|
|
&resp->common, nfssvc_encode_entry);
|
2020-11-14 00:53:17 +03:00
|
|
|
nfssvc_encode_nfscookie(resp, offset);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
fh_put(&argp->fh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get file system info
|
|
|
|
*/
|
2006-10-20 10:28:45 +04:00
|
|
|
static __be32
|
2017-05-08 18:35:49 +03:00
|
|
|
nfsd_proc_statfs(struct svc_rqst *rqstp)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2017-05-08 18:35:49 +03:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd_statfsres *resp = rqstp->rq_resp;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
|
2020-10-02 01:59:49 +03:00
|
|
|
resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats,
|
|
|
|
NFSD_MAY_BYPASS_GSS_ON_ROOT);
|
2005-04-17 02:20:36 +04:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 22:52:44 +03:00
|
|
|
return rpc_success;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NFSv2 Server procedures.
|
|
|
|
* Only the results of non-idempotent operations are cached.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ST 1 /* status */
|
|
|
|
#define FH 8 /* filehandle */
|
|
|
|
#define AT 18 /* attributes */
|
|
|
|
|
2017-05-12 17:11:49 +03:00
|
|
|
static const struct svc_procedure nfsd_procedures2[18] = {
|
2009-06-09 13:33:34 +04:00
|
|
|
[NFSPROC_NULL] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_null,
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_decode = nfssvc_decode_voidarg,
|
|
|
|
.pc_encode = nfssvc_encode_voidres,
|
|
|
|
.pc_argsize = sizeof(struct nfsd_voidargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_voidargs),
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_voidres),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_xdrressize = 0,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "NULL",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_GETATTR] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_getattr,
|
2020-10-21 19:14:23 +03:00
|
|
|
.pc_decode = nfssvc_decode_fhandleargs,
|
2020-10-23 22:28:59 +03:00
|
|
|
.pc_encode = nfssvc_encode_attrstatres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_attrstat,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_fhandle),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "GETATTR",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_SETATTR] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_setattr,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_sattrargs,
|
2020-10-23 22:28:59 +03:00
|
|
|
.pc_encode = nfssvc_encode_attrstatres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_attrstat,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_sattrargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_sattrargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "SETATTR",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_ROOT] = {
|
2020-10-02 01:58:56 +03:00
|
|
|
.pc_func = nfsd_proc_root,
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_decode = nfssvc_decode_voidarg,
|
|
|
|
.pc_encode = nfssvc_encode_voidres,
|
|
|
|
.pc_argsize = sizeof(struct nfsd_voidargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_voidargs),
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_voidres),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_xdrressize = 0,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "ROOT",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_LOOKUP] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_lookup,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_diropargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_diropres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_diropres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_diropargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+FH+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "LOOKUP",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_READLINK] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_readlink,
|
2020-10-21 19:21:25 +03:00
|
|
|
.pc_decode = nfssvc_decode_fhandleargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_readlinkres,
|
2020-10-21 19:21:25 +03:00
|
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_fhandle),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_readlinkres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+1+NFS_MAXPATHLEN/4,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "READLINK",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_READ] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_read,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_readargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_readres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_readres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_readargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_readargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_readres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "READ",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_WRITECACHE] = {
|
2020-10-02 01:58:56 +03:00
|
|
|
.pc_func = nfsd_proc_writecache,
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_decode = nfssvc_decode_voidarg,
|
|
|
|
.pc_encode = nfssvc_encode_voidres,
|
|
|
|
.pc_argsize = sizeof(struct nfsd_voidargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_voidargs),
|
2020-11-05 22:48:29 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_voidres),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_xdrressize = 0,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "WRITECACHE",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_WRITE] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_write,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_writeargs,
|
2020-10-23 22:28:59 +03:00
|
|
|
.pc_encode = nfssvc_encode_attrstatres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_attrstat,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_writeargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_writeargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_attrstat),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "WRITE",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_CREATE] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_create,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_createargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_diropres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_diropres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_createargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_createargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+FH+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "CREATE",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_REMOVE] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_remove,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_diropargs,
|
2020-10-23 18:08:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_diropargs),
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_stat),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "REMOVE",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_RENAME] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_rename,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_renameargs,
|
2020-10-23 18:08:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_renameargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_renameargs),
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_stat),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "RENAME",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_LINK] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_link,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_linkargs,
|
2020-10-23 18:08:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_linkargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_linkargs),
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_stat),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "LINK",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_SYMLINK] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_symlink,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_symlinkargs,
|
2020-10-23 18:08:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_symlinkargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_symlinkargs),
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_stat),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "SYMLINK",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_MKDIR] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_mkdir,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_createargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_diropres,
|
2020-10-02 01:59:44 +03:00
|
|
|
.pc_release = nfssvc_release_diropres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_createargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_createargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_diropres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+FH+AT,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "MKDIR",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_RMDIR] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_rmdir,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_diropargs,
|
2020-10-23 18:08:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_diropargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_diropargs),
|
2020-10-02 22:52:44 +03:00
|
|
|
.pc_ressize = sizeof(struct nfsd_stat),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_cachetype = RC_REPLSTAT,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "RMDIR",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_READDIR] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_readdir,
|
2017-05-08 20:01:48 +03:00
|
|
|
.pc_decode = nfssvc_decode_readdirargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_readdirres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_readdirargs),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_readdirargs),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_readdirres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "READDIR",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
|
|
|
[NFSPROC_STATFS] = {
|
2017-05-08 18:35:49 +03:00
|
|
|
.pc_func = nfsd_proc_statfs,
|
2020-10-21 19:14:23 +03:00
|
|
|
.pc_decode = nfssvc_decode_fhandleargs,
|
2017-05-08 20:42:02 +03:00
|
|
|
.pc_encode = nfssvc_encode_statfsres,
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
2022-09-13 00:22:38 +03:00
|
|
|
.pc_argzero = sizeof(struct nfsd_fhandle),
|
2009-06-09 13:33:34 +04:00
|
|
|
.pc_ressize = sizeof(struct nfsd_statfsres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+5,
|
2020-09-18 00:22:49 +03:00
|
|
|
.pc_name = "STATFS",
|
2009-06-09 13:33:34 +04:00
|
|
|
},
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-05-09 00:40:27 +03:00
|
|
|
static unsigned int nfsd_count2[ARRAY_SIZE(nfsd_procedures2)];
|
2017-05-12 17:21:37 +03:00
|
|
|
const struct svc_version nfsd_version2 = {
|
|
|
|
.vs_vers = 2,
|
|
|
|
.vs_nproc = 18,
|
|
|
|
.vs_proc = nfsd_procedures2,
|
|
|
|
.vs_count = nfsd_count2,
|
|
|
|
.vs_dispatch = nfsd_dispatch,
|
|
|
|
.vs_xdrsize = NFS2_SVC_XDRSIZE,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Map errnos to NFS errnos.
|
|
|
|
*/
|
2006-10-20 10:28:54 +04:00
|
|
|
__be32
|
2005-04-17 02:20:36 +04:00
|
|
|
nfserrno (int errno)
|
|
|
|
{
|
|
|
|
static struct {
|
2006-10-20 10:28:54 +04:00
|
|
|
__be32 nfserr;
|
2005-04-17 02:20:36 +04:00
|
|
|
int syserr;
|
|
|
|
} nfs_errtbl[] = {
|
|
|
|
{ nfs_ok, 0 },
|
|
|
|
{ nfserr_perm, -EPERM },
|
|
|
|
{ nfserr_noent, -ENOENT },
|
|
|
|
{ nfserr_io, -EIO },
|
|
|
|
{ nfserr_nxio, -ENXIO },
|
2014-07-03 23:15:54 +04:00
|
|
|
{ nfserr_fbig, -E2BIG },
|
2021-12-19 04:37:54 +03:00
|
|
|
{ nfserr_stale, -EBADF },
|
2005-04-17 02:20:36 +04:00
|
|
|
{ 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 },
|
2008-06-19 04:11:09 +04:00
|
|
|
{ nfserr_jukebox, -ERESTARTSYS },
|
2011-01-03 06:05:33 +03:00
|
|
|
{ nfserr_jukebox, -EAGAIN },
|
|
|
|
{ nfserr_jukebox, -EWOULDBLOCK },
|
2011-01-01 23:43:50 +03:00
|
|
|
{ nfserr_jukebox, -ENOMEM },
|
2005-04-17 02:20:36 +04:00
|
|
|
{ nfserr_io, -ETXTBSY },
|
2005-06-22 21:16:24 +04:00
|
|
|
{ nfserr_notsupp, -EOPNOTSUPP },
|
2008-12-15 20:40:15 +03:00
|
|
|
{ nfserr_toosmall, -ETOOSMALL },
|
2009-09-27 22:41:43 +04:00
|
|
|
{ nfserr_serverfault, -ESERVERFAULT },
|
2014-07-30 05:37:44 +04:00
|
|
|
{ nfserr_serverfault, -ENFILE },
|
2021-12-19 04:37:55 +03:00
|
|
|
{ nfserr_io, -EREMOTEIO },
|
2021-12-19 04:37:56 +03:00
|
|
|
{ nfserr_stale, -EOPENSTALE },
|
2016-10-04 20:57:43 +03:00
|
|
|
{ nfserr_io, -EUCLEAN },
|
2017-03-10 04:52:20 +03:00
|
|
|
{ nfserr_perm, -ENOKEY },
|
2021-08-21 00:02:06 +03:00
|
|
|
{ nfserr_no_grace, -ENOGRACE},
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
2006-10-20 10:28:54 +04:00
|
|
|
for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
|
2005-04-17 02:20:36 +04:00
|
|
|
if (nfs_errtbl[i].syserr == errno)
|
|
|
|
return nfs_errtbl[i].nfserr;
|
|
|
|
}
|
2016-10-04 19:53:49 +03:00
|
|
|
WARN_ONCE(1, "nfsd: non-standard errno: %d\n", errno);
|
2005-04-17 02:20:36 +04:00
|
|
|
return nfserr_io;
|
|
|
|
}
|
|
|
|
|