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
907c3822
Commit
907c3822
authored
Oct 22, 2020
by
Chuck Lever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSD: Update the NFSv3 ACCESS3res encoder to use struct xdr_stream
Signed-off-by:
Chuck Lever
<
chuck.lever@oracle.com
>
parent
2c42f804
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
6 deletions
+46
-6
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+45
-5
fs/nfsd/vfs.h
fs/nfsd/vfs.h
+1
-1
No files found.
fs/nfsd/nfs3xdr.c
View file @
907c3822
...
...
@@ -383,6 +383,35 @@ encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
return
encode_fattr3
(
rqstp
,
p
,
fhp
,
&
fhp
->
fh_post_attr
);
}
static
bool
svcxdr_encode_post_op_attr
(
struct
svc_rqst
*
rqstp
,
struct
xdr_stream
*
xdr
,
const
struct
svc_fh
*
fhp
)
{
struct
dentry
*
dentry
=
fhp
->
fh_dentry
;
struct
kstat
stat
;
/*
* The inode may be NULL if the call failed because of a
* stale file handle. In this case, no attributes are
* returned.
*/
if
(
fhp
->
fh_no_wcc
||
!
dentry
||
!
d_really_is_positive
(
dentry
))
goto
no_post_op_attrs
;
if
(
fh_getattr
(
fhp
,
&
stat
)
!=
nfs_ok
)
goto
no_post_op_attrs
;
if
(
xdr_stream_encode_item_present
(
xdr
)
<
0
)
return
false
;
lease_get_mtime
(
d_inode
(
dentry
),
&
stat
.
mtime
);
if
(
!
svcxdr_encode_fattr3
(
rqstp
,
xdr
,
fhp
,
&
stat
))
return
false
;
return
true
;
no_post_op_attrs:
return
xdr_stream_encode_item_absent
(
xdr
)
>
0
;
}
/*
* Encode post-operation attributes.
* The inode may be NULL if the call failed because of a stale file
...
...
@@ -835,13 +864,24 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p)
int
nfs3svc_encode_accessres
(
struct
svc_rqst
*
rqstp
,
__be32
*
p
)
{
struct
xdr_stream
*
xdr
=
&
rqstp
->
rq_res_stream
;
struct
nfsd3_accessres
*
resp
=
rqstp
->
rq_resp
;
*
p
++
=
resp
->
status
;
p
=
encode_post_op_attr
(
rqstp
,
p
,
&
resp
->
fh
);
if
(
resp
->
status
==
0
)
*
p
++
=
htonl
(
resp
->
access
);
return
xdr_ressize_check
(
rqstp
,
p
);
if
(
!
svcxdr_encode_nfsstat3
(
xdr
,
resp
->
status
))
return
0
;
switch
(
resp
->
status
)
{
case
nfs_ok
:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
resp
->
fh
))
return
0
;
if
(
xdr_stream_encode_u32
(
xdr
,
resp
->
access
)
<
0
)
return
0
;
break
;
default:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
resp
->
fh
))
return
0
;
}
return
1
;
}
/* READLINK */
...
...
fs/nfsd/vfs.h
View file @
907c3822
...
...
@@ -152,7 +152,7 @@ static inline void fh_drop_write(struct svc_fh *fh)
}
}
static
inline
__be32
fh_getattr
(
struct
svc_fh
*
fh
,
struct
kstat
*
stat
)
static
inline
__be32
fh_getattr
(
const
struct
svc_fh
*
fh
,
struct
kstat
*
stat
)
{
struct
path
p
=
{.
mnt
=
fh
->
fh_export
->
ex_path
.
mnt
,
.
dentry
=
fh
->
fh_dentry
};
...
...
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