mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 00:00:00 +00:00
nfsd4: miscellaneous process_open2 cleanup
Move more work into helper functions. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
c3e4808086
commit
21fb4016bd
@ -2317,10 +2317,21 @@ nfs4_alloc_stateid(void)
|
|||||||
return kmem_cache_alloc(stateid_slab, GFP_KERNEL);
|
return kmem_cache_alloc(stateid_slab, GFP_KERNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int nfs4_access_to_access(u32 nfs4_access)
|
||||||
|
{
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
|
if (nfs4_access & NFS4_SHARE_ACCESS_READ)
|
||||||
|
flags |= NFSD_MAY_READ;
|
||||||
|
if (nfs4_access & NFS4_SHARE_ACCESS_WRITE)
|
||||||
|
flags |= NFSD_MAY_WRITE;
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
|
nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
|
||||||
struct nfs4_delegation *dp,
|
struct nfs4_delegation *dp,
|
||||||
struct svc_fh *cur_fh, int flags)
|
struct svc_fh *cur_fh, struct nfsd4_open *open)
|
||||||
{
|
{
|
||||||
struct nfs4_stateid *stp;
|
struct nfs4_stateid *stp;
|
||||||
|
|
||||||
@ -2333,8 +2344,10 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
|
|||||||
stp->st_vfs_file = dp->dl_vfs_file;
|
stp->st_vfs_file = dp->dl_vfs_file;
|
||||||
} else {
|
} else {
|
||||||
__be32 status;
|
__be32 status;
|
||||||
status = nfsd_open(rqstp, cur_fh, S_IFREG, flags,
|
int access = nfs4_access_to_access(open->op_share_access);
|
||||||
&stp->st_vfs_file);
|
|
||||||
|
status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
|
||||||
|
&stp->st_vfs_file);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (status == nfserr_dropit)
|
if (status == nfserr_dropit)
|
||||||
status = nfserr_jukebox;
|
status = nfserr_jukebox;
|
||||||
@ -2531,12 +2544,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
|
|||||||
update_stateid(&stp->st_stateid);
|
update_stateid(&stp->st_stateid);
|
||||||
} else {
|
} else {
|
||||||
/* Stateid was not found, this is a new OPEN */
|
/* Stateid was not found, this is a new OPEN */
|
||||||
int flags = 0;
|
status = nfs4_new_open(rqstp, &stp, dp, current_fh, open);
|
||||||
if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
|
|
||||||
flags |= NFSD_MAY_READ;
|
|
||||||
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
|
|
||||||
flags |= NFSD_MAY_WRITE;
|
|
||||||
status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
|
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
init_stateid(stp, fp, open);
|
init_stateid(stp, fp, open);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user