Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
fba5d3c4
Commit
fba5d3c4
authored
Apr 10, 2004
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSv4: use the (more efficient) NFSv2/v3-like XDR scheme for looking up the
mountpoint.
parent
efec5fa4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
61 deletions
+111
-61
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+56
-44
fs/nfs/nfs4xdr.c
fs/nfs/nfs4xdr.c
+50
-12
include/linux/nfs4.h
include/linux/nfs4.h
+1
-0
include/linux/nfs_xdr.h
include/linux/nfs_xdr.h
+4
-5
No files found.
fs/nfs/nfs4proc.c
View file @
fba5d3c4
...
...
@@ -54,7 +54,7 @@
#define GET_OP(cp,name) &cp->ops[cp->req_nops].u.name
#define OPNUM(cp) cp->ops[cp->req_nops].opnum
static
int
nfs4_
proc
_fsinfo
(
struct
nfs_server
*
,
struct
nfs_fh
*
,
struct
nfs_fsinfo
*
);
static
int
nfs4_
do
_fsinfo
(
struct
nfs_server
*
,
struct
nfs_fh
*
,
struct
nfs_fsinfo
*
);
static
int
nfs4_async_handle_error
(
struct
rpc_task
*
,
struct
nfs_server
*
);
extern
u32
*
nfs4_decode_dirent
(
u32
*
p
,
struct
nfs_entry
*
entry
,
int
plus
);
extern
struct
rpc_procinfo
nfs4_procedures
[];
...
...
@@ -252,17 +252,6 @@ nfs4_setup_link(struct nfs4_compound *cp, struct qstr *name,
cp
->
req_nops
++
;
}
static
void
nfs4_setup_lookup
(
struct
nfs4_compound
*
cp
,
struct
qstr
*
q
)
{
struct
nfs4_lookup
*
lookup
=
GET_OP
(
cp
,
lookup
);
lookup
->
lo_name
=
q
;
OPNUM
(
cp
)
=
OP_LOOKUP
;
cp
->
req_nops
++
;
}
static
void
nfs4_setup_putfh
(
struct
nfs4_compound
*
cp
,
struct
nfs_fh
*
fhandle
)
{
...
...
@@ -274,13 +263,6 @@ nfs4_setup_putfh(struct nfs4_compound *cp, struct nfs_fh *fhandle)
cp
->
req_nops
++
;
}
static
void
nfs4_setup_putrootfh
(
struct
nfs4_compound
*
cp
)
{
OPNUM
(
cp
)
=
OP_PUTROOTFH
;
cp
->
req_nops
++
;
}
static
void
nfs4_setup_readdir
(
struct
nfs4_compound
*
cp
,
u64
cookie
,
u32
*
verifier
,
struct
page
**
pages
,
unsigned
int
bufsize
,
struct
dentry
*
dentry
)
...
...
@@ -821,30 +803,60 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags)
return
0
;
}
static
int
nfs4_proc_get_root
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
info
)
static
int
nfs4_lookup_root
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
info
)
{
struct
nfs_fattr
*
fattr
=
info
->
fattr
;
struct
nfs4_lookup_root_arg
args
=
{
.
bitmask
=
nfs4_fattr_bitmap
,
};
struct
nfs4_lookup_res
res
=
{
.
server
=
server
,
.
fattr
=
fattr
,
.
fh
=
fhandle
,
};
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_LOOKUP_ROOT
],
.
rpc_argp
=
&
args
,
.
rpc_resp
=
&
res
,
};
fattr
->
valid
=
0
;
return
rpc_call_sync
(
server
->
client
,
&
msg
,
0
);
}
static
int
nfs4_proc_get_root
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
info
)
{
struct
nfs4_compound
compound
;
struct
nfs4_op
ops
[
4
];
struct
nfs_fattr
*
fattr
=
info
->
fattr
;
unsigned
char
*
p
;
struct
qstr
q
;
int
status
;
struct
nfs4_lookup_arg
args
=
{
.
dir_fh
=
fhandle
,
.
name
=
&
q
,
.
bitmask
=
nfs4_fattr_bitmap
,
};
struct
nfs4_lookup_res
res
=
{
.
server
=
server
,
.
fattr
=
fattr
,
.
fh
=
fhandle
,
};
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_LOOKUP
],
.
rpc_argp
=
&
args
,
.
rpc_resp
=
&
res
,
};
int
status
;
/*
* Now we do a separate LOOKUP for each component of the mount path.
* The LOOKUPs are done separately so that we can conveniently
* catch an ERR_WRONGSEC if it occurs along the way...
*/
p
=
server
->
mnt_path
;
fattr
->
valid
=
0
;
nfs4_setup_compound
(
&
compound
,
ops
,
server
,
"getrootfh"
);
nfs4_setup_putrootfh
(
&
compound
);
nfs4_setup_getattr
(
&
compound
,
fattr
);
nfs4_setup_getfh
(
&
compound
,
fhandle
);
if
((
status
=
nfs4_call_compound
(
&
compound
,
NULL
,
0
)))
status
=
nfs4_lookup_root
(
server
,
fhandle
,
info
);
if
(
status
)
goto
out
;
p
=
server
->
mnt_path
;
for
(;;)
{
while
(
*
p
==
'/'
)
p
++
;
...
...
@@ -856,12 +868,7 @@ nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
q
.
len
=
p
-
q
.
name
;
fattr
->
valid
=
0
;
nfs4_setup_compound
(
&
compound
,
ops
,
server
,
"mount"
);
nfs4_setup_putfh
(
&
compound
,
fhandle
);
nfs4_setup_lookup
(
&
compound
,
&
q
);
nfs4_setup_getattr
(
&
compound
,
fattr
);
nfs4_setup_getfh
(
&
compound
,
fhandle
);
status
=
nfs4_call_compound
(
&
compound
,
NULL
,
0
);
status
=
rpc_call_sync
(
server
->
client
,
&
msg
,
0
);
if
(
!
status
)
continue
;
if
(
status
==
-
ENOENT
)
{
...
...
@@ -870,10 +877,10 @@ nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
}
break
;
}
if
(
status
==
0
)
status
=
nfs4_do_fsinfo
(
server
,
fhandle
,
info
);
out:
if
(
status
)
return
nfs4_map_errors
(
status
);
return
nfs4_proc_fsinfo
(
server
,
fhandle
,
info
);
return
nfs4_map_errors
(
status
);
}
static
int
nfs4_proc_getattr
(
struct
inode
*
inode
,
struct
nfs_fattr
*
fattr
)
...
...
@@ -1468,9 +1475,8 @@ nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
return
nfs4_map_errors
(
nfs4_call_compound
(
&
compound
,
NULL
,
0
));
}
static
int
nfs4_proc_fsinfo
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
fsinfo
)
static
int
nfs4_do_fsinfo
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
fsinfo
)
{
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_FSINFO
],
...
...
@@ -1481,6 +1487,12 @@ nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
return
nfs4_map_errors
(
rpc_call_sync
(
server
->
client
,
&
msg
,
0
));
}
static
int
nfs4_proc_fsinfo
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_fsinfo
*
fsinfo
)
{
fsinfo
->
fattr
->
valid
=
0
;
return
nfs4_map_errors
(
nfs4_do_fsinfo
(
server
,
fhandle
,
fsinfo
));
}
static
int
nfs4_proc_pathconf
(
struct
nfs_server
*
server
,
struct
nfs_fh
*
fhandle
,
struct
nfs_pathconf
*
pathconf
)
...
...
fs/nfs/nfs4xdr.c
View file @
fba5d3c4
...
...
@@ -262,6 +262,14 @@ static int nfs_stat_to_errno(int);
op_decode_hdr_maxsz + \
decode_getattr_maxsz + \
decode_getfh_maxsz)
#define NFS4_enc_lookup_root_sz (compound_encode_hdr_maxsz + \
encode_putrootfh_maxsz + \
encode_getattr_maxsz + \
encode_getfh_maxsz)
#define NFS4_dec_lookup_root_sz (compound_decode_hdr_maxsz + \
decode_putrootfh_maxsz + \
decode_getattr_maxsz + \
decode_getfh_maxsz)
...
...
@@ -1088,15 +1096,9 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case
OP_LINK
:
status
=
encode_link
(
xdr
,
&
cp
->
ops
[
i
].
u
.
link
);
break
;
case
OP_LOOKUP
:
status
=
encode_lookup
(
xdr
,
cp
->
ops
[
i
].
u
.
lookup
.
lo_name
);
break
;
case
OP_PUTFH
:
status
=
encode_putfh
(
xdr
,
cp
->
ops
[
i
].
u
.
putfh
.
pf_fhandle
);
break
;
case
OP_PUTROOTFH
:
status
=
encode_putrootfh
(
xdr
);
break
;
case
OP_READDIR
:
status
=
encode_readdir
(
xdr
,
&
cp
->
ops
[
i
].
u
.
readdir
,
req
);
break
;
...
...
@@ -1185,6 +1187,27 @@ static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, uint32_t *p, const struct n
return
status
;
}
/*
* Encode LOOKUP_ROOT request
*/
static
int
nfs4_xdr_enc_lookup_root
(
struct
rpc_rqst
*
req
,
uint32_t
*
p
,
const
struct
nfs4_lookup_root_arg
*
args
)
{
struct
xdr_stream
xdr
;
struct
compound_hdr
hdr
=
{
.
nops
=
3
,
};
int
status
;
xdr_init_encode
(
&
xdr
,
&
req
->
rq_snd_buf
,
p
);
encode_compound_hdr
(
&
xdr
,
&
hdr
);
if
((
status
=
encode_putrootfh
(
&
xdr
))
!=
0
)
goto
out
;
if
((
status
=
encode_getfh
(
&
xdr
))
==
0
)
status
=
encode_getfattr
(
&
xdr
,
args
->
bitmask
);
out:
return
status
;
}
/*
* Encode GETATTR request
*/
...
...
@@ -2902,15 +2925,9 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case
OP_LINK
:
status
=
decode_link
(
xdr
,
&
op
->
u
.
link
);
break
;
case
OP_LOOKUP
:
status
=
decode_lookup
(
xdr
);
break
;
case
OP_PUTFH
:
status
=
decode_putfh
(
xdr
);
break
;
case
OP_PUTROOTFH
:
status
=
decode_putrootfh
(
xdr
);
break
;
case
OP_READDIR
:
status
=
decode_readdir
(
xdr
,
req
,
&
op
->
u
.
readdir
);
break
;
...
...
@@ -3028,6 +3045,26 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_
return
status
;
}
/*
* Decode LOOKUP_ROOT response
*/
static
int
nfs4_xdr_dec_lookup_root
(
struct
rpc_rqst
*
rqstp
,
uint32_t
*
p
,
struct
nfs4_lookup_res
*
res
)
{
struct
xdr_stream
xdr
;
struct
compound_hdr
hdr
;
int
status
;
xdr_init_decode
(
&
xdr
,
&
rqstp
->
rq_rcv_buf
,
p
);
if
((
status
=
decode_compound_hdr
(
&
xdr
,
&
hdr
))
!=
0
)
goto
out
;
if
((
status
=
decode_putrootfh
(
&
xdr
))
!=
0
)
goto
out
;
if
((
status
=
decode_getfh
(
&
xdr
,
res
->
fh
))
==
0
)
status
=
decode_getfattr
(
&
xdr
,
res
->
fattr
,
res
->
server
);
out:
return
status
;
}
/*
* Decode GETATTR response
*/
...
...
@@ -3538,6 +3575,7 @@ struct rpc_procinfo nfs4_procedures[] = {
PROC
(
ACCESS
,
enc_access
,
dec_access
),
PROC
(
GETATTR
,
enc_getattr
,
dec_getattr
),
PROC
(
LOOKUP
,
enc_lookup
,
dec_lookup
),
PROC
(
LOOKUP_ROOT
,
enc_lookup_root
,
dec_lookup_root
),
};
struct
rpc_version
nfs_version4
=
{
...
...
include/linux/nfs4.h
View file @
fba5d3c4
...
...
@@ -306,6 +306,7 @@ enum {
NFSPROC4_CLNT_ACCESS
,
NFSPROC4_CLNT_GETATTR
,
NFSPROC4_CLNT_LOOKUP
,
NFSPROC4_CLNT_LOOKUP_ROOT
,
};
#endif
...
...
include/linux/nfs_xdr.h
View file @
fba5d3c4
...
...
@@ -550,10 +550,6 @@ struct nfs4_link {
struct
nfs4_change_info
*
ln_cinfo
;
/* response */
};
struct
nfs4_lookup
{
struct
qstr
*
lo_name
;
/* request */
};
struct
nfs4_lookup_arg
{
const
struct
nfs_fh
*
dir_fh
;
const
struct
qstr
*
name
;
...
...
@@ -566,6 +562,10 @@ struct nfs4_lookup_res {
struct
nfs_fh
*
fh
;
};
struct
nfs4_lookup_root_arg
{
const
u32
*
bitmask
;
};
struct
nfs4_open
{
struct
nfs4_client
*
op_client_state
;
/* request */
u32
op_share_access
;
/* request */
...
...
@@ -644,7 +644,6 @@ struct nfs4_op {
struct
nfs4_getattr
getattr
;
struct
nfs4_getfh
getfh
;
struct
nfs4_link
link
;
struct
nfs4_lookup
lookup
;
struct
nfs4_open
open
;
struct
nfs4_open_confirm
open_confirm
;
struct
nfs4_putfh
putfh
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment