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 14:07:57 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Process version 3 NFS requests.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/ext2_fs.h>
|
2009-01-11 19:13:53 +00:00
|
|
|
#include <linux/magic.h>
|
2022-03-28 17:29:23 +00:00
|
|
|
#include <linux/namei.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-12-03 18:30:56 +00:00
|
|
|
#include "cache.h"
|
|
|
|
#include "xdr3.h"
|
2009-11-04 23:12:35 +00:00
|
|
|
#include "vfs.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define NFSDDBG_FACILITY NFSDDBG_PROC
|
|
|
|
|
|
|
|
static int nfs3_ftypes[] = {
|
|
|
|
0, /* NF3NON */
|
|
|
|
S_IFREG, /* NF3REG */
|
|
|
|
S_IFDIR, /* NF3DIR */
|
|
|
|
S_IFBLK, /* NF3BLK */
|
|
|
|
S_IFCHR, /* NF3CHR */
|
|
|
|
S_IFLNK, /* NF3LNK */
|
|
|
|
S_IFSOCK, /* NF3SOCK */
|
|
|
|
S_IFIFO, /* NF3FIFO */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NULL call.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_null(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a file's attributes
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_getattr(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: GETATTR(3) %s\n",
|
2006-01-06 08:19:58 +00:00
|
|
|
SVCFH_fmt(&argp->fh));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-01 22:59:54 +00: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 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set a file's attributes
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_setattr(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_sattrargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
2022-07-26 06:45:30 +00:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: SETATTR(3) %s\n",
|
|
|
|
SVCFH_fmt(&argp->fh));
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2022-07-26 06:45:30 +00:00
|
|
|
resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs,
|
2020-10-01 22:59:54 +00:00
|
|
|
argp->check_guard, argp->guardtime);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Look up a path name component
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_lookup(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_diropargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: LOOKUP(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
fh_copy(&resp->dirfh, &argp->fh);
|
|
|
|
fh_init(&resp->fh, NFS3_FHSIZE);
|
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_lookup(rqstp, &resp->dirfh,
|
|
|
|
argp->name, argp->len,
|
|
|
|
&resp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check file access
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_access(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_accessargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_accessres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: ACCESS(3) %s 0x%x\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->access);
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->access = argp->access;
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a symlink.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_readlink(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2020-10-24 16:51:18 +00:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_readlinkres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
|
|
|
|
|
|
|
|
/* Read the symlink. */
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->len = NFS3_MAXPATHLEN;
|
2020-10-22 19:18:40 +00:00
|
|
|
resp->pages = rqstp->rq_next_page++;
|
|
|
|
resp->status = nfsd_readlink(rqstp, &resp->fh,
|
|
|
|
page_address(*resp->pages), &resp->len);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a portion of a file.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_read(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_readargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_readres *resp = rqstp->rq_resp;
|
2020-10-20 18:34:40 +00:00
|
|
|
u32 max_blocksize = svc_max_payload(rqstp);
|
|
|
|
unsigned int len;
|
|
|
|
int v;
|
|
|
|
|
2010-11-29 20:28:10 +00:00
|
|
|
dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
|
2005-04-16 22:20:36 +00:00
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
(unsigned long) argp->count,
|
2010-11-29 20:28:10 +00:00
|
|
|
(unsigned long long) argp->offset);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2022-02-04 20:19:34 +00:00
|
|
|
argp->count = min_t(u32, argp->count, max_blocksize);
|
|
|
|
if (argp->offset > (u64)OFFSET_MAX)
|
|
|
|
argp->offset = (u64)OFFSET_MAX;
|
|
|
|
if (argp->offset + argp->count > (u64)OFFSET_MAX)
|
|
|
|
argp->count = (u64)OFFSET_MAX - argp->offset;
|
|
|
|
|
2020-10-20 18:34:40 +00:00
|
|
|
v = 0;
|
|
|
|
len = argp->count;
|
2020-10-22 19:23:50 +00:00
|
|
|
resp->pages = rqstp->rq_next_page;
|
2020-10-20 18:34:40 +00: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-16 22:20:36 +00:00
|
|
|
/* Obtain buffer pointer for payload.
|
|
|
|
* 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
|
|
|
|
* + 1 (xdr opaque byte count) = 26
|
|
|
|
*/
|
2020-10-20 18:34:40 +00:00
|
|
|
resp->count = argp->count;
|
2007-05-09 09:34:50 +00:00
|
|
|
svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
|
2020-10-20 18:34:40 +00:00
|
|
|
rqstp->rq_vec, v, &resp->count, &resp->eof);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write data to a file
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_write(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_writeargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_writeres *resp = rqstp->rq_resp;
|
2009-03-06 01:16:14 +00:00
|
|
|
unsigned long cnt = argp->len;
|
2018-03-27 14:54:07 +00:00
|
|
|
unsigned int nvecs;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-29 20:28:10 +00:00
|
|
|
dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
|
2005-04-16 22:20:36 +00:00
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
2010-11-29 20:28:10 +00:00
|
|
|
(unsigned long long) argp->offset,
|
2005-04-16 22:20:36 +00:00
|
|
|
argp->stable? " stable" : "");
|
|
|
|
|
2022-01-25 21:36:22 +00:00
|
|
|
resp->status = nfserr_fbig;
|
|
|
|
if (argp->offset > (u64)OFFSET_MAX ||
|
|
|
|
argp->offset + argp->len > (u64)OFFSET_MAX)
|
|
|
|
return rpc_success;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->committed = argp->stable;
|
2021-09-30 21:06:21 +00:00
|
|
|
nvecs = svc_fill_write_vector(rqstp, &argp->payload);
|
2021-12-21 16:52:06 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
|
|
|
|
rqstp->rq_vec, nvecs, &cnt,
|
|
|
|
resp->committed, resp->verf);
|
2009-03-06 01:16:14 +00:00
|
|
|
resp->count = cnt;
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-03-28 17:29:23 +00:00
|
|
|
* Implement NFSv3's unchecked, guarded, and exclusive CREATE
|
|
|
|
* semantics for regular files. Except for the created file,
|
|
|
|
* this operation is stateless on the server.
|
|
|
|
*
|
|
|
|
* Upon return, caller must release @fhp and @resfhp.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2022-03-28 17:29:23 +00:00
|
|
|
static __be32
|
|
|
|
nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|
|
|
struct svc_fh *resfhp, struct nfsd3_createargs *argp)
|
|
|
|
{
|
|
|
|
struct iattr *iap = &argp->attrs;
|
|
|
|
struct dentry *parent, *child;
|
2022-07-26 06:45:30 +00:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = iap,
|
|
|
|
};
|
2022-03-28 17:29:23 +00:00
|
|
|
__u32 v_mtime, v_atime;
|
|
|
|
struct inode *inode;
|
|
|
|
__be32 status;
|
|
|
|
int host_err;
|
|
|
|
|
|
|
|
if (isdotent(argp->name, argp->len))
|
|
|
|
return nfserr_exist;
|
|
|
|
if (!(iap->ia_valid & ATTR_MODE))
|
|
|
|
iap->ia_mode = 0;
|
|
|
|
|
|
|
|
status = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
|
|
|
|
if (status != nfs_ok)
|
|
|
|
return status;
|
|
|
|
|
|
|
|
parent = fhp->fh_dentry;
|
|
|
|
inode = d_inode(parent);
|
|
|
|
|
|
|
|
host_err = fh_want_write(fhp);
|
|
|
|
if (host_err)
|
|
|
|
return nfserrno(host_err);
|
|
|
|
|
2022-07-26 06:45:30 +00:00
|
|
|
inode_lock_nested(inode, I_MUTEX_PARENT);
|
2022-03-28 17:29:23 +00:00
|
|
|
|
|
|
|
child = lookup_one_len(argp->name, parent, argp->len);
|
|
|
|
if (IS_ERR(child)) {
|
|
|
|
status = nfserrno(PTR_ERR(child));
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d_really_is_negative(child)) {
|
|
|
|
status = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
|
|
|
|
if (status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = fh_compose(resfhp, fhp->fh_export, child, fhp);
|
|
|
|
if (status != nfs_ok)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
v_mtime = 0;
|
|
|
|
v_atime = 0;
|
|
|
|
if (argp->createmode == NFS3_CREATE_EXCLUSIVE) {
|
|
|
|
u32 *verifier = (u32 *)argp->verf;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Solaris 7 gets confused (bugid 4218508) if these have
|
|
|
|
* the high bit set, as do xfs filesystems without the
|
|
|
|
* "bigtime" feature. So just clear the high bits.
|
|
|
|
*/
|
|
|
|
v_mtime = verifier[0] & 0x7fffffff;
|
|
|
|
v_atime = verifier[1] & 0x7fffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d_really_is_positive(child)) {
|
|
|
|
status = nfs_ok;
|
|
|
|
|
|
|
|
switch (argp->createmode) {
|
|
|
|
case NFS3_CREATE_UNCHECKED:
|
|
|
|
if (!d_is_reg(child))
|
|
|
|
break;
|
|
|
|
iap->ia_valid &= ATTR_SIZE;
|
|
|
|
goto set_attr;
|
|
|
|
case NFS3_CREATE_GUARDED:
|
|
|
|
status = nfserr_exist;
|
|
|
|
break;
|
|
|
|
case NFS3_CREATE_EXCLUSIVE:
|
|
|
|
if (d_inode(child)->i_mtime.tv_sec == v_mtime &&
|
|
|
|
d_inode(child)->i_atime.tv_sec == v_atime &&
|
|
|
|
d_inode(child)->i_size == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
status = nfserr_exist;
|
|
|
|
}
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!IS_POSIXACL(inode))
|
|
|
|
iap->ia_mode &= ~current_umask();
|
|
|
|
|
2022-07-26 06:45:30 +00:00
|
|
|
fh_fill_pre_attrs(fhp);
|
2022-03-28 17:29:23 +00:00
|
|
|
host_err = vfs_create(&init_user_ns, inode, child, iap->ia_mode, true);
|
|
|
|
if (host_err < 0) {
|
|
|
|
status = nfserrno(host_err);
|
|
|
|
goto out;
|
|
|
|
}
|
2022-07-26 06:45:30 +00:00
|
|
|
fh_fill_post_attrs(fhp);
|
2022-03-28 17:29:23 +00:00
|
|
|
|
|
|
|
/* A newly created file already has a file size of zero. */
|
|
|
|
if ((iap->ia_valid & ATTR_SIZE) && (iap->ia_size == 0))
|
|
|
|
iap->ia_valid &= ~ATTR_SIZE;
|
|
|
|
if (argp->createmode == NFS3_CREATE_EXCLUSIVE) {
|
|
|
|
iap->ia_valid = ATTR_MTIME | ATTR_ATIME |
|
|
|
|
ATTR_MTIME_SET | ATTR_ATIME_SET;
|
|
|
|
iap->ia_mtime.tv_sec = v_mtime;
|
|
|
|
iap->ia_atime.tv_sec = v_atime;
|
|
|
|
iap->ia_mtime.tv_nsec = 0;
|
|
|
|
iap->ia_atime.tv_nsec = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_attr:
|
2022-07-26 06:45:30 +00:00
|
|
|
status = nfsd_create_setattr(rqstp, fhp, resfhp, &attrs);
|
2022-03-28 17:29:23 +00:00
|
|
|
|
|
|
|
out:
|
2022-07-26 06:45:30 +00:00
|
|
|
inode_unlock(inode);
|
2022-03-28 17:29:23 +00:00
|
|
|
if (child && !IS_ERR(child))
|
|
|
|
dput(child);
|
|
|
|
fh_drop_write(fhp);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_create(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_createargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
2022-03-25 18:47:54 +00:00
|
|
|
svc_fh *dirfhp, *newfhp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: CREATE(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
dirfhp = fh_copy(&resp->dirfh, &argp->fh);
|
|
|
|
newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
|
|
|
|
|
2022-03-28 17:29:23 +00:00
|
|
|
resp->status = nfsd3_create_file(rqstp, dirfhp, newfhp, argp);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make directory. This operation is not idempotent.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_mkdir(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_createargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
2022-07-26 06:45:30 +00:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: MKDIR(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
argp->attrs.ia_valid &= ~ATTR_SIZE;
|
|
|
|
fh_copy(&resp->dirfh, &argp->fh);
|
|
|
|
fh_init(&resp->fh, NFS3_FHSIZE);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
|
2022-07-26 06:45:30 +00:00
|
|
|
&attrs, S_IFDIR, 0, &resp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_symlink(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
2022-07-26 06:45:30 +00:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
if (argp->tlen == 0) {
|
|
|
|
resp->status = nfserr_inval;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (argp->tlen > NFS3_MAXPATHLEN) {
|
|
|
|
resp->status = nfserr_nametoolong;
|
|
|
|
goto out;
|
|
|
|
}
|
2018-03-27 14:54:21 +00:00
|
|
|
|
|
|
|
argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
|
2018-07-27 15:19:10 +00:00
|
|
|
page_address(rqstp->rq_arg.pages[0]),
|
2018-03-27 14:54:21 +00:00
|
|
|
argp->tlen);
|
2020-10-01 22:59:54 +00:00
|
|
|
if (IS_ERR(argp->tname)) {
|
|
|
|
resp->status = nfserrno(PTR_ERR(argp->tname));
|
|
|
|
goto out;
|
|
|
|
}
|
2018-03-27 14:54:21 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->ffh),
|
|
|
|
argp->flen, argp->fname,
|
|
|
|
argp->tlen, argp->tname);
|
|
|
|
|
|
|
|
fh_copy(&resp->dirfh, &argp->ffh);
|
|
|
|
fh_init(&resp->fh, NFS3_FHSIZE);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
|
2022-07-26 06:45:30 +00:00
|
|
|
argp->flen, argp->tname, &attrs, &resp->fh);
|
2018-07-27 15:19:10 +00:00
|
|
|
kfree(argp->tname);
|
2020-10-01 22:59:54 +00:00
|
|
|
out:
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make socket/fifo/device.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_mknod(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_mknodargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
2022-07-26 06:45:30 +00:00
|
|
|
struct nfsd_attrs attrs = {
|
|
|
|
.na_iattr = &argp->attrs,
|
|
|
|
};
|
2006-10-20 06:29:00 +00:00
|
|
|
int type;
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_t rdev = 0;
|
|
|
|
|
|
|
|
dprintk("nfsd: MKNOD(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
fh_copy(&resp->dirfh, &argp->fh);
|
|
|
|
fh_init(&resp->fh, NFS3_FHSIZE);
|
|
|
|
|
|
|
|
if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
|
|
|
|
rdev = MKDEV(argp->major, argp->minor);
|
|
|
|
if (MAJOR(rdev) != argp->major ||
|
2020-10-01 22:59:54 +00:00
|
|
|
MINOR(rdev) != argp->minor) {
|
|
|
|
resp->status = nfserr_inval;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
} else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
|
2020-10-23 14:41:12 +00:00
|
|
|
resp->status = nfserr_badtype;
|
2020-10-01 22:59:54 +00:00
|
|
|
goto out;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
type = nfs3_ftypes[argp->ftype];
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
|
2022-07-26 06:45:30 +00:00
|
|
|
&attrs, type, rdev, &resp->fh);
|
2020-10-01 22:59:54 +00:00
|
|
|
out:
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove file/fifo/socket etc.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_remove(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_diropargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: REMOVE(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
/* Unlink. -S_IFDIR means file must not be a directory */
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
|
|
|
|
argp->name, argp->len);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove a directory
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_rmdir(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_diropargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: RMDIR(3) %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->len,
|
|
|
|
argp->name);
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
|
|
|
|
argp->name, argp->len);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_rename(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_renameargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_renameres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: RENAME(3) %s %.*s ->\n",
|
|
|
|
SVCFH_fmt(&argp->ffh),
|
|
|
|
argp->flen,
|
|
|
|
argp->fname);
|
|
|
|
dprintk("nfsd: -> %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->tfh),
|
|
|
|
argp->tlen,
|
|
|
|
argp->tname);
|
|
|
|
|
|
|
|
fh_copy(&resp->ffh, &argp->ffh);
|
|
|
|
fh_copy(&resp->tfh, &argp->tfh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
|
|
|
|
&resp->tfh, argp->tname, argp->tlen);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_link(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_linkargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_linkres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: LINK(3) %s ->\n",
|
|
|
|
SVCFH_fmt(&argp->ffh));
|
|
|
|
dprintk("nfsd: -> %s %.*s\n",
|
|
|
|
SVCFH_fmt(&argp->tfh),
|
|
|
|
argp->tlen,
|
|
|
|
argp->tname);
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->ffh);
|
|
|
|
fh_copy(&resp->tfh, &argp->tfh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
|
|
|
|
&resp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 14:50:23 +00:00
|
|
|
static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
|
|
|
|
struct nfsd3_readdirres *resp,
|
2021-12-16 16:12:11 +00:00
|
|
|
u32 count)
|
2020-11-17 14:50:23 +00:00
|
|
|
{
|
2020-10-22 23:46:58 +00:00
|
|
|
struct xdr_buf *buf = &resp->dirlist;
|
|
|
|
struct xdr_stream *xdr = &resp->xdr;
|
2022-09-01 19:10:12 +00:00
|
|
|
unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen,
|
|
|
|
svc_max_payload(rqstp));
|
2020-11-17 14:50:23 +00:00
|
|
|
|
2020-10-22 23:46:58 +00:00
|
|
|
memset(buf, 0, sizeof(*buf));
|
2020-11-17 14:50:23 +00:00
|
|
|
|
2020-10-22 23:46:58 +00:00
|
|
|
/* Reserve room for the NULL ptr & eof flag (-2 words) */
|
2022-09-01 19:10:12 +00:00
|
|
|
buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), sendbuf);
|
|
|
|
buf->buflen -= XDR_UNIT * 2;
|
2020-10-22 23:46:58 +00:00
|
|
|
buf->pages = rqstp->rq_next_page;
|
2021-12-16 16:12:11 +00:00
|
|
|
rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
2020-10-22 23:46:58 +00:00
|
|
|
|
|
|
|
/* This is xdr_init_encode(), but it assumes that
|
|
|
|
* the head kvec has already been consumed. */
|
|
|
|
xdr_set_scratch_buffer(xdr, NULL, 0);
|
|
|
|
xdr->buf = buf;
|
|
|
|
xdr->page_ptr = buf->pages;
|
|
|
|
xdr->iov = NULL;
|
|
|
|
xdr->p = page_address(*buf->pages);
|
2021-12-16 16:12:11 +00:00
|
|
|
xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
|
2020-10-22 23:46:58 +00:00
|
|
|
xdr->rqst = NULL;
|
2020-11-17 14:50:23 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Read a portion of a directory.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_readdir(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_readdirargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_readdirres *resp = rqstp->rq_resp;
|
2020-11-10 15:24:39 +00:00
|
|
|
loff_t offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->count, (u32) argp->cookie);
|
|
|
|
|
2020-11-17 14:50:23 +00:00
|
|
|
nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->common.err = nfs_ok;
|
2020-10-22 23:46:58 +00:00
|
|
|
resp->cookie_offset = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->rqstp = rqstp;
|
2020-11-10 15:24:39 +00:00
|
|
|
offset = argp->cookie;
|
|
|
|
resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
|
2020-10-22 23:46:58 +00:00
|
|
|
&resp->common, nfs3svc_encode_entry3);
|
2005-04-16 22:20:36 +00:00
|
|
|
memcpy(resp->verf, argp->verf, 8);
|
2020-11-10 14:57:14 +00:00
|
|
|
nfs3svc_encode_cookie3(resp, offset);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2021-01-15 14:28:44 +00:00
|
|
|
/* Recycle only pages that were part of the reply */
|
|
|
|
rqstp->rq_next_page = resp->xdr.page_ptr + 1;
|
|
|
|
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a portion of a directory, including file handles and attrs.
|
|
|
|
* For now, we choose to ignore the dircount parameter.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_readdirargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_readdirres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
loff_t offset;
|
|
|
|
|
|
|
|
dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->count, (u32) argp->cookie);
|
|
|
|
|
2020-11-17 14:50:23 +00:00
|
|
|
nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
|
|
|
resp->common.err = nfs_ok;
|
2020-10-22 23:46:58 +00:00
|
|
|
resp->cookie_offset = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->rqstp = rqstp;
|
|
|
|
offset = argp->cookie;
|
nfsd: allow turning off nfsv3 readdir_plus
One of our customer's application only needs file names, not file
attributes. With directories having 10K+ inodes (assuming buffer cache
has directory blocks cached having file names, but inode cache is
limited and hence need eviction of older cached inodes), older inodes
are evicted periodically. So if they keep on doing readdir(2) from NSF
client on multiple directories, some directory's files are periodically
removed from inode cache and hence new readdir(2) on same directory
requires disk access to bring back inodes again to inode cache.
As READDIRPLUS request fetches attributes also, doing getattr on each
file on server, it causes unnecessary disk accesses. If READDIRPLUS on
NFS client is returned with -ENOTSUPP, NFS client uses READDIR request
which just gets the names of the files in a directory, not attributes,
hence avoiding disk accesses on server.
There's already a corresponding client-side mount option, but an export
option reduces the need for configuration across multiple clients.
This flag affects NFSv3 only. If it turns out it's needed for NFSv4 as
well then we may have to figure out how to extend the behavior to NFSv4,
but it's not currently obvious how to do that.
Signed-off-by: Rajesh Ghanekar <rajesh_ghanekar@symantec.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2014-08-02 02:17:30 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
|
|
|
|
if (resp->status != nfs_ok)
|
|
|
|
goto out;
|
nfsd: allow turning off nfsv3 readdir_plus
One of our customer's application only needs file names, not file
attributes. With directories having 10K+ inodes (assuming buffer cache
has directory blocks cached having file names, but inode cache is
limited and hence need eviction of older cached inodes), older inodes
are evicted periodically. So if they keep on doing readdir(2) from NSF
client on multiple directories, some directory's files are periodically
removed from inode cache and hence new readdir(2) on same directory
requires disk access to bring back inodes again to inode cache.
As READDIRPLUS request fetches attributes also, doing getattr on each
file on server, it causes unnecessary disk accesses. If READDIRPLUS on
NFS client is returned with -ENOTSUPP, NFS client uses READDIR request
which just gets the names of the files in a directory, not attributes,
hence avoiding disk accesses on server.
There's already a corresponding client-side mount option, but an export
option reduces the need for configuration across multiple clients.
This flag affects NFSv3 only. If it turns out it's needed for NFSv4 as
well then we may have to figure out how to extend the behavior to NFSv4,
but it's not currently obvious how to do that.
Signed-off-by: Rajesh Ghanekar <rajesh_ghanekar@symantec.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2014-08-02 02:17:30 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
|
|
|
|
resp->status = nfserr_notsupp;
|
|
|
|
goto out;
|
|
|
|
}
|
nfsd: allow turning off nfsv3 readdir_plus
One of our customer's application only needs file names, not file
attributes. With directories having 10K+ inodes (assuming buffer cache
has directory blocks cached having file names, but inode cache is
limited and hence need eviction of older cached inodes), older inodes
are evicted periodically. So if they keep on doing readdir(2) from NSF
client on multiple directories, some directory's files are periodically
removed from inode cache and hence new readdir(2) on same directory
requires disk access to bring back inodes again to inode cache.
As READDIRPLUS request fetches attributes also, doing getattr on each
file on server, it causes unnecessary disk accesses. If READDIRPLUS on
NFS client is returned with -ENOTSUPP, NFS client uses READDIR request
which just gets the names of the files in a directory, not attributes,
hence avoiding disk accesses on server.
There's already a corresponding client-side mount option, but an export
option reduces the need for configuration across multiple clients.
This flag affects NFSv3 only. If it turns out it's needed for NFSv4 as
well then we may have to figure out how to extend the behavior to NFSv4,
but it's not currently obvious how to do that.
Signed-off-by: Rajesh Ghanekar <rajesh_ghanekar@symantec.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2014-08-02 02:17:30 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
|
2020-10-22 23:46:58 +00:00
|
|
|
&resp->common, nfs3svc_encode_entryplus3);
|
2005-04-16 22:20:36 +00:00
|
|
|
memcpy(resp->verf, argp->verf, 8);
|
2020-11-10 14:57:14 +00:00
|
|
|
nfs3svc_encode_cookie3(resp, offset);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2021-01-15 14:28:44 +00:00
|
|
|
/* Recycle only pages that were part of the reply */
|
|
|
|
rqstp->rq_next_page = resp->xdr.page_ptr + 1;
|
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
out:
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get file system stats
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_fsstat(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_fsstatres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: FSSTAT(3) %s\n",
|
|
|
|
SVCFH_fmt(&argp->fh));
|
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
fh_put(&argp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get file system info
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_fsinfores *resp = rqstp->rq_resp;
|
2006-10-04 09:15:47 +00:00
|
|
|
u32 max_blocksize = svc_max_payload(rqstp);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: FSINFO(3) %s\n",
|
|
|
|
SVCFH_fmt(&argp->fh));
|
|
|
|
|
2006-10-04 09:15:47 +00:00
|
|
|
resp->f_rtmax = max_blocksize;
|
|
|
|
resp->f_rtpref = max_blocksize;
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->f_rtmult = PAGE_SIZE;
|
2006-10-04 09:15:47 +00:00
|
|
|
resp->f_wtmax = max_blocksize;
|
|
|
|
resp->f_wtpref = max_blocksize;
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->f_wtmult = PAGE_SIZE;
|
2019-03-06 22:49:46 +00:00
|
|
|
resp->f_dtpref = max_blocksize;
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->f_maxfilesize = ~(u32) 0;
|
|
|
|
resp->f_properties = NFS3_FSF_DEFAULT;
|
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = fh_verify(rqstp, &argp->fh, 0,
|
|
|
|
NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Check special features of the file system. May request
|
|
|
|
* different read/write sizes for file systems known to have
|
|
|
|
* problems with large blocks */
|
2020-10-01 22:59:54 +00:00
|
|
|
if (resp->status == nfs_ok) {
|
2016-04-10 05:33:30 +00:00
|
|
|
struct super_block *sb = argp->fh.fh_dentry->d_sb;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Note that we don't care for remote fs's here */
|
2009-01-11 19:13:53 +00:00
|
|
|
if (sb->s_magic == MSDOS_SUPER_MAGIC) {
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->f_properties = NFS3_FSF_BILLYBOY;
|
|
|
|
}
|
|
|
|
resp->f_maxfilesize = sb->s_maxbytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
fh_put(&argp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get pathconf info for the specified file
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_pathconf(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_pathconfres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: PATHCONF(3) %s\n",
|
|
|
|
SVCFH_fmt(&argp->fh));
|
|
|
|
|
|
|
|
/* Set default pathconf */
|
|
|
|
resp->p_link_max = 255; /* at least */
|
|
|
|
resp->p_name_max = 255; /* at least */
|
|
|
|
resp->p_no_trunc = 0;
|
|
|
|
resp->p_chown_restricted = 1;
|
|
|
|
resp->p_case_insensitive = 0;
|
|
|
|
resp->p_case_preserving = 1;
|
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2020-10-01 22:59:54 +00:00
|
|
|
if (resp->status == nfs_ok) {
|
2016-04-10 05:33:30 +00:00
|
|
|
struct super_block *sb = argp->fh.fh_dentry->d_sb;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Note that we don't care for remote fs's here */
|
|
|
|
switch (sb->s_magic) {
|
|
|
|
case EXT2_SUPER_MAGIC:
|
|
|
|
resp->p_link_max = EXT2_LINK_MAX;
|
|
|
|
resp->p_name_max = EXT2_NAME_LEN;
|
|
|
|
break;
|
2009-01-11 19:13:53 +00:00
|
|
|
case MSDOS_SUPER_MAGIC:
|
2005-04-16 22:20:36 +00:00
|
|
|
resp->p_case_insensitive = 1;
|
|
|
|
resp->p_case_preserving = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fh_put(&argp->fh);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Commit a file (range) to stable storage.
|
|
|
|
*/
|
2006-10-20 06:28:45 +00:00
|
|
|
static __be32
|
2017-05-08 15:35:49 +00:00
|
|
|
nfsd3_proc_commit(struct svc_rqst *rqstp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-05-08 15:35:49 +00:00
|
|
|
struct nfsd3_commitargs *argp = rqstp->rq_argp;
|
|
|
|
struct nfsd3_commitres *resp = rqstp->rq_resp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
|
|
|
|
SVCFH_fmt(&argp->fh),
|
|
|
|
argp->count,
|
|
|
|
(unsigned long long) argp->offset);
|
|
|
|
|
|
|
|
fh_copy(&resp->fh, &argp->fh);
|
2020-10-01 22:59:54 +00:00
|
|
|
resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
|
|
|
|
argp->count, resp->verf);
|
2020-10-02 19:52:44 +00:00
|
|
|
return rpc_success;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NFSv3 Server procedures.
|
|
|
|
* Only the results of non-idempotent operations are cached.
|
|
|
|
*/
|
|
|
|
#define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
|
|
|
|
#define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
|
|
|
|
#define nfsd3_mkdirargs nfsd3_createargs
|
|
|
|
#define nfsd3_readdirplusargs nfsd3_readdirargs
|
|
|
|
#define nfsd3_fhandleargs nfsd_fhandle
|
|
|
|
#define nfsd3_attrstatres nfsd3_attrstat
|
|
|
|
#define nfsd3_wccstatres nfsd3_attrstat
|
|
|
|
#define nfsd3_createres nfsd3_diropres
|
|
|
|
|
|
|
|
#define ST 1 /* status*/
|
|
|
|
#define FH 17 /* filehandle with length */
|
|
|
|
#define AT 21 /* attributes */
|
|
|
|
#define pAT (1+AT) /* post attributes - conditional */
|
|
|
|
#define WC (7+pAT) /* WCC attributes */
|
|
|
|
|
2017-05-12 14:11:49 +00:00
|
|
|
static const struct svc_procedure nfsd_procedures3[22] = {
|
2009-06-09 09:33:34 +00:00
|
|
|
[NFS3PROC_NULL] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_null,
|
2020-11-05 19:48:29 +00:00
|
|
|
.pc_decode = nfssvc_decode_voidarg,
|
|
|
|
.pc_encode = nfssvc_encode_voidres,
|
|
|
|
.pc_argsize = sizeof(struct nfsd_voidargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd_voidres),
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "NULL",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_GETATTR] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_getattr,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_fhandleargs,
|
2020-10-21 15:58:41 +00:00
|
|
|
.pc_encode = nfs3svc_encode_getattrres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2020-10-20 18:30:02 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_ressize = sizeof(struct nfsd3_attrstatres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+AT,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "GETATTR",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_SETATTR] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_setattr,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_sattrargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_wccstatres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_sattrargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "SETATTR",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_LOOKUP] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_lookup,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_diropargs,
|
2020-10-22 18:46:58 +00:00
|
|
|
.pc_encode = nfs3svc_encode_lookupres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_diropres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+FH+pAT+pAT,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "LOOKUP",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_ACCESS] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_access,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_accessargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_accessres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_accessargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_accessres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+1,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "ACCESS",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_READLINK] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_readlink,
|
2020-10-24 16:51:18 +00:00
|
|
|
.pc_decode = nfs3svc_decode_fhandleargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_readlinkres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2020-10-24 16:51:18 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd_fhandle),
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_ressize = sizeof(struct nfsd3_readlinkres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "READLINK",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_READ] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_read,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_readargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_readres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_readargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_readres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "READ",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_WRITE] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_write,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_writeargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_writeres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_writeargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_writeres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+WC+4,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "WRITE",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_CREATE] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_create,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_createargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_createres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_createargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_createres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "CREATE",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_MKDIR] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_mkdir,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_mkdirargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_createres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_mkdirargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_createres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "MKDIR",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_SYMLINK] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_symlink,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_symlinkargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_createres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_symlinkargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_createres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "SYMLINK",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_MKNOD] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_mknod,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_mknodargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_createres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_mknodargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_createres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "MKNOD",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_REMOVE] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_remove,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_diropargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_wccstatres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "REMOVE",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_RMDIR] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_rmdir,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_diropargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_wccstatres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "RMDIR",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_RENAME] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_rename,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_renameargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_renameres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_renameargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_renameres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+WC+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "RENAME",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_LINK] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_link,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_linkargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_linkres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle2,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_linkargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_linkres),
|
|
|
|
.pc_cachetype = RC_REPLBUFF,
|
|
|
|
.pc_xdrressize = ST+pAT+WC,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "LINK",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_READDIR] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_readdir,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_readdirargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_readdirres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_readdirargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_readdirres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "READDIR",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_READDIRPLUS] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_readdirplus,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_readdirplusargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_readdirres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_readdirplusargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_readdirres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "READDIRPLUS",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_FSSTAT] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_fsstat,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_fhandleargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_fsstatres,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_fsstatres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+2*6+1,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "FSSTAT",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_FSINFO] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_fsinfo,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_fhandleargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_fsinfores,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_fsinfores),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+12,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "FSINFO",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_PATHCONF] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_pathconf,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_fhandleargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_pathconfres,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_pathconfres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+pAT+6,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "PATHCONF",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
|
|
|
[NFS3PROC_COMMIT] = {
|
2017-05-08 15:35:49 +00:00
|
|
|
.pc_func = nfsd3_proc_commit,
|
2017-05-08 17:01:48 +00:00
|
|
|
.pc_decode = nfs3svc_decode_commitargs,
|
2017-05-08 17:42:02 +00:00
|
|
|
.pc_encode = nfs3svc_encode_commitres,
|
2017-05-08 16:48:24 +00:00
|
|
|
.pc_release = nfs3svc_release_fhandle,
|
2009-06-09 09:33:34 +00:00
|
|
|
.pc_argsize = sizeof(struct nfsd3_commitargs),
|
|
|
|
.pc_ressize = sizeof(struct nfsd3_commitres),
|
|
|
|
.pc_cachetype = RC_NOCACHE,
|
|
|
|
.pc_xdrressize = ST+WC+2,
|
2020-09-17 21:22:49 +00:00
|
|
|
.pc_name = "COMMIT",
|
2009-06-09 09:33:34 +00:00
|
|
|
},
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2017-05-08 21:40:27 +00:00
|
|
|
static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
|
2017-05-12 14:21:37 +00:00
|
|
|
const struct svc_version nfsd_version3 = {
|
|
|
|
.vs_vers = 3,
|
|
|
|
.vs_nproc = 22,
|
|
|
|
.vs_proc = nfsd_procedures3,
|
|
|
|
.vs_dispatch = nfsd_dispatch,
|
|
|
|
.vs_count = nfsd_count3,
|
|
|
|
.vs_xdrsize = NFS3_SVC_XDRSIZE,
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|