Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f32f3c2d authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd4: initialize special stateid's at compile time



Stateid's with "other" ("opaque") field all zeros or all ones are
reserved.  We define all_ones separately on the off chance there will be
more such some day, though currently all the other special stateid's
have zero other field.

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent f5c8593b
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -49,12 +49,20 @@
time_t nfsd4_lease = 90;     /* default lease time */
time_t nfsd4_lease = 90;     /* default lease time */
time_t nfsd4_grace = 90;
time_t nfsd4_grace = 90;
static time_t boot_time;
static time_t boot_time;
static stateid_t zerostateid;             /* bits all 0 */

static stateid_t onestateid;              /* bits all 1 */
#define all_ones {{~0,~0},~0}
static const stateid_t one_stateid = {
	.si_generation = ~0,
	.si_opaque = all_ones,
};
static const stateid_t zero_stateid = {
	/* all fields zero */
};

static u64 current_sessionid = 1;
static u64 current_sessionid = 1;


#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
#define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t)))
#define ONE_STATEID(stateid)  (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
#define ONE_STATEID(stateid)  (!memcmp((stateid), &one_stateid, sizeof(stateid_t)))


/* forward declarations */
/* forward declarations */
static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
@@ -4564,7 +4572,6 @@ nfs4_state_init(void)
	}
	}
	for (i = 0; i < LOCKOWNER_INO_HASH_SIZE; i++)
	for (i = 0; i < LOCKOWNER_INO_HASH_SIZE; i++)
		INIT_LIST_HEAD(&lockowner_ino_hashtbl[i]);
		INIT_LIST_HEAD(&lockowner_ino_hashtbl[i]);
	memset(&onestateid, ~0, sizeof(stateid_t));
	INIT_LIST_HEAD(&close_lru);
	INIT_LIST_HEAD(&close_lru);
	INIT_LIST_HEAD(&client_lru);
	INIT_LIST_HEAD(&client_lru);
	INIT_LIST_HEAD(&del_recall_lru);
	INIT_LIST_HEAD(&del_recall_lru);