mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
nfsd4: split stateowners into open and lockowners
The stateowner has some fields that only make sense for openowners, and some that only make sense for lockowners, and I find it a lot clearer if those are separated out. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
f4dee24cca
commit
fe0750e5c4
@ -250,7 +250,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
|
|||||||
fh_dup2(current_fh, &resfh);
|
fh_dup2(current_fh, &resfh);
|
||||||
|
|
||||||
/* set reply cache */
|
/* set reply cache */
|
||||||
fh_copy_shallow(&open->op_stateowner->so_replay.rp_openfh,
|
fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
|
||||||
&resfh.fh_handle);
|
&resfh.fh_handle);
|
||||||
if (!created)
|
if (!created)
|
||||||
status = do_open_permission(rqstp, current_fh, open,
|
status = do_open_permission(rqstp, current_fh, open,
|
||||||
@ -277,7 +277,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
|
|||||||
memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
|
memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
|
||||||
|
|
||||||
/* set replay cache */
|
/* set replay cache */
|
||||||
fh_copy_shallow(&open->op_stateowner->so_replay.rp_openfh,
|
fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
|
||||||
¤t_fh->fh_handle);
|
¤t_fh->fh_handle);
|
||||||
|
|
||||||
open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
|
open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
|
||||||
@ -306,9 +306,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
__be32 status;
|
__be32 status;
|
||||||
struct nfsd4_compoundres *resp;
|
struct nfsd4_compoundres *resp;
|
||||||
|
|
||||||
dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
|
dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n",
|
||||||
(int)open->op_fname.len, open->op_fname.data,
|
(int)open->op_fname.len, open->op_fname.data,
|
||||||
open->op_stateowner);
|
open->op_openowner);
|
||||||
|
|
||||||
/* This check required by spec. */
|
/* This check required by spec. */
|
||||||
if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
|
if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
|
||||||
@ -332,7 +332,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
resp = rqstp->rq_resp;
|
resp = rqstp->rq_resp;
|
||||||
status = nfsd4_process_open1(&resp->cstate, open);
|
status = nfsd4_process_open1(&resp->cstate, open);
|
||||||
if (status == nfserr_replay_me) {
|
if (status == nfserr_replay_me) {
|
||||||
struct nfs4_replay *rp = &open->op_stateowner->so_replay;
|
struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;
|
||||||
fh_put(&cstate->current_fh);
|
fh_put(&cstate->current_fh);
|
||||||
fh_copy_shallow(&cstate->current_fh.fh_handle,
|
fh_copy_shallow(&cstate->current_fh.fh_handle,
|
||||||
&rp->rp_openfh);
|
&rp->rp_openfh);
|
||||||
@ -374,7 +374,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
case NFS4_OPEN_CLAIM_PREVIOUS:
|
case NFS4_OPEN_CLAIM_PREVIOUS:
|
||||||
open->op_stateowner->so_confirmed = 1;
|
open->op_openowner->oo_confirmed = 1;
|
||||||
/*
|
/*
|
||||||
* The CURRENT_FH is already set to the file being
|
* The CURRENT_FH is already set to the file being
|
||||||
* opened. (1) set open->op_cinfo, (2) set
|
* opened. (1) set open->op_cinfo, (2) set
|
||||||
@ -387,7 +387,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
case NFS4_OPEN_CLAIM_DELEGATE_PREV:
|
case NFS4_OPEN_CLAIM_DELEGATE_PREV:
|
||||||
open->op_stateowner->so_confirmed = 1;
|
open->op_openowner->oo_confirmed = 1;
|
||||||
dprintk("NFSD: unsupported OPEN claim type %d\n",
|
dprintk("NFSD: unsupported OPEN claim type %d\n",
|
||||||
open->op_claim_type);
|
open->op_claim_type);
|
||||||
status = nfserr_notsupp;
|
status = nfserr_notsupp;
|
||||||
@ -405,8 +405,8 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
*/
|
*/
|
||||||
status = nfsd4_process_open2(rqstp, &cstate->current_fh, open);
|
status = nfsd4_process_open2(rqstp, &cstate->current_fh, open);
|
||||||
out:
|
out:
|
||||||
if (open->op_stateowner)
|
if (open->op_openowner)
|
||||||
cstate->replay_owner = open->op_stateowner;
|
cstate->replay_owner = &open->op_openowner->oo_owner;
|
||||||
else
|
else
|
||||||
nfs4_unlock_state();
|
nfs4_unlock_state();
|
||||||
return status;
|
return status;
|
||||||
|
@ -63,7 +63,7 @@ static u64 current_sessionid = 1;
|
|||||||
static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
|
static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
|
||||||
static struct nfs4_delegation * search_for_delegation(stateid_t *stid);
|
static struct nfs4_delegation * search_for_delegation(stateid_t *stid);
|
||||||
static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
|
static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
|
||||||
static int check_for_locks(struct nfs4_file *filp, struct nfs4_stateowner *lowner);
|
static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
|
||||||
|
|
||||||
/* Locking: */
|
/* Locking: */
|
||||||
|
|
||||||
@ -77,7 +77,8 @@ static DEFINE_MUTEX(client_mutex);
|
|||||||
*/
|
*/
|
||||||
static DEFINE_SPINLOCK(recall_lock);
|
static DEFINE_SPINLOCK(recall_lock);
|
||||||
|
|
||||||
static struct kmem_cache *stateowner_slab = NULL;
|
static struct kmem_cache *openowner_slab = NULL;
|
||||||
|
static struct kmem_cache *lockowner_slab = NULL;
|
||||||
static struct kmem_cache *file_slab = NULL;
|
static struct kmem_cache *file_slab = NULL;
|
||||||
static struct kmem_cache *stateid_slab = NULL;
|
static struct kmem_cache *stateid_slab = NULL;
|
||||||
static struct kmem_cache *deleg_slab = NULL;
|
static struct kmem_cache *deleg_slab = NULL;
|
||||||
@ -432,41 +433,39 @@ static void release_lock_stateid(struct nfs4_stateid *stp)
|
|||||||
unhash_generic_stateid(stp);
|
unhash_generic_stateid(stp);
|
||||||
file = find_any_file(stp->st_file);
|
file = find_any_file(stp->st_file);
|
||||||
if (file)
|
if (file)
|
||||||
locks_remove_posix(file, (fl_owner_t)stp->st_stateowner);
|
locks_remove_posix(file, (fl_owner_t)lockowner(stp->st_stateowner));
|
||||||
free_generic_stateid(stp);
|
free_generic_stateid(stp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unhash_lockowner(struct nfs4_stateowner *sop)
|
static void unhash_lockowner(struct nfs4_lockowner *lo)
|
||||||
{
|
{
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
|
|
||||||
list_del(&sop->so_idhash);
|
list_del(&lo->lo_owner.so_idhash);
|
||||||
list_del(&sop->so_strhash);
|
list_del(&lo->lo_owner.so_strhash);
|
||||||
list_del(&sop->so_perstateid);
|
list_del(&lo->lo_perstateid);
|
||||||
while (!list_empty(&sop->so_stateids)) {
|
while (!list_empty(&lo->lo_owner.so_stateids)) {
|
||||||
stp = list_first_entry(&sop->so_stateids,
|
stp = list_first_entry(&lo->lo_owner.so_stateids,
|
||||||
struct nfs4_stateid, st_perstateowner);
|
struct nfs4_stateid, st_perstateowner);
|
||||||
release_lock_stateid(stp);
|
release_lock_stateid(stp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_lockowner(struct nfs4_stateowner *sop)
|
static void release_lockowner(struct nfs4_lockowner *lo)
|
||||||
{
|
{
|
||||||
unhash_lockowner(sop);
|
unhash_lockowner(lo);
|
||||||
nfs4_free_stateowner(sop);
|
nfs4_free_lockowner(lo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
release_stateid_lockowners(struct nfs4_stateid *open_stp)
|
release_stateid_lockowners(struct nfs4_stateid *open_stp)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *lock_sop;
|
struct nfs4_lockowner *lo;
|
||||||
|
|
||||||
while (!list_empty(&open_stp->st_lockowners)) {
|
while (!list_empty(&open_stp->st_lockowners)) {
|
||||||
lock_sop = list_entry(open_stp->st_lockowners.next,
|
lo = list_entry(open_stp->st_lockowners.next,
|
||||||
struct nfs4_stateowner, so_perstateid);
|
struct nfs4_lockowner, lo_perstateid);
|
||||||
/* list_del(&open_stp->st_lockowners); */
|
release_lockowner(lo);
|
||||||
BUG_ON(lock_sop->so_is_open_owner);
|
|
||||||
release_lockowner(lock_sop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,26 +476,25 @@ static void release_open_stateid(struct nfs4_stateid *stp)
|
|||||||
free_generic_stateid(stp);
|
free_generic_stateid(stp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unhash_openowner(struct nfs4_stateowner *sop)
|
static void unhash_openowner(struct nfs4_openowner *oo)
|
||||||
{
|
{
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
|
|
||||||
list_del(&sop->so_idhash);
|
list_del(&oo->oo_owner.so_idhash);
|
||||||
list_del(&sop->so_strhash);
|
list_del(&oo->oo_owner.so_strhash);
|
||||||
list_del(&sop->so_perclient);
|
list_del(&oo->oo_perclient);
|
||||||
list_del(&sop->so_perstateid); /* XXX: necessary? */
|
while (!list_empty(&oo->oo_owner.so_stateids)) {
|
||||||
while (!list_empty(&sop->so_stateids)) {
|
stp = list_first_entry(&oo->oo_owner.so_stateids,
|
||||||
stp = list_first_entry(&sop->so_stateids,
|
|
||||||
struct nfs4_stateid, st_perstateowner);
|
struct nfs4_stateid, st_perstateowner);
|
||||||
release_open_stateid(stp);
|
release_open_stateid(stp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_openowner(struct nfs4_stateowner *sop)
|
static void release_openowner(struct nfs4_openowner *oo)
|
||||||
{
|
{
|
||||||
unhash_openowner(sop);
|
unhash_openowner(oo);
|
||||||
list_del(&sop->so_close_lru);
|
list_del(&oo->oo_close_lru);
|
||||||
nfs4_free_stateowner(sop);
|
nfs4_free_openowner(oo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SESSION_HASH_SIZE 512
|
#define SESSION_HASH_SIZE 512
|
||||||
@ -961,7 +959,7 @@ unhash_client_locked(struct nfs4_client *clp)
|
|||||||
static void
|
static void
|
||||||
expire_client(struct nfs4_client *clp)
|
expire_client(struct nfs4_client *clp)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_openowner *oo;
|
||||||
struct nfs4_delegation *dp;
|
struct nfs4_delegation *dp;
|
||||||
struct list_head reaplist;
|
struct list_head reaplist;
|
||||||
|
|
||||||
@ -979,8 +977,8 @@ expire_client(struct nfs4_client *clp)
|
|||||||
unhash_delegation(dp);
|
unhash_delegation(dp);
|
||||||
}
|
}
|
||||||
while (!list_empty(&clp->cl_openowners)) {
|
while (!list_empty(&clp->cl_openowners)) {
|
||||||
sop = list_entry(clp->cl_openowners.next, struct nfs4_stateowner, so_perclient);
|
oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient);
|
||||||
release_openowner(sop);
|
release_openowner(oo);
|
||||||
}
|
}
|
||||||
nfsd4_shutdown_callback(clp);
|
nfsd4_shutdown_callback(clp);
|
||||||
if (clp->cl_cb_conn.cb_xprt)
|
if (clp->cl_cb_conn.cb_xprt)
|
||||||
@ -2173,7 +2171,8 @@ nfsd4_free_slab(struct kmem_cache **slab)
|
|||||||
void
|
void
|
||||||
nfsd4_free_slabs(void)
|
nfsd4_free_slabs(void)
|
||||||
{
|
{
|
||||||
nfsd4_free_slab(&stateowner_slab);
|
nfsd4_free_slab(&openowner_slab);
|
||||||
|
nfsd4_free_slab(&lockowner_slab);
|
||||||
nfsd4_free_slab(&file_slab);
|
nfsd4_free_slab(&file_slab);
|
||||||
nfsd4_free_slab(&stateid_slab);
|
nfsd4_free_slab(&stateid_slab);
|
||||||
nfsd4_free_slab(&deleg_slab);
|
nfsd4_free_slab(&deleg_slab);
|
||||||
@ -2182,9 +2181,13 @@ nfsd4_free_slabs(void)
|
|||||||
static int
|
static int
|
||||||
nfsd4_init_slabs(void)
|
nfsd4_init_slabs(void)
|
||||||
{
|
{
|
||||||
stateowner_slab = kmem_cache_create("nfsd4_stateowners",
|
openowner_slab = kmem_cache_create("nfsd4_openowners",
|
||||||
sizeof(struct nfs4_stateowner), 0, 0, NULL);
|
sizeof(struct nfs4_openowner), 0, 0, NULL);
|
||||||
if (stateowner_slab == NULL)
|
if (openowner_slab == NULL)
|
||||||
|
goto out_nomem;
|
||||||
|
lockowner_slab = kmem_cache_create("nfsd4_lockowners",
|
||||||
|
sizeof(struct nfs4_openowner), 0, 0, NULL);
|
||||||
|
if (lockowner_slab == NULL)
|
||||||
goto out_nomem;
|
goto out_nomem;
|
||||||
file_slab = kmem_cache_create("nfsd4_files",
|
file_slab = kmem_cache_create("nfsd4_files",
|
||||||
sizeof(struct nfs4_file), 0, 0, NULL);
|
sizeof(struct nfs4_file), 0, 0, NULL);
|
||||||
@ -2205,11 +2208,16 @@ out_nomem:
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void nfs4_free_openowner(struct nfs4_openowner *oo)
|
||||||
nfs4_free_stateowner(struct nfs4_stateowner *sop)
|
|
||||||
{
|
{
|
||||||
kfree(sop->so_owner.data);
|
kfree(oo->oo_owner.so_owner.data);
|
||||||
kmem_cache_free(stateowner_slab, sop);
|
kmem_cache_free(openowner_slab, oo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nfs4_free_lockowner(struct nfs4_lockowner *lo)
|
||||||
|
{
|
||||||
|
kfree(lo->lo_owner.so_owner.data);
|
||||||
|
kmem_cache_free(lockowner_slab, lo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_nfs4_replay(struct nfs4_replay *rp)
|
static void init_nfs4_replay(struct nfs4_replay *rp)
|
||||||
@ -2219,74 +2227,72 @@ static void init_nfs4_replay(struct nfs4_replay *rp)
|
|||||||
rp->rp_buf = rp->rp_ibuf;
|
rp->rp_buf = rp->rp_ibuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct nfs4_stateowner *alloc_stateowner(struct xdr_netobj *owner, struct nfs4_client *clp)
|
static inline void *alloc_stateowner(struct kmem_cache *slab, struct xdr_netobj *owner, struct nfs4_client *clp)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_stateowner *sop;
|
||||||
|
|
||||||
sop = kmem_cache_alloc(stateowner_slab, GFP_KERNEL);
|
sop = kmem_cache_alloc(slab, GFP_KERNEL);
|
||||||
if (!sop)
|
if (!sop)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sop->so_owner.data = kmemdup(owner->data, owner->len, GFP_KERNEL);
|
sop->so_owner.data = kmemdup(owner->data, owner->len, GFP_KERNEL);
|
||||||
if (!sop->so_owner.data) {
|
if (!sop->so_owner.data) {
|
||||||
kmem_cache_free(stateowner_slab, sop);
|
kmem_cache_free(slab, sop);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sop->so_owner.len = owner->len;
|
sop->so_owner.len = owner->len;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&sop->so_perclient);
|
|
||||||
INIT_LIST_HEAD(&sop->so_stateids);
|
INIT_LIST_HEAD(&sop->so_stateids);
|
||||||
INIT_LIST_HEAD(&sop->so_perstateid);
|
|
||||||
INIT_LIST_HEAD(&sop->so_close_lru);
|
|
||||||
sop->so_id = current_ownerid++;
|
sop->so_id = current_ownerid++;
|
||||||
sop->so_time = 0;
|
|
||||||
sop->so_client = clp;
|
sop->so_client = clp;
|
||||||
init_nfs4_replay(&sop->so_replay);
|
init_nfs4_replay(&sop->so_replay);
|
||||||
return sop;
|
return sop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hash_openowner(struct nfs4_stateowner *sop, struct nfs4_client *clp, unsigned int strhashval)
|
static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, unsigned int strhashval)
|
||||||
{
|
{
|
||||||
unsigned int idhashval;
|
unsigned int idhashval;
|
||||||
|
|
||||||
idhashval = open_ownerid_hashval(sop->so_id);
|
idhashval = open_ownerid_hashval(oo->oo_owner.so_id);
|
||||||
list_add(&sop->so_idhash, &open_ownerid_hashtbl[idhashval]);
|
list_add(&oo->oo_owner.so_idhash, &open_ownerid_hashtbl[idhashval]);
|
||||||
list_add(&sop->so_strhash, &open_ownerstr_hashtbl[strhashval]);
|
list_add(&oo->oo_owner.so_strhash, &open_ownerstr_hashtbl[strhashval]);
|
||||||
list_add(&sop->so_perclient, &clp->cl_openowners);
|
list_add(&oo->oo_perclient, &clp->cl_openowners);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_stateowner *
|
static struct nfs4_openowner *
|
||||||
alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfsd4_open *open) {
|
alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfsd4_open *open) {
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_openowner *oo;
|
||||||
|
|
||||||
sop = alloc_stateowner(&open->op_owner, clp);
|
oo = alloc_stateowner(openowner_slab, &open->op_owner, clp);
|
||||||
if (!sop)
|
if (!oo)
|
||||||
return NULL;
|
return NULL;
|
||||||
sop->so_is_open_owner = 1;
|
oo->oo_owner.so_is_open_owner = 1;
|
||||||
sop->so_seqid = open->op_seqid;
|
oo->oo_owner.so_seqid = open->op_seqid;
|
||||||
sop->so_confirmed = 0;
|
oo->oo_confirmed = 0;
|
||||||
hash_openowner(sop, clp, strhashval);
|
oo->oo_time = 0;
|
||||||
return sop;
|
INIT_LIST_HEAD(&oo->oo_close_lru);
|
||||||
|
hash_openowner(oo, clp, strhashval);
|
||||||
|
return oo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) {
|
init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) {
|
||||||
struct nfs4_stateowner *sop = open->op_stateowner;
|
struct nfs4_openowner *oo = open->op_openowner;
|
||||||
unsigned int hashval = stateid_hashval(sop->so_id, fp->fi_id);
|
unsigned int hashval = stateid_hashval(oo->oo_owner.so_id, fp->fi_id);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&stp->st_hash);
|
INIT_LIST_HEAD(&stp->st_hash);
|
||||||
INIT_LIST_HEAD(&stp->st_perstateowner);
|
INIT_LIST_HEAD(&stp->st_perstateowner);
|
||||||
INIT_LIST_HEAD(&stp->st_lockowners);
|
INIT_LIST_HEAD(&stp->st_lockowners);
|
||||||
INIT_LIST_HEAD(&stp->st_perfile);
|
INIT_LIST_HEAD(&stp->st_perfile);
|
||||||
list_add(&stp->st_hash, &stateid_hashtbl[hashval]);
|
list_add(&stp->st_hash, &stateid_hashtbl[hashval]);
|
||||||
list_add(&stp->st_perstateowner, &sop->so_stateids);
|
list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids);
|
||||||
list_add(&stp->st_perfile, &fp->fi_stateids);
|
list_add(&stp->st_perfile, &fp->fi_stateids);
|
||||||
stp->st_type = NFS4_OPEN_STID;
|
stp->st_type = NFS4_OPEN_STID;
|
||||||
stp->st_stateowner = sop;
|
stp->st_stateowner = &oo->oo_owner;
|
||||||
get_nfs4_file(fp);
|
get_nfs4_file(fp);
|
||||||
stp->st_file = fp;
|
stp->st_file = fp;
|
||||||
stp->st_stateid.si_boot = boot_time;
|
stp->st_stateid.si_boot = boot_time;
|
||||||
stp->st_stateid.si_stateownerid = sop->so_id;
|
stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
|
||||||
stp->st_stateid.si_fileid = fp->fi_id;
|
stp->st_stateid.si_fileid = fp->fi_id;
|
||||||
/* note will be incremented before first return to client: */
|
/* note will be incremented before first return to client: */
|
||||||
stp->st_stateid.si_generation = 0;
|
stp->st_stateid.si_generation = 0;
|
||||||
@ -2299,12 +2305,12 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move_to_close_lru(struct nfs4_stateowner *sop)
|
move_to_close_lru(struct nfs4_openowner *oo)
|
||||||
{
|
{
|
||||||
dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop);
|
dprintk("NFSD: move_to_close_lru nfs4_openowner %p\n", oo);
|
||||||
|
|
||||||
list_move_tail(&sop->so_close_lru, &close_lru);
|
list_move_tail(&oo->oo_close_lru, &close_lru);
|
||||||
sop->so_time = get_seconds();
|
oo->oo_time = get_seconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2316,14 +2322,14 @@ same_owner_str(struct nfs4_stateowner *sop, struct xdr_netobj *owner,
|
|||||||
(sop->so_client->cl_clientid.cl_id == clid->cl_id);
|
(sop->so_client->cl_clientid.cl_id == clid->cl_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_stateowner *
|
static struct nfs4_openowner *
|
||||||
find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open)
|
find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *so = NULL;
|
struct nfs4_stateowner *so = NULL;
|
||||||
|
|
||||||
list_for_each_entry(so, &open_ownerstr_hashtbl[hashval], so_strhash) {
|
list_for_each_entry(so, &open_ownerstr_hashtbl[hashval], so_strhash) {
|
||||||
if (same_owner_str(so, &open->op_owner, &open->op_clientid))
|
if (same_owner_str(so, &open->op_owner, &open->op_clientid))
|
||||||
return so;
|
return container_of(so, struct nfs4_openowner, oo_owner);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2474,7 +2480,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
|
|||||||
clientid_t *clientid = &open->op_clientid;
|
clientid_t *clientid = &open->op_clientid;
|
||||||
struct nfs4_client *clp = NULL;
|
struct nfs4_client *clp = NULL;
|
||||||
unsigned int strhashval;
|
unsigned int strhashval;
|
||||||
struct nfs4_stateowner *sop = NULL;
|
struct nfs4_openowner *oo = NULL;
|
||||||
__be32 status;
|
__be32 status;
|
||||||
|
|
||||||
if (!check_name(open->op_owner))
|
if (!check_name(open->op_owner))
|
||||||
@ -2484,34 +2490,34 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
|
|||||||
return nfserr_stale_clientid;
|
return nfserr_stale_clientid;
|
||||||
|
|
||||||
strhashval = open_ownerstr_hashval(clientid->cl_id, &open->op_owner);
|
strhashval = open_ownerstr_hashval(clientid->cl_id, &open->op_owner);
|
||||||
sop = find_openstateowner_str(strhashval, open);
|
oo = find_openstateowner_str(strhashval, open);
|
||||||
open->op_stateowner = sop;
|
open->op_openowner = oo;
|
||||||
if (!sop) {
|
if (!oo) {
|
||||||
/* Make sure the client's lease hasn't expired. */
|
/* Make sure the client's lease hasn't expired. */
|
||||||
clp = find_confirmed_client(clientid);
|
clp = find_confirmed_client(clientid);
|
||||||
if (clp == NULL)
|
if (clp == NULL)
|
||||||
return nfserr_expired;
|
return nfserr_expired;
|
||||||
goto renew;
|
goto renew;
|
||||||
}
|
}
|
||||||
if (!sop->so_confirmed) {
|
if (!oo->oo_confirmed) {
|
||||||
/* Replace unconfirmed owners without checking for replay. */
|
/* Replace unconfirmed owners without checking for replay. */
|
||||||
clp = sop->so_client;
|
clp = oo->oo_owner.so_client;
|
||||||
release_openowner(sop);
|
release_openowner(oo);
|
||||||
open->op_stateowner = NULL;
|
open->op_openowner = NULL;
|
||||||
goto renew;
|
goto renew;
|
||||||
}
|
}
|
||||||
status = nfsd4_check_seqid(cstate, sop, open->op_seqid);
|
status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
renew:
|
renew:
|
||||||
if (open->op_stateowner == NULL) {
|
if (open->op_openowner == NULL) {
|
||||||
sop = alloc_init_open_stateowner(strhashval, clp, open);
|
oo = alloc_init_open_stateowner(strhashval, clp, open);
|
||||||
if (sop == NULL)
|
if (oo == NULL)
|
||||||
return nfserr_jukebox;
|
return nfserr_jukebox;
|
||||||
open->op_stateowner = sop;
|
open->op_openowner = oo;
|
||||||
}
|
}
|
||||||
list_del_init(&sop->so_close_lru);
|
list_del_init(&oo->oo_close_lru);
|
||||||
renew_client(sop->so_client);
|
renew_client(oo->oo_owner.so_client);
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2565,7 +2571,7 @@ out:
|
|||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
open->op_stateowner->so_confirmed = 1;
|
open->op_openowner->oo_confirmed = 1;
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2573,14 +2579,14 @@ static __be32
|
|||||||
nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp)
|
nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp)
|
||||||
{
|
{
|
||||||
struct nfs4_stateid *local;
|
struct nfs4_stateid *local;
|
||||||
struct nfs4_stateowner *sop = open->op_stateowner;
|
struct nfs4_openowner *oo = open->op_openowner;
|
||||||
|
|
||||||
list_for_each_entry(local, &fp->fi_stateids, st_perfile) {
|
list_for_each_entry(local, &fp->fi_stateids, st_perfile) {
|
||||||
/* ignore lock owners */
|
/* ignore lock owners */
|
||||||
if (local->st_stateowner->so_is_open_owner == 0)
|
if (local->st_stateowner->so_is_open_owner == 0)
|
||||||
continue;
|
continue;
|
||||||
/* remember if we have seen this open owner */
|
/* remember if we have seen this open owner */
|
||||||
if (local->st_stateowner == sop)
|
if (local->st_stateowner == &oo->oo_owner)
|
||||||
*stpp = local;
|
*stpp = local;
|
||||||
/* check for conflicting share reservations */
|
/* check for conflicting share reservations */
|
||||||
if (!test_share(local, open))
|
if (!test_share(local, open))
|
||||||
@ -2698,8 +2704,8 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
|
|||||||
static void
|
static void
|
||||||
nfs4_set_claim_prev(struct nfsd4_open *open)
|
nfs4_set_claim_prev(struct nfsd4_open *open)
|
||||||
{
|
{
|
||||||
open->op_stateowner->so_confirmed = 1;
|
open->op_openowner->oo_confirmed = 1;
|
||||||
open->op_stateowner->so_client->cl_firststate = 1;
|
open->op_openowner->oo_owner.so_client->cl_firststate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should we give out recallable state?: */
|
/* Should we give out recallable state?: */
|
||||||
@ -2782,11 +2788,11 @@ static void
|
|||||||
nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_stateid *stp)
|
nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_stateid *stp)
|
||||||
{
|
{
|
||||||
struct nfs4_delegation *dp;
|
struct nfs4_delegation *dp;
|
||||||
struct nfs4_stateowner *sop = stp->st_stateowner;
|
struct nfs4_openowner *oo = container_of(stp->st_stateowner, struct nfs4_openowner, oo_owner);
|
||||||
int cb_up;
|
int cb_up;
|
||||||
int status, flag = 0;
|
int status, flag = 0;
|
||||||
|
|
||||||
cb_up = nfsd4_cb_channel_good(sop->so_client);
|
cb_up = nfsd4_cb_channel_good(oo->oo_owner.so_client);
|
||||||
flag = NFS4_OPEN_DELEGATE_NONE;
|
flag = NFS4_OPEN_DELEGATE_NONE;
|
||||||
open->op_recall = 0;
|
open->op_recall = 0;
|
||||||
switch (open->op_claim_type) {
|
switch (open->op_claim_type) {
|
||||||
@ -2802,7 +2808,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
|
|||||||
* had the chance to reclaim theirs.... */
|
* had the chance to reclaim theirs.... */
|
||||||
if (locks_in_grace())
|
if (locks_in_grace())
|
||||||
goto out;
|
goto out;
|
||||||
if (!cb_up || !sop->so_confirmed)
|
if (!cb_up || !oo->oo_confirmed)
|
||||||
goto out;
|
goto out;
|
||||||
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
|
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
|
||||||
flag = NFS4_OPEN_DELEGATE_WRITE;
|
flag = NFS4_OPEN_DELEGATE_WRITE;
|
||||||
@ -2813,7 +2819,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp = alloc_init_deleg(sop->so_client, stp, fh, flag);
|
dp = alloc_init_deleg(oo->oo_owner.so_client, stp, fh, flag);
|
||||||
if (dp == NULL)
|
if (dp == NULL)
|
||||||
goto out_no_deleg;
|
goto out_no_deleg;
|
||||||
status = nfs4_set_delegation(dp, flag);
|
status = nfs4_set_delegation(dp, flag);
|
||||||
@ -2901,7 +2907,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
|
|||||||
memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t));
|
memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t));
|
||||||
|
|
||||||
if (nfsd4_has_session(&resp->cstate))
|
if (nfsd4_has_session(&resp->cstate))
|
||||||
open->op_stateowner->so_confirmed = 1;
|
open->op_openowner->oo_confirmed = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to hand out a delegation. No error return, because the
|
* Attempt to hand out a delegation. No error return, because the
|
||||||
@ -2922,7 +2928,7 @@ out:
|
|||||||
* To finish the open response, we just need to set the rflags.
|
* To finish the open response, we just need to set the rflags.
|
||||||
*/
|
*/
|
||||||
open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX;
|
open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX;
|
||||||
if (!open->op_stateowner->so_confirmed &&
|
if (!open->op_openowner->oo_confirmed &&
|
||||||
!nfsd4_has_session(&resp->cstate))
|
!nfsd4_has_session(&resp->cstate))
|
||||||
open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
|
open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
|
||||||
|
|
||||||
@ -2981,7 +2987,7 @@ static time_t
|
|||||||
nfs4_laundromat(void)
|
nfs4_laundromat(void)
|
||||||
{
|
{
|
||||||
struct nfs4_client *clp;
|
struct nfs4_client *clp;
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_openowner *oo;
|
||||||
struct nfs4_delegation *dp;
|
struct nfs4_delegation *dp;
|
||||||
struct list_head *pos, *next, reaplist;
|
struct list_head *pos, *next, reaplist;
|
||||||
time_t cutoff = get_seconds() - nfsd4_lease;
|
time_t cutoff = get_seconds() - nfsd4_lease;
|
||||||
@ -3038,16 +3044,16 @@ nfs4_laundromat(void)
|
|||||||
}
|
}
|
||||||
test_val = nfsd4_lease;
|
test_val = nfsd4_lease;
|
||||||
list_for_each_safe(pos, next, &close_lru) {
|
list_for_each_safe(pos, next, &close_lru) {
|
||||||
sop = list_entry(pos, struct nfs4_stateowner, so_close_lru);
|
oo = container_of(pos, struct nfs4_openowner, oo_close_lru);
|
||||||
if (time_after((unsigned long)sop->so_time, (unsigned long)cutoff)) {
|
if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) {
|
||||||
u = sop->so_time - cutoff;
|
u = oo->oo_time - cutoff;
|
||||||
if (test_val > u)
|
if (test_val > u)
|
||||||
test_val = u;
|
test_val = u;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dprintk("NFSD: purging unused open stateowner (so_id %d)\n",
|
dprintk("NFSD: purging unused open stateowner (so_id %d)\n",
|
||||||
sop->so_id);
|
oo->oo_owner.so_id);
|
||||||
release_openowner(sop);
|
release_openowner(oo);
|
||||||
}
|
}
|
||||||
if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT)
|
if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT)
|
||||||
clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT;
|
clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT;
|
||||||
@ -3069,13 +3075,12 @@ laundromat_main(struct work_struct *not_used)
|
|||||||
queue_delayed_work(laundry_wq, &laundromat_work, t*HZ);
|
queue_delayed_work(laundry_wq, &laundromat_work, t*HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_stateowner *
|
static struct nfs4_openowner * search_close_lru(u32 st_id)
|
||||||
search_close_lru(u32 st_id)
|
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *local;
|
struct nfs4_openowner *local;
|
||||||
|
|
||||||
list_for_each_entry(local, &close_lru, so_close_lru) {
|
list_for_each_entry(local, &close_lru, oo_close_lru) {
|
||||||
if (local->so_id == st_id)
|
if (local->oo_owner.so_id == st_id)
|
||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3209,7 +3214,8 @@ __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session)
|
|||||||
goto out;
|
goto out;
|
||||||
status = nfserr_bad_stateid;
|
status = nfserr_bad_stateid;
|
||||||
|
|
||||||
if (!stp->st_stateowner->so_confirmed)
|
if (stp->st_stateowner->so_is_open_owner
|
||||||
|
&& !openowner(stp->st_stateowner)->oo_confirmed)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
status = check_stateid_generation(stateid, &stp->st_stateid, has_session);
|
status = check_stateid_generation(stateid, &stp->st_stateid, has_session);
|
||||||
@ -3274,7 +3280,8 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
|
|||||||
status = nfserr_bad_stateid;
|
status = nfserr_bad_stateid;
|
||||||
if (nfs4_check_fh(current_fh, stp))
|
if (nfs4_check_fh(current_fh, stp))
|
||||||
goto out;
|
goto out;
|
||||||
if (!stp->st_stateowner->so_confirmed)
|
if (stp->st_stateowner->so_is_open_owner
|
||||||
|
&& !openowner(stp->st_stateowner)->oo_confirmed)
|
||||||
goto out;
|
goto out;
|
||||||
status = check_stateid_generation(stateid, &stp->st_stateid,
|
status = check_stateid_generation(stateid, &stp->st_stateid,
|
||||||
nfsd4_has_session(cstate));
|
nfsd4_has_session(cstate));
|
||||||
@ -3308,7 +3315,7 @@ nfsd4_free_delegation_stateid(stateid_t *stateid)
|
|||||||
static __be32
|
static __be32
|
||||||
nfsd4_free_lock_stateid(struct nfs4_stateid *stp)
|
nfsd4_free_lock_stateid(struct nfs4_stateid *stp)
|
||||||
{
|
{
|
||||||
if (check_for_locks(stp->st_file, stp->st_stateowner))
|
if (check_for_locks(stp->st_file, lockowner(stp->st_stateowner)))
|
||||||
return nfserr_locks_held;
|
return nfserr_locks_held;
|
||||||
release_lock_stateid(stp);
|
release_lock_stateid(stp);
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
@ -3417,7 +3424,8 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
|
|||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (!sop->so_confirmed && !(flags & CONFIRM)) {
|
if (sop->so_is_open_owner && !openowner(sop)->oo_confirmed
|
||||||
|
&& !(flags & CONFIRM)) {
|
||||||
dprintk("NFSD: preprocess_seqid_op: stateowner not"
|
dprintk("NFSD: preprocess_seqid_op: stateowner not"
|
||||||
" confirmed yet!\n");
|
" confirmed yet!\n");
|
||||||
return nfserr_bad_stateid;
|
return nfserr_bad_stateid;
|
||||||
@ -3434,7 +3442,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
struct nfsd4_open_confirm *oc)
|
struct nfsd4_open_confirm *oc)
|
||||||
{
|
{
|
||||||
__be32 status;
|
__be32 status;
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_openowner *oo;
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
|
|
||||||
dprintk("NFSD: nfsd4_open_confirm on file %.*s\n",
|
dprintk("NFSD: nfsd4_open_confirm on file %.*s\n",
|
||||||
@ -3452,17 +3460,17 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
CONFIRM | OPEN_STATE, &stp);
|
CONFIRM | OPEN_STATE, &stp);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
sop = stp->st_stateowner;
|
oo = openowner(stp->st_stateowner);
|
||||||
status = nfserr_bad_stateid;
|
status = nfserr_bad_stateid;
|
||||||
if (sop->so_confirmed)
|
if (oo->oo_confirmed)
|
||||||
goto out;
|
goto out;
|
||||||
sop->so_confirmed = 1;
|
oo->oo_confirmed = 1;
|
||||||
update_stateid(&stp->st_stateid);
|
update_stateid(&stp->st_stateid);
|
||||||
memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t));
|
memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t));
|
||||||
dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n",
|
dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n",
|
||||||
__func__, oc->oc_seqid, STATEID_VAL(&stp->st_stateid));
|
__func__, oc->oc_seqid, STATEID_VAL(&stp->st_stateid));
|
||||||
|
|
||||||
nfsd4_create_clid_dir(sop->so_client);
|
nfsd4_create_clid_dir(oo->oo_owner.so_client);
|
||||||
status = nfs_ok;
|
status = nfs_ok;
|
||||||
out:
|
out:
|
||||||
if (!cstate->replay_owner)
|
if (!cstate->replay_owner)
|
||||||
@ -3513,7 +3521,6 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
|
|||||||
&od->od_stateid, OPEN_STATE, &stp);
|
&od->od_stateid, OPEN_STATE, &stp);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
status = nfserr_inval;
|
status = nfserr_inval;
|
||||||
if (!test_bit(od->od_share_access, &stp->st_access_bmap)) {
|
if (!test_bit(od->od_share_access, &stp->st_access_bmap)) {
|
||||||
dprintk("NFSD:access not a subset current bitmap: 0x%lx, input access=%08x\n",
|
dprintk("NFSD:access not a subset current bitmap: 0x%lx, input access=%08x\n",
|
||||||
@ -3546,8 +3553,8 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
struct nfsd4_close *close)
|
struct nfsd4_close *close)
|
||||||
{
|
{
|
||||||
__be32 status;
|
__be32 status;
|
||||||
|
struct nfs4_openowner *oo;
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
struct nfs4_stateowner *so;
|
|
||||||
|
|
||||||
dprintk("NFSD: nfsd4_close on file %.*s\n",
|
dprintk("NFSD: nfsd4_close on file %.*s\n",
|
||||||
(int)cstate->current_fh.fh_dentry->d_name.len,
|
(int)cstate->current_fh.fh_dentry->d_name.len,
|
||||||
@ -3563,19 +3570,19 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
* Also, we should make sure this isn't just the result of
|
* Also, we should make sure this isn't just the result of
|
||||||
* a replayed close:
|
* a replayed close:
|
||||||
*/
|
*/
|
||||||
so = search_close_lru(close->cl_stateid.si_stateownerid);
|
oo = search_close_lru(close->cl_stateid.si_stateownerid);
|
||||||
/* It's not stale; let's assume it's expired: */
|
/* It's not stale; let's assume it's expired: */
|
||||||
if (so == NULL)
|
if (oo == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
cstate->replay_owner = so;
|
cstate->replay_owner = &oo->oo_owner;
|
||||||
status = nfsd4_check_seqid(cstate, so, close->cl_seqid);
|
status = nfsd4_check_seqid(cstate, &oo->oo_owner, close->cl_seqid);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
status = nfserr_bad_seqid;
|
status = nfserr_bad_seqid;
|
||||||
}
|
}
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
so = stp->st_stateowner;
|
oo = openowner(stp->st_stateowner);
|
||||||
status = nfs_ok;
|
status = nfs_ok;
|
||||||
update_stateid(&stp->st_stateid);
|
update_stateid(&stp->st_stateid);
|
||||||
memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t));
|
memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t));
|
||||||
@ -3587,8 +3594,8 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
* released by the laundromat service after the lease period
|
* released by the laundromat service after the lease period
|
||||||
* to enable us to handle CLOSE replay
|
* to enable us to handle CLOSE replay
|
||||||
*/
|
*/
|
||||||
if (list_empty(&so->so_stateids))
|
if (list_empty(&oo->oo_owner.so_stateids))
|
||||||
move_to_close_lru(so);
|
move_to_close_lru(oo);
|
||||||
out:
|
out:
|
||||||
if (!cstate->replay_owner)
|
if (!cstate->replay_owner)
|
||||||
nfs4_unlock_state();
|
nfs4_unlock_state();
|
||||||
@ -3768,17 +3775,17 @@ static const struct lock_manager_operations nfsd_posix_mng_ops = {
|
|||||||
static inline void
|
static inline void
|
||||||
nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny)
|
nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_lockowner *lo;
|
||||||
|
|
||||||
if (fl->fl_lmops == &nfsd_posix_mng_ops) {
|
if (fl->fl_lmops == &nfsd_posix_mng_ops) {
|
||||||
sop = (struct nfs4_stateowner *) fl->fl_owner;
|
lo = (struct nfs4_lockowner *) fl->fl_owner;
|
||||||
deny->ld_owner.data = kmemdup(sop->so_owner.data,
|
deny->ld_owner.data = kmemdup(lo->lo_owner.so_owner.data,
|
||||||
sop->so_owner.len, GFP_KERNEL);
|
lo->lo_owner.so_owner.len, GFP_KERNEL);
|
||||||
if (!deny->ld_owner.data)
|
if (!deny->ld_owner.data)
|
||||||
/* We just don't care that much */
|
/* We just don't care that much */
|
||||||
goto nevermind;
|
goto nevermind;
|
||||||
deny->ld_owner.len = sop->so_owner.len;
|
deny->ld_owner.len = lo->lo_owner.so_owner.len;
|
||||||
deny->ld_clientid = sop->so_client->cl_clientid;
|
deny->ld_clientid = lo->lo_owner.so_client->cl_clientid;
|
||||||
} else {
|
} else {
|
||||||
nevermind:
|
nevermind:
|
||||||
deny->ld_owner.len = 0;
|
deny->ld_owner.len = 0;
|
||||||
@ -3795,8 +3802,8 @@ nevermind:
|
|||||||
deny->ld_type = NFS4_WRITE_LT;
|
deny->ld_type = NFS4_WRITE_LT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_stateowner *
|
static struct nfs4_lockowner *
|
||||||
find_lockstateowner_str(struct inode *inode, clientid_t *clid,
|
find_lockowner_str(struct inode *inode, clientid_t *clid,
|
||||||
struct xdr_netobj *owner)
|
struct xdr_netobj *owner)
|
||||||
{
|
{
|
||||||
unsigned int hashval = lock_ownerstr_hashval(inode, clid->cl_id, owner);
|
unsigned int hashval = lock_ownerstr_hashval(inode, clid->cl_id, owner);
|
||||||
@ -3804,19 +3811,19 @@ find_lockstateowner_str(struct inode *inode, clientid_t *clid,
|
|||||||
|
|
||||||
list_for_each_entry(op, &lock_ownerstr_hashtbl[hashval], so_strhash) {
|
list_for_each_entry(op, &lock_ownerstr_hashtbl[hashval], so_strhash) {
|
||||||
if (same_owner_str(op, owner, clid))
|
if (same_owner_str(op, owner, clid))
|
||||||
return op;
|
return lockowner(op);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hash_lockowner(struct nfs4_stateowner *sop, unsigned int strhashval, struct nfs4_client *clp, struct nfs4_stateid *open_stp)
|
static void hash_lockowner(struct nfs4_lockowner *lo, unsigned int strhashval, struct nfs4_client *clp, struct nfs4_stateid *open_stp)
|
||||||
{
|
{
|
||||||
unsigned int idhashval;
|
unsigned int idhashval;
|
||||||
|
|
||||||
idhashval = lockownerid_hashval(sop->so_id);
|
idhashval = lockownerid_hashval(lo->lo_owner.so_id);
|
||||||
list_add(&sop->so_idhash, &lock_ownerid_hashtbl[idhashval]);
|
list_add(&lo->lo_owner.so_idhash, &lock_ownerid_hashtbl[idhashval]);
|
||||||
list_add(&sop->so_strhash, &lock_ownerstr_hashtbl[strhashval]);
|
list_add(&lo->lo_owner.so_strhash, &lock_ownerstr_hashtbl[strhashval]);
|
||||||
list_add(&sop->so_perstateid, &open_stp->st_lockowners);
|
list_add(&lo->lo_perstateid, &open_stp->st_lockowners);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3827,28 +3834,27 @@ static void hash_lockowner(struct nfs4_stateowner *sop, unsigned int strhashval,
|
|||||||
* strhashval = lock_ownerstr_hashval
|
* strhashval = lock_ownerstr_hashval
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct nfs4_stateowner *
|
static struct nfs4_lockowner *
|
||||||
alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfs4_stateid *open_stp, struct nfsd4_lock *lock) {
|
alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfs4_stateid *open_stp, struct nfsd4_lock *lock) {
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_lockowner *lo;
|
||||||
|
|
||||||
sop = alloc_stateowner(&lock->lk_new_owner, clp);
|
lo = alloc_stateowner(lockowner_slab, &lock->lk_new_owner, clp);
|
||||||
if (!sop)
|
if (!lo)
|
||||||
return NULL;
|
return NULL;
|
||||||
INIT_LIST_HEAD(&sop->so_stateids);
|
INIT_LIST_HEAD(&lo->lo_owner.so_stateids);
|
||||||
sop->so_is_open_owner = 0;
|
lo->lo_owner.so_is_open_owner = 0;
|
||||||
/* It is the openowner seqid that will be incremented in encode in the
|
/* It is the openowner seqid that will be incremented in encode in the
|
||||||
* case of new lockowners; so increment the lock seqid manually: */
|
* case of new lockowners; so increment the lock seqid manually: */
|
||||||
sop->so_seqid = lock->lk_new_lock_seqid + 1;
|
lo->lo_owner.so_seqid = lock->lk_new_lock_seqid + 1;
|
||||||
sop->so_confirmed = 1;
|
hash_lockowner(lo, strhashval, clp, open_stp);
|
||||||
hash_lockowner(sop, strhashval, clp, open_stp);
|
return lo;
|
||||||
return sop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_stateid *
|
static struct nfs4_stateid *
|
||||||
alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp)
|
alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct nfs4_stateid *open_stp)
|
||||||
{
|
{
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
unsigned int hashval = stateid_hashval(sop->so_id, fp->fi_id);
|
unsigned int hashval = stateid_hashval(lo->lo_owner.so_id, fp->fi_id);
|
||||||
|
|
||||||
stp = nfs4_alloc_stateid();
|
stp = nfs4_alloc_stateid();
|
||||||
if (stp == NULL)
|
if (stp == NULL)
|
||||||
@ -3859,13 +3865,13 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc
|
|||||||
INIT_LIST_HEAD(&stp->st_lockowners); /* not used */
|
INIT_LIST_HEAD(&stp->st_lockowners); /* not used */
|
||||||
list_add(&stp->st_hash, &stateid_hashtbl[hashval]);
|
list_add(&stp->st_hash, &stateid_hashtbl[hashval]);
|
||||||
list_add(&stp->st_perfile, &fp->fi_stateids);
|
list_add(&stp->st_perfile, &fp->fi_stateids);
|
||||||
list_add(&stp->st_perstateowner, &sop->so_stateids);
|
list_add(&stp->st_perstateowner, &lo->lo_owner.so_stateids);
|
||||||
stp->st_stateowner = sop;
|
stp->st_stateowner = &lo->lo_owner;
|
||||||
stp->st_type = NFS4_LOCK_STID;
|
stp->st_type = NFS4_LOCK_STID;
|
||||||
get_nfs4_file(fp);
|
get_nfs4_file(fp);
|
||||||
stp->st_file = fp;
|
stp->st_file = fp;
|
||||||
stp->st_stateid.si_boot = boot_time;
|
stp->st_stateid.si_boot = boot_time;
|
||||||
stp->st_stateid.si_stateownerid = sop->so_id;
|
stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
|
||||||
stp->st_stateid.si_fileid = fp->fi_id;
|
stp->st_stateid.si_fileid = fp->fi_id;
|
||||||
/* note will be incremented before first return to client: */
|
/* note will be incremented before first return to client: */
|
||||||
stp->st_stateid.si_generation = 0;
|
stp->st_stateid.si_generation = 0;
|
||||||
@ -3902,8 +3908,8 @@ __be32
|
|||||||
nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||||
struct nfsd4_lock *lock)
|
struct nfsd4_lock *lock)
|
||||||
{
|
{
|
||||||
struct nfs4_stateowner *open_sop = NULL;
|
struct nfs4_openowner *open_sop = NULL;
|
||||||
struct nfs4_stateowner *lock_sop = NULL;
|
struct nfs4_lockowner *lock_sop = NULL;
|
||||||
struct nfs4_stateid *lock_stp;
|
struct nfs4_stateid *lock_stp;
|
||||||
struct nfs4_file *fp;
|
struct nfs4_file *fp;
|
||||||
struct file *filp = NULL;
|
struct file *filp = NULL;
|
||||||
@ -3949,23 +3955,23 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
OPEN_STATE, &open_stp);
|
OPEN_STATE, &open_stp);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
open_sop = openowner(open_stp->st_stateowner);
|
||||||
status = nfserr_bad_stateid;
|
status = nfserr_bad_stateid;
|
||||||
open_sop = open_stp->st_stateowner;
|
|
||||||
if (!nfsd4_has_session(cstate) &&
|
if (!nfsd4_has_session(cstate) &&
|
||||||
!same_clid(&open_sop->so_client->cl_clientid,
|
!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
|
||||||
&lock->v.new.clientid))
|
&lock->v.new.clientid))
|
||||||
goto out;
|
goto out;
|
||||||
/* create lockowner and lock stateid */
|
/* create lockowner and lock stateid */
|
||||||
fp = open_stp->st_file;
|
fp = open_stp->st_file;
|
||||||
strhashval = lock_ownerstr_hashval(fp->fi_inode,
|
strhashval = lock_ownerstr_hashval(fp->fi_inode,
|
||||||
open_sop->so_client->cl_clientid.cl_id,
|
open_sop->oo_owner.so_client->cl_clientid.cl_id,
|
||||||
&lock->v.new.owner);
|
&lock->v.new.owner);
|
||||||
/* XXX: Do we need to check for duplicate stateowners on
|
/* XXX: Do we need to check for duplicate stateowners on
|
||||||
* the same file, or should they just be allowed (and
|
* the same file, or should they just be allowed (and
|
||||||
* create new stateids)? */
|
* create new stateids)? */
|
||||||
status = nfserr_jukebox;
|
status = nfserr_jukebox;
|
||||||
lock_sop = alloc_init_lock_stateowner(strhashval,
|
lock_sop = alloc_init_lock_stateowner(strhashval,
|
||||||
open_sop->so_client, open_stp, lock);
|
open_sop->oo_owner.so_client, open_stp, lock);
|
||||||
if (lock_sop == NULL)
|
if (lock_sop == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
lock_stp = alloc_init_lock_stateid(lock_sop, fp, open_stp);
|
lock_stp = alloc_init_lock_stateid(lock_sop, fp, open_stp);
|
||||||
@ -3974,12 +3980,12 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
} else {
|
} else {
|
||||||
/* lock (lock owner + lock stateid) already exists */
|
/* lock (lock owner + lock stateid) already exists */
|
||||||
status = nfs4_preprocess_seqid_op(cstate,
|
status = nfs4_preprocess_seqid_op(cstate,
|
||||||
lock->lk_old_lock_seqid,
|
lock->lk_old_lock_seqid,
|
||||||
&lock->lk_old_lock_stateid,
|
&lock->lk_old_lock_stateid,
|
||||||
LOCK_STATE, &lock_stp);
|
LOCK_STATE, &lock_stp);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
lock_sop = lock_stp->st_stateowner;
|
lock_sop = lockowner(lock_stp->st_stateowner);
|
||||||
fp = lock_stp->st_file;
|
fp = lock_stp->st_file;
|
||||||
}
|
}
|
||||||
/* lock_sop and lock_stp have been created or found */
|
/* lock_sop and lock_stp have been created or found */
|
||||||
@ -4092,7 +4098,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct file_lock file_lock;
|
struct file_lock file_lock;
|
||||||
struct nfs4_stateowner *so;
|
struct nfs4_lockowner *lo;
|
||||||
int error;
|
int error;
|
||||||
__be32 status;
|
__be32 status;
|
||||||
|
|
||||||
@ -4128,10 +4134,9 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
so = find_lockstateowner_str(inode,
|
lo = find_lockowner_str(inode, &lockt->lt_clientid, &lockt->lt_owner);
|
||||||
&lockt->lt_clientid, &lockt->lt_owner);
|
if (lo)
|
||||||
if (so)
|
file_lock.fl_owner = (fl_owner_t)lo;
|
||||||
file_lock.fl_owner = (fl_owner_t)so;
|
|
||||||
file_lock.fl_pid = current->tgid;
|
file_lock.fl_pid = current->tgid;
|
||||||
file_lock.fl_flags = FL_POSIX;
|
file_lock.fl_flags = FL_POSIX;
|
||||||
|
|
||||||
@ -4186,7 +4191,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
BUG_ON(!filp);
|
BUG_ON(!filp);
|
||||||
locks_init_lock(&file_lock);
|
locks_init_lock(&file_lock);
|
||||||
file_lock.fl_type = F_UNLCK;
|
file_lock.fl_type = F_UNLCK;
|
||||||
file_lock.fl_owner = (fl_owner_t) stp->st_stateowner;
|
file_lock.fl_owner = (fl_owner_t)lockowner(stp->st_stateowner);
|
||||||
file_lock.fl_pid = current->tgid;
|
file_lock.fl_pid = current->tgid;
|
||||||
file_lock.fl_file = filp;
|
file_lock.fl_file = filp;
|
||||||
file_lock.fl_flags = FL_POSIX;
|
file_lock.fl_flags = FL_POSIX;
|
||||||
@ -4225,7 +4230,7 @@ out_nfserr:
|
|||||||
* 0: no locks held by lockowner
|
* 0: no locks held by lockowner
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
check_for_locks(struct nfs4_file *filp, struct nfs4_stateowner *lowner)
|
check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner)
|
||||||
{
|
{
|
||||||
struct file_lock **flpp;
|
struct file_lock **flpp;
|
||||||
struct inode *inode = filp->fi_inode;
|
struct inode *inode = filp->fi_inode;
|
||||||
@ -4250,6 +4255,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
|
|||||||
{
|
{
|
||||||
clientid_t *clid = &rlockowner->rl_clientid;
|
clientid_t *clid = &rlockowner->rl_clientid;
|
||||||
struct nfs4_stateowner *sop;
|
struct nfs4_stateowner *sop;
|
||||||
|
struct nfs4_lockowner *lo;
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
struct xdr_netobj *owner = &rlockowner->rl_owner;
|
struct xdr_netobj *owner = &rlockowner->rl_owner;
|
||||||
struct list_head matches;
|
struct list_head matches;
|
||||||
@ -4279,11 +4285,10 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
|
|||||||
continue;
|
continue;
|
||||||
list_for_each_entry(stp, &sop->so_stateids,
|
list_for_each_entry(stp, &sop->so_stateids,
|
||||||
st_perstateowner) {
|
st_perstateowner) {
|
||||||
if (check_for_locks(stp->st_file, sop))
|
lo = lockowner(sop);
|
||||||
|
if (check_for_locks(stp->st_file, lo))
|
||||||
goto out;
|
goto out;
|
||||||
/* Note: so_perclient unused for lockowners,
|
list_add(&lo->lo_list, &matches);
|
||||||
* so it's OK to fool with here. */
|
|
||||||
list_add(&sop->so_perclient, &matches);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4292,12 +4297,12 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
|
|||||||
* have been checked. */
|
* have been checked. */
|
||||||
status = nfs_ok;
|
status = nfs_ok;
|
||||||
while (!list_empty(&matches)) {
|
while (!list_empty(&matches)) {
|
||||||
sop = list_entry(matches.next, struct nfs4_stateowner,
|
lo = list_entry(matches.next, struct nfs4_lockowner,
|
||||||
so_perclient);
|
lo_list);
|
||||||
/* unhash_stateowner deletes so_perclient only
|
/* unhash_stateowner deletes so_perclient only
|
||||||
* for openowners. */
|
* for openowners. */
|
||||||
list_del(&sop->so_perclient);
|
list_del(&lo->lo_list);
|
||||||
release_lockowner(sop);
|
release_lockowner(lo);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
nfs4_unlock_state();
|
nfs4_unlock_state();
|
||||||
|
@ -646,7 +646,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
|
|||||||
|
|
||||||
memset(open->op_bmval, 0, sizeof(open->op_bmval));
|
memset(open->op_bmval, 0, sizeof(open->op_bmval));
|
||||||
open->op_iattr.ia_valid = 0;
|
open->op_iattr.ia_valid = 0;
|
||||||
open->op_stateowner = NULL;
|
open->op_openowner = NULL;
|
||||||
|
|
||||||
/* seqid, share_access, share_deny, clientid, ownerlen */
|
/* seqid, share_access, share_deny, clientid, ownerlen */
|
||||||
READ_BUF(16 + sizeof(clientid_t));
|
READ_BUF(16 + sizeof(clientid_t));
|
||||||
|
@ -337,14 +337,11 @@ struct nfs4_replay {
|
|||||||
* reaped (when so_perfilestate is empty) to hold the last close replay.
|
* reaped (when so_perfilestate is empty) to hold the last close replay.
|
||||||
* reaped by laundramat thread after lease period.
|
* reaped by laundramat thread after lease period.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct nfs4_stateowner {
|
struct nfs4_stateowner {
|
||||||
struct list_head so_idhash; /* hash by so_id */
|
struct list_head so_idhash; /* hash by so_id */
|
||||||
struct list_head so_strhash; /* hash by op_name */
|
struct list_head so_strhash; /* hash by op_name */
|
||||||
struct list_head so_perclient;
|
|
||||||
struct list_head so_stateids;
|
struct list_head so_stateids;
|
||||||
struct list_head so_perstateid; /* for lockowners only */
|
|
||||||
struct list_head so_close_lru; /* tail queue */
|
|
||||||
time_t so_time; /* time of placement on so_close_lru */
|
|
||||||
int so_is_open_owner; /* 1=openowner,0=lockowner */
|
int so_is_open_owner; /* 1=openowner,0=lockowner */
|
||||||
u32 so_id;
|
u32 so_id;
|
||||||
struct nfs4_client * so_client;
|
struct nfs4_client * so_client;
|
||||||
@ -352,10 +349,33 @@ struct nfs4_stateowner {
|
|||||||
* sequence id expected from the client: */
|
* sequence id expected from the client: */
|
||||||
u32 so_seqid;
|
u32 so_seqid;
|
||||||
struct xdr_netobj so_owner; /* open owner name */
|
struct xdr_netobj so_owner; /* open owner name */
|
||||||
int so_confirmed; /* successful OPEN_CONFIRM? */
|
|
||||||
struct nfs4_replay so_replay;
|
struct nfs4_replay so_replay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct nfs4_openowner {
|
||||||
|
struct nfs4_stateowner oo_owner; /* must be first field */
|
||||||
|
struct list_head oo_perclient;
|
||||||
|
struct list_head oo_close_lru; /* tail queue */
|
||||||
|
time_t oo_time; /* time of placement on so_close_lru */
|
||||||
|
int oo_confirmed; /* successful OPEN_CONFIRM? */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nfs4_lockowner {
|
||||||
|
struct nfs4_stateowner lo_owner; /* must be first element */
|
||||||
|
struct list_head lo_perstateid; /* for lockowners only */
|
||||||
|
struct list_head lo_list; /* for temporary uses */
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct nfs4_openowner * openowner(struct nfs4_stateowner *so)
|
||||||
|
{
|
||||||
|
return container_of(so, struct nfs4_openowner, oo_owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct nfs4_lockowner * lockowner(struct nfs4_stateowner *so)
|
||||||
|
{
|
||||||
|
return container_of(so, struct nfs4_lockowner, lo_owner);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nfs4_file: a file opened by some number of (open) nfs4_stateowners.
|
* nfs4_file: a file opened by some number of (open) nfs4_stateowners.
|
||||||
* o fi_perfile list is used to search for conflicting
|
* o fi_perfile list is used to search for conflicting
|
||||||
@ -457,7 +477,8 @@ extern void nfs4_lock_state(void);
|
|||||||
extern void nfs4_unlock_state(void);
|
extern void nfs4_unlock_state(void);
|
||||||
extern int nfs4_in_grace(void);
|
extern int nfs4_in_grace(void);
|
||||||
extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
|
extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
|
||||||
extern void nfs4_free_stateowner(struct nfs4_stateowner *sop);
|
extern void nfs4_free_openowner(struct nfs4_openowner *);
|
||||||
|
extern void nfs4_free_lockowner(struct nfs4_lockowner *);
|
||||||
extern int set_callback_cred(void);
|
extern int set_callback_cred(void);
|
||||||
extern void nfsd4_probe_callback(struct nfs4_client *clp);
|
extern void nfsd4_probe_callback(struct nfs4_client *clp);
|
||||||
extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
|
extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
|
||||||
|
@ -227,7 +227,7 @@ struct nfsd4_open {
|
|||||||
struct nfsd4_change_info op_cinfo; /* response */
|
struct nfsd4_change_info op_cinfo; /* response */
|
||||||
u32 op_rflags; /* response */
|
u32 op_rflags; /* response */
|
||||||
int op_truncate; /* used during processing */
|
int op_truncate; /* used during processing */
|
||||||
struct nfs4_stateowner *op_stateowner; /* used during processing */
|
struct nfs4_openowner *op_openowner; /* used during processing */
|
||||||
struct nfs4_acl *op_acl;
|
struct nfs4_acl *op_acl;
|
||||||
};
|
};
|
||||||
#define op_iattr iattr
|
#define op_iattr iattr
|
||||||
|
Loading…
Reference in New Issue
Block a user