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
4d71ab87
Commit
4d71ab87
authored
Sep 06, 2011
by
J. Bruce Fields
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nfsd4: split up find_stateid
Minor cleanup. Signed-off-by:
J. Bruce Fields
<
bfields@redhat.com
>
parent
4581d140
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
fs/nfsd/nfs4state.c
fs/nfsd/nfs4state.c
+21
-13
No files found.
fs/nfsd/nfs4state.c
View file @
4d71ab87
...
...
@@ -1068,21 +1068,29 @@ same_stateid(stateid_t *id_one, stateid_t *id_two)
return
id_one
->
si_fileid
==
id_two
->
si_fileid
;
}
static
struct
nfs4_stateid
*
find_stateid
(
stateid_t
*
t
,
int
flags
)
static
struct
nfs4_stateid
*
find_stateid
(
stateid_t
*
t
)
{
struct
nfs4_stateid
*
s
;
unsigned
int
hashval
;
hashval
=
stateid_hashval
(
t
->
si_stateownerid
,
t
->
si_fileid
);
list_for_each_entry
(
s
,
&
stateid_hashtbl
[
hashval
],
st_hash
)
{
if
(
!
same_stateid
(
&
s
->
st_stateid
,
t
))
continue
;
if
(
flags
&
LOCK_STATE
&&
s
->
st_type
!=
NFS4_LOCK_STID
)
return
NULL
;
if
(
flags
&
OPEN_STATE
&&
s
->
st_type
!=
NFS4_OPEN_STID
)
return
NULL
;
list_for_each_entry
(
s
,
&
stateid_hashtbl
[
hashval
],
st_hash
)
if
(
same_stateid
(
&
s
->
st_stateid
,
t
))
return
s
;
return
NULL
;
}
static
struct
nfs4_stateid
*
find_stateid_by_type
(
stateid_t
*
t
,
int
flags
)
{
struct
nfs4_stateid
*
s
;
s
=
find_stateid
(
t
);
if
(
!
s
)
return
NULL
;
if
(
flags
&
LOCK_STATE
&&
s
->
st_type
==
NFS4_LOCK_STID
)
return
s
;
if
(
flags
&
OPEN_STATE
&&
s
->
st_type
==
NFS4_OPEN_STID
)
return
s
;
}
return
NULL
;
}
...
...
@@ -3241,7 +3249,7 @@ __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session)
goto
out
;
status
=
nfserr_expired
;
stp
=
find_stateid
(
stateid
,
0
);
stp
=
find_stateid
(
stateid
);
if
(
!
stp
)
goto
out
;
status
=
nfserr_bad_stateid
;
...
...
@@ -3306,7 +3314,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
BUG_ON
(
!*
filpp
);
}
}
else
{
/* open or lock stateid */
stp
=
find_stateid
(
stateid
,
flags
);
stp
=
find_stateid
(
stateid
);
if
(
!
stp
)
goto
out
;
status
=
nfserr_bad_stateid
;
...
...
@@ -3381,7 +3389,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto
out
;
}
stp
=
find_stateid
(
stateid
,
0
);
stp
=
find_stateid
(
stateid
);
if
(
!
stp
)
{
ret
=
nfserr_bad_stateid
;
goto
out
;
...
...
@@ -3440,7 +3448,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
* the confirmed flag is incorrecly set, or the generation
* number is incorrect.
*/
*
stpp
=
find_stateid
(
stateid
,
flags
);
*
stpp
=
find_stateid
_by_type
(
stateid
,
flags
);
if
(
*
stpp
==
NULL
)
return
nfserr_expired
;
...
...
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