Commit dc9bf700 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: remove redundant "if" in nfs4_preprocess_stateid_op

Note that we exit this first big "if" with stp == NULL if and only if we
took the first branch; therefore, the second "if" is redundant, and we
can just combine the two, simplifying the logic.
Reviewed-by: default avatarYang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 0c2a498f
...@@ -2087,6 +2087,14 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl ...@@ -2087,6 +2087,14 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl
status = check_stateid_generation(stateid, stidp); status = check_stateid_generation(stateid, stidp);
if (status) if (status)
goto out; goto out;
status = nfs4_check_delegmode(dp, flags);
if (status)
goto out;
renew_client(dp->dl_client);
if (flags & DELEG_RET)
unhash_delegation(dp);
if (filpp)
*filpp = dp->dl_vfs_file;
} else { /* open or lock stateid */ } else { /* open or lock stateid */
stp = find_stateid(stateid, flags); stp = find_stateid(stateid, flags);
if (!stp) { if (!stp) {
...@@ -2101,23 +2109,12 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl ...@@ -2101,23 +2109,12 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl
status = check_stateid_generation(stateid, stidp); status = check_stateid_generation(stateid, stidp);
if (status) if (status)
goto out; goto out;
}
if (stp) {
status = nfs4_check_openmode(stp, flags); status = nfs4_check_openmode(stp, flags);
if (status) if (status)
goto out; goto out;
renew_client(stp->st_stateowner->so_client); renew_client(stp->st_stateowner->so_client);
if (filpp) if (filpp)
*filpp = stp->st_vfs_file; *filpp = stp->st_vfs_file;
} else {
status = nfs4_check_delegmode(dp, flags);
if (status)
goto out;
renew_client(dp->dl_client);
if (flags & DELEG_RET)
unhash_delegation(dp);
if (filpp)
*filpp = dp->dl_vfs_file;
} }
status = nfs_ok; status = nfs_ok;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment