Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297455
b: refs/heads/master
c: 6a8a13e
h: refs/heads/master
i:
  297453: 3368d39
  297451: 2267757
  297447: 37a22eb
  297439: b4dccef
v: v3
  • Loading branch information
Bernd Schubert authored and Theodore Ts'o committed Mar 14, 2012
1 parent a5d1b81 commit 480224c
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 521 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8546ee518c6662ddb3075249fb31d89e5dbfb7d5
refs/heads/master: 6a8a13e03861c0ab83ab07d573ca793cff0e5d00
2 changes: 1 addition & 1 deletion trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static int param_set_##name(const char *val, struct kernel_param *kp) \
__typeof__(type) num = which_strtol(val, &endp, 0); \
if (endp == val || *endp || num < (min) || num > (max)) \
return -EINVAL; \
*((type *) kp->arg) = num; \
*((int *) kp->arg) = num; \
return 0; \
}

Expand Down
28 changes: 0 additions & 28 deletions trunk/fs/nfsd/current_stateid.h

This file was deleted.

2 changes: 1 addition & 1 deletion trunk/fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
struct svc_expkey key;
struct svc_expkey *ek = NULL;

if (mesg[mlen - 1] != '\n')
if (mlen < 1 || mesg[mlen-1] != '\n')
return -EINVAL;
mesg[mlen-1] = 0;

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfsd/nfs4callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)

err = setup_callback_client(clp, &conn, ses);
if (err) {
nfsd4_mark_cb_down(clp, err);
warn_no_callback_path(clp, err);
return;
}
/* Yay, the callback channel's back! Restart any callbacks: */
Expand Down
92 changes: 26 additions & 66 deletions trunk/fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "cache.h"
#include "xdr4.h"
#include "vfs.h"
#include "current_stateid.h"

#define NFSDDBG_FACILITY NFSDDBG_PROC

Expand Down Expand Up @@ -193,13 +192,10 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
static __be32
do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
{
struct svc_fh *resfh;
struct svc_fh resfh;
__be32 status;

resfh = kmalloc(sizeof(struct svc_fh), GFP_KERNEL);
if (!resfh)
return nfserr_jukebox;
fh_init(resfh, NFS4_FHSIZE);
fh_init(&resfh, NFS4_FHSIZE);
open->op_truncate = 0;

if (open->op_create) {
Expand All @@ -224,7 +220,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
*/
status = do_nfsd_create(rqstp, current_fh, open->op_fname.data,
open->op_fname.len, &open->op_iattr,
resfh, open->op_createmode,
&resfh, open->op_createmode,
(u32 *)open->op_verf.data,
&open->op_truncate, &open->op_created);

Expand All @@ -238,29 +234,30 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
FATTR4_WORD1_TIME_MODIFY);
} else {
status = nfsd_lookup(rqstp, current_fh,
open->op_fname.data, open->op_fname.len, resfh);
open->op_fname.data, open->op_fname.len, &resfh);
fh_unlock(current_fh);
if (status)
goto out;
status = nfsd_check_obj_isreg(resfh);
status = nfsd_check_obj_isreg(&resfh);
}
if (status)
goto out;

if (is_create_with_attrs(open) && open->op_acl != NULL)
do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval);
do_set_nfs4_acl(rqstp, &resfh, open->op_acl, open->op_bmval);

set_change_info(&open->op_cinfo, current_fh);
fh_dup2(current_fh, &resfh);

/* set reply cache */
fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
&resfh->fh_handle);
&resfh.fh_handle);
if (!open->op_created)
status = do_open_permission(rqstp, resfh, open,
status = do_open_permission(rqstp, current_fh, open,
NFSD_MAY_NOP);
set_change_info(&open->op_cinfo, current_fh);
fh_dup2(current_fh, resfh);

out:
fh_put(resfh);
kfree(resfh);
fh_put(&resfh);
return status;
}

Expand Down Expand Up @@ -313,6 +310,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
return nfserr_inval;

/* We don't yet support WANT bits: */
open->op_share_access &= NFS4_SHARE_ACCESS_MASK;

open->op_created = 0;
/*
* RFC5661 18.51.3
Expand Down Expand Up @@ -452,10 +452,6 @@ nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserr_restorefh;

fh_dup2(&cstate->current_fh, &cstate->save_fh);
if (HAS_STATE_ID(cstate, SAVED_STATE_ID_FLAG)) {
memcpy(&cstate->current_stateid, &cstate->save_stateid, sizeof(stateid_t));
SET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG);
}
return nfs_ok;
}

Expand All @@ -467,10 +463,6 @@ nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserr_nofilehandle;

fh_dup2(&cstate->save_fh, &cstate->current_fh);
if (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG)) {
memcpy(&cstate->save_stateid, &cstate->current_stateid, sizeof(stateid_t));
SET_STATE_ID(cstate, SAVED_STATE_ID_FLAG);
}
return nfs_ok;
}

Expand Down Expand Up @@ -1008,8 +1000,6 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
void *);
typedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);
typedef void(*stateid_setter)(struct nfsd4_compound_state *, void *);
typedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);

enum nfsd4_op_flags {
ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
Expand All @@ -1035,10 +1025,6 @@ enum nfsd4_op_flags {
* the v4.0 case).
*/
OP_CACHEME = 1 << 6,
/*
* These are ops which clear current state id.
*/
OP_CLEAR_STATEID = 1 << 7,
};

struct nfsd4_operation {
Expand All @@ -1047,8 +1033,6 @@ struct nfsd4_operation {
char *op_name;
/* Try to get response size before operation */
nfsd4op_rsize op_rsize_bop;
stateid_setter op_get_currentstateid;
stateid_getter op_set_currentstateid;
};

static struct nfsd4_operation nfsd4_ops[];
Expand Down Expand Up @@ -1231,23 +1215,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
if (op->status)
goto encode_op;

if (opdesc->op_func) {
if (opdesc->op_get_currentstateid)
opdesc->op_get_currentstateid(cstate, &op->u);
if (opdesc->op_func)
op->status = opdesc->op_func(rqstp, cstate, &op->u);
} else
else
BUG_ON(op->status == nfs_ok);

if (!op->status) {
if (opdesc->op_set_currentstateid)
opdesc->op_set_currentstateid(cstate, &op->u);

if (opdesc->op_flags & OP_CLEAR_STATEID)
clear_current_stateid(cstate);

if (need_wrongsec_check(rqstp))
op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp);
}
if (!op->status && need_wrongsec_check(rqstp))
op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp);

encode_op:
/* Only from SEQUENCE */
Expand Down Expand Up @@ -1439,8 +1413,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_CLOSE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid,
.op_set_currentstateid = (stateid_setter)nfsd4_set_closestateid,
},
[OP_COMMIT] = {
.op_func = (nfsd4op_func)nfsd4_commit,
Expand All @@ -1450,7 +1422,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
},
[OP_CREATE] = {
.op_func = (nfsd4op_func)nfsd4_create,
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID,
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
.op_name = "OP_CREATE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize,
},
Expand All @@ -1459,7 +1431,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_DELEGRETURN",
.op_rsize_bop = nfsd4_only_status_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_delegreturnstateid,
},
[OP_GETATTR] = {
.op_func = (nfsd4op_func)nfsd4_getattr,
Expand All @@ -1482,7 +1453,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_LOCK",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,
.op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid,
},
[OP_LOCKT] = {
.op_func = (nfsd4op_func)nfsd4_lockt,
Expand All @@ -1493,16 +1463,15 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_LOCKU",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,
},
[OP_LOOKUP] = {
.op_func = (nfsd4op_func)nfsd4_lookup,
.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
.op_flags = OP_HANDLES_WRONGSEC,
.op_name = "OP_LOOKUP",
},
[OP_LOOKUPP] = {
.op_func = (nfsd4op_func)nfsd4_lookupp,
.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
.op_flags = OP_HANDLES_WRONGSEC,
.op_name = "OP_LOOKUPP",
},
[OP_NVERIFY] = {
Expand All @@ -1514,7 +1483,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,
.op_name = "OP_OPEN",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_open_rsize,
.op_set_currentstateid = (stateid_setter)nfsd4_set_openstateid,
},
[OP_OPEN_CONFIRM] = {
.op_func = (nfsd4op_func)nfsd4_open_confirm,
Expand All @@ -1527,30 +1495,25 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_OPEN_DOWNGRADE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_opendowngradestateid,
.op_set_currentstateid = (stateid_setter)nfsd4_set_opendowngradestateid,
},
[OP_PUTFH] = {
.op_func = (nfsd4op_func)nfsd4_putfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
| OP_CLEAR_STATEID,
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
.op_name = "OP_PUTFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
[OP_PUTPUBFH] = {
.op_func = (nfsd4op_func)nfsd4_putrootfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
| OP_CLEAR_STATEID,
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
.op_name = "OP_PUTPUBFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
[OP_PUTROOTFH] = {
.op_func = (nfsd4op_func)nfsd4_putrootfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
| OP_CLEAR_STATEID,
| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
.op_name = "OP_PUTROOTFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
Expand All @@ -1559,7 +1522,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_READ",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid,
},
[OP_READDIR] = {
.op_func = (nfsd4op_func)nfsd4_readdir,
Expand Down Expand Up @@ -1614,7 +1576,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_name = "OP_SETATTR",
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
.op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_setattrstateid,
},
[OP_SETCLIENTID] = {
.op_func = (nfsd4op_func)nfsd4_setclientid,
Expand All @@ -1639,7 +1600,6 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
.op_name = "OP_WRITE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
.op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid,
},
[OP_RELEASE_LOCKOWNER] = {
.op_func = (nfsd4op_func)nfsd4_release_lockowner,
Expand Down
Loading

0 comments on commit 480224c

Please sign in to comment.