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;
}
goto out;
status = nfserr_expired;
- stp = find_stateid(stateid, 0);
+ stp = find_stateid(stateid);
if (!stp)
goto out;
status = nfserr_bad_stateid;
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;
goto out;
}
- stp = find_stateid(stateid, 0);
+ stp = find_stateid(stateid);
if (!stp) {
ret = nfserr_bad_stateid;
goto out;
* 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;