Skip to content

Commit e4e83ea

Browse files
author
J. Bruce Fields
committed
Revert "nfsd4: distinguish expired from stale stateids"
This reverts commit 78155ed. We're depending here on the boot time that we use to generate the stateid being monotonic, but get_seconds() is not necessarily. We still depend at least on boot_time being different every time, but that is a safer bet. We have a few reports of errors that might be explained by this problem, though we haven't been able to confirm any of them. But the minor gain of distinguishing expired from stale errors seems not worth the risk. Conflicts: fs/nfsd/nfs4state.c Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 47cee54 commit e4e83ea

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

fs/nfsd/nfs4state.c

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
190190
dp->dl_vfs_file = stp->st_vfs_file;
191191
dp->dl_type = type;
192192
dp->dl_ident = cb->cb_ident;
193-
dp->dl_stateid.si_boot = get_seconds();
193+
dp->dl_stateid.si_boot = boot_time;
194194
dp->dl_stateid.si_stateownerid = current_delegid++;
195195
dp->dl_stateid.si_fileid = 0;
196196
dp->dl_stateid.si_generation = 0;
@@ -1884,7 +1884,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
18841884
stp->st_stateowner = sop;
18851885
get_nfs4_file(fp);
18861886
stp->st_file = fp;
1887-
stp->st_stateid.si_boot = get_seconds();
1887+
stp->st_stateid.si_boot = boot_time;
18881888
stp->st_stateid.si_stateownerid = sop->so_id;
18891889
stp->st_stateid.si_fileid = fp->fi_id;
18901890
stp->st_stateid.si_generation = 0;
@@ -2733,39 +2733,11 @@ nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
27332733
static int
27342734
STALE_STATEID(stateid_t *stateid)
27352735
{
2736-
if (time_after((unsigned long)boot_time,
2737-
(unsigned long)stateid->si_boot)) {
2738-
dprintk("NFSD: stale stateid " STATEID_FMT "!\n",
2739-
STATEID_VAL(stateid));
2740-
return 1;
2741-
}
2742-
return 0;
2743-
}
2744-
2745-
static int
2746-
EXPIRED_STATEID(stateid_t *stateid)
2747-
{
2748-
if (time_before((unsigned long)boot_time,
2749-
((unsigned long)stateid->si_boot)) &&
2750-
time_before((unsigned long)(stateid->si_boot + nfsd4_lease), get_seconds())) {
2751-
dprintk("NFSD: expired stateid " STATEID_FMT "!\n",
2752-
STATEID_VAL(stateid));
2753-
return 1;
2754-
}
2755-
return 0;
2756-
}
2757-
2758-
static __be32
2759-
stateid_error_map(stateid_t *stateid)
2760-
{
2761-
if (STALE_STATEID(stateid))
2762-
return nfserr_stale_stateid;
2763-
if (EXPIRED_STATEID(stateid))
2764-
return nfserr_expired;
2765-
2766-
dprintk("NFSD: bad stateid " STATEID_FMT "!\n",
2736+
if (stateid->si_boot == boot_time)
2737+
return 0;
2738+
dprintk("NFSD: stale stateid " STATEID_FMT "!\n",
27672739
STATEID_VAL(stateid));
2768-
return nfserr_bad_stateid;
2740+
return 1;
27692741
}
27702742

27712743
static inline int
@@ -2889,10 +2861,8 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
28892861
status = nfserr_bad_stateid;
28902862
if (is_delegation_stateid(stateid)) {
28912863
dp = find_delegation_stateid(ino, stateid);
2892-
if (!dp) {
2893-
status = stateid_error_map(stateid);
2864+
if (!dp)
28942865
goto out;
2895-
}
28962866
status = check_stateid_generation(stateid, &dp->dl_stateid,
28972867
flags);
28982868
if (status)
@@ -2905,10 +2875,8 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
29052875
*filpp = dp->dl_vfs_file;
29062876
} else { /* open or lock stateid */
29072877
stp = find_stateid(stateid, flags);
2908-
if (!stp) {
2909-
status = stateid_error_map(stateid);
2878+
if (!stp)
29102879
goto out;
2911-
}
29122880
if (nfs4_check_fh(current_fh, stp))
29132881
goto out;
29142882
if (!stp->st_stateowner->so_confirmed)
@@ -2980,7 +2948,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
29802948
*/
29812949
sop = search_close_lru(stateid->si_stateownerid, flags);
29822950
if (sop == NULL)
2983-
return stateid_error_map(stateid);
2951+
return nfserr_bad_stateid;
29842952
*sopp = sop;
29852953
goto check_replay;
29862954
}
@@ -3247,10 +3215,8 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
32473215
if (!is_delegation_stateid(stateid))
32483216
goto out;
32493217
dp = find_delegation_stateid(inode, stateid);
3250-
if (!dp) {
3251-
status = stateid_error_map(stateid);
3218+
if (!dp)
32523219
goto out;
3253-
}
32543220
status = check_stateid_generation(stateid, &dp->dl_stateid, flags);
32553221
if (status)
32563222
goto out;
@@ -3476,7 +3442,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc
34763442
stp->st_stateowner = sop;
34773443
get_nfs4_file(fp);
34783444
stp->st_file = fp;
3479-
stp->st_stateid.si_boot = get_seconds();
3445+
stp->st_stateid.si_boot = boot_time;
34803446
stp->st_stateid.si_stateownerid = sop->so_id;
34813447
stp->st_stateid.si_fileid = fp->fi_id;
34823448
stp->st_stateid.si_generation = 0;

0 commit comments

Comments
 (0)