Commit 902773e5 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: nfsdv4 byte range locking - prepatation

From: "William A.(Andy) Adamson" <andros@citi.umich.edu>

This renames some structures and functions that can be used for
byte-range locking as well as for the exiting open share locks, and does
some cleanup.
parent b8ba293d
...@@ -355,7 +355,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read ...@@ -355,7 +355,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read
if (read->rd_offset >= OFFSET_MAX) if (read->rd_offset >= OFFSET_MAX)
return nfserr_inval; return nfserr_inval;
nfsd4_lock_state(); nfs4_lock_state();
status = nfs_ok; status = nfs_ok;
/* For stateid -1, we don't check share reservations. */ /* For stateid -1, we don't check share reservations. */
if (ONE_STATEID(&read->rd_stateid)) { if (ONE_STATEID(&read->rd_stateid)) {
...@@ -388,7 +388,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read ...@@ -388,7 +388,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read
} }
status = nfs_ok; status = nfs_ok;
out: out:
nfsd4_unlock_state(); nfs4_unlock_state();
read->rd_rqstp = rqstp; read->rd_rqstp = rqstp;
read->rd_fhp = current_fh; read->rd_fhp = current_fh;
return status; return status;
...@@ -464,7 +464,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se ...@@ -464,7 +464,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se
return status; return status;
} }
nfsd4_lock_state(); nfs4_lock_state();
if ((status = nfs4_preprocess_stateid_op(current_fh, if ((status = nfs4_preprocess_stateid_op(current_fh,
&setattr->sa_stateid, &setattr->sa_stateid,
CHECK_FH, &stp))) { CHECK_FH, &stp))) {
...@@ -476,11 +476,11 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se ...@@ -476,11 +476,11 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se
dprintk("NFSD: nfsd4_setattr: not opened for write!\n"); dprintk("NFSD: nfsd4_setattr: not opened for write!\n");
goto out; goto out;
} }
nfsd4_unlock_state(); nfs4_unlock_state();
} }
return (nfsd_setattr(rqstp, current_fh, &setattr->sa_iattr, 0, (time_t)0)); return (nfsd_setattr(rqstp, current_fh, &setattr->sa_iattr, 0, (time_t)0));
out: out:
nfsd4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -497,7 +497,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ ...@@ -497,7 +497,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
if (write->wr_offset >= OFFSET_MAX) if (write->wr_offset >= OFFSET_MAX)
return nfserr_inval; return nfserr_inval;
nfsd4_lock_state(); nfs4_lock_state();
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
dprintk("NFSD: nfsd4_write: zero stateid...\n"); dprintk("NFSD: nfsd4_write: zero stateid...\n");
if ((status = nfs4_share_conflict(current_fh, NFS4_SHARE_DENY_WRITE))) { if ((status = nfs4_share_conflict(current_fh, NFS4_SHARE_DENY_WRITE))) {
...@@ -519,7 +519,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ ...@@ -519,7 +519,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
} }
zero_stateid: zero_stateid:
nfsd4_unlock_state(); nfs4_unlock_state();
write->wr_bytes_written = write->wr_buflen; write->wr_bytes_written = write->wr_buflen;
write->wr_how_written = write->wr_stable_how; write->wr_how_written = write->wr_stable_how;
p = (u32 *)write->wr_verifier; p = (u32 *)write->wr_verifier;
...@@ -530,7 +530,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ ...@@ -530,7 +530,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
write->wr_vec, write->wr_vlen, write->wr_buflen, write->wr_vec, write->wr_vlen, write->wr_buflen,
&write->wr_how_written)); &write->wr_how_written));
out: out:
nfsd4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
......
This diff is collapsed.
...@@ -119,14 +119,14 @@ struct nfs4_replay { ...@@ -119,14 +119,14 @@ struct nfs4_replay {
/* /*
* nfs4_stateowner can either be an open_owner, or (eventually) a lock_owner * nfs4_stateowner can either be an open_owner, or (eventually) a lock_owner
* *
* o so_peropenstate list is used to ensure no dangling nfs4_stateid * o so_perfilestate list is used to ensure no dangling nfs4_stateid
* reverences when we release a stateowner. * reverences when we release a stateowner.
*/ */
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; /* nfs4_client->cl_perclient */ struct list_head so_perclient; /* nfs4_client->cl_perclient */
struct list_head so_peropenstate; /* list: nfs4_stateid */ struct list_head so_perfilestate; /* list: nfs4_stateid */
u32 so_id; u32 so_id;
struct nfs4_client * so_client; struct nfs4_client * so_client;
u32 so_seqid; u32 so_seqid;
...@@ -145,7 +145,7 @@ struct nfs4_file { ...@@ -145,7 +145,7 @@ struct nfs4_file {
struct list_head fi_perfile; /* list: nfs4_stateid */ struct list_head fi_perfile; /* list: nfs4_stateid */
struct inode *fi_inode; struct inode *fi_inode;
u32 fi_id; /* used with stateowner->so_id u32 fi_id; /* used with stateowner->so_id
* for openstateid_hashtbl hash */ * for stateid_hashtbl hash */
}; };
/* /*
...@@ -155,9 +155,9 @@ struct nfs4_file { ...@@ -155,9 +155,9 @@ struct nfs4_file {
*/ */
struct nfs4_stateid { struct nfs4_stateid {
struct list_head st_hash; /* openstateid_hashtbl[]*/ struct list_head st_hash;
struct list_head st_perfile; /* file_hashtbl[]*/ struct list_head st_perfile;
struct list_head st_peropenstate; /* nfs4_stateowner->so_peropenstate */ struct list_head st_perfilestate;
struct nfs4_stateowner * st_stateowner; struct nfs4_stateowner * st_stateowner;
struct nfs4_file * st_file; struct nfs4_file * st_file;
stateid_t st_stateid; stateid_t st_stateid;
...@@ -183,6 +183,6 @@ extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, ...@@ -183,6 +183,6 @@ extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
stateid_t *stateid, int flags, struct nfs4_stateid **stpp); stateid_t *stateid, int flags, struct nfs4_stateid **stpp);
extern int nfs4_share_conflict(struct svc_fh *current_fh, extern int nfs4_share_conflict(struct svc_fh *current_fh,
unsigned int deny_type); unsigned int deny_type);
extern void nfsd4_lock_state(void); extern void nfs4_lock_state(void);
extern void nfsd4_unlock_state(void); extern void nfs4_unlock_state(void);
#endif /* NFSD4_STATE_H */ #endif /* NFSD4_STATE_H */
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