Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297442
b: refs/heads/master
c: 03cfb42
h: refs/heads/master
v: v3
  • Loading branch information
Bryan Schumaker authored and J. Bruce Fields committed Feb 17, 2012
1 parent 5d40901 commit d30078e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 50 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: de5b8e8e047534aac6bc9803f96e7257436aef9c
refs/heads/master: 03cfb42025a16dc45195dbdd6d368daaa8367429
9 changes: 8 additions & 1 deletion trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,14 @@ __be32
nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_test_stateid *test_stateid)
{
/* real work is done during encoding */
struct nfsd4_test_stateid_id *stateid;
struct nfs4_client *cl = cstate->session->se_client;

nfs4_lock_state();
list_for_each_entry(stateid, &test_stateid->ts_stateid_list, ts_id_list)
stateid->ts_id_status = nfs4_validate_stateid(cl, &stateid->ts_id_stateid);
nfs4_unlock_state();

return nfs_ok;
}

Expand Down
66 changes: 20 additions & 46 deletions trunk/fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,6 @@ xdr_error: \
} \
} while (0)

static void save_buf(struct nfsd4_compoundargs *argp, struct nfsd4_saved_compoundargs *savep)
{
savep->p = argp->p;
savep->end = argp->end;
savep->pagelen = argp->pagelen;
savep->pagelist = argp->pagelist;
}

static void restore_buf(struct nfsd4_compoundargs *argp, struct nfsd4_saved_compoundargs *savep)
{
argp->p = savep->p;
argp->end = savep->end;
argp->pagelen = savep->pagelen;
argp->pagelist = savep->pagelist;
}

static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
{
/* We want more bytes than seem to be available.
Expand Down Expand Up @@ -1396,26 +1380,29 @@ nfsd4_decode_sequence(struct nfsd4_compoundargs *argp,
static __be32
nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_stateid *test_stateid)
{
unsigned int nbytes;
stateid_t si;
int i;
__be32 *p;
__be32 status;
__be32 *p, status;
struct nfsd4_test_stateid_id *stateid;

READ_BUF(4);
test_stateid->ts_num_ids = ntohl(*p++);

nbytes = test_stateid->ts_num_ids * sizeof(stateid_t);
if (nbytes > (u32)((char *)argp->end - (char *)argp->p))
goto xdr_error;

test_stateid->ts_saved_args = argp;
save_buf(argp, &test_stateid->ts_savedp);
INIT_LIST_HEAD(&test_stateid->ts_stateid_list);

for (i = 0; i < test_stateid->ts_num_ids; i++) {
status = nfsd4_decode_stateid(argp, &si);
stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL);
if (!stateid) {
status = PTR_ERR(stateid);
goto out;
}

defer_free(argp, kfree, stateid);
INIT_LIST_HEAD(&stateid->ts_id_list);
list_add_tail(&stateid->ts_id_list, &test_stateid->ts_stateid_list);

status = nfsd4_decode_stateid(argp, &stateid->ts_id_stateid);
if (status)
return status;
goto out;
}

status = 0;
Expand Down Expand Up @@ -3402,30 +3389,17 @@ __be32
nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr,
struct nfsd4_test_stateid *test_stateid)
{
struct nfsd4_compoundargs *argp;
struct nfs4_client *cl = resp->cstate.session->se_client;
stateid_t si;
struct nfsd4_test_stateid_id *stateid, *next;
__be32 *p;
int i;
int valid;

restore_buf(test_stateid->ts_saved_args, &test_stateid->ts_savedp);
argp = test_stateid->ts_saved_args;

RESERVE_SPACE(4);
RESERVE_SPACE(4 + (4 * test_stateid->ts_num_ids));
*p++ = htonl(test_stateid->ts_num_ids);
resp->p = p;

nfs4_lock_state();
for (i = 0; i < test_stateid->ts_num_ids; i++) {
nfsd4_decode_stateid(argp, &si);
valid = nfs4_validate_stateid(cl, &si);
RESERVE_SPACE(4);
*p++ = htonl(valid);
resp->p = p;
list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
*p++ = htonl(stateid->ts_id_status);
}
nfs4_unlock_state();

ADJUST_ARGS();
return nfserr;
}

Expand Down
9 changes: 7 additions & 2 deletions trunk/fs/nfsd/xdr4.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,15 @@ struct nfsd4_saved_compoundargs {
struct page **pagelist;
};

struct nfsd4_test_stateid_id {
__be32 ts_id_status;
stateid_t ts_id_stateid;
struct list_head ts_id_list;
};

struct nfsd4_test_stateid {
__be32 ts_num_ids;
struct nfsd4_compoundargs *ts_saved_args;
struct nfsd4_saved_compoundargs ts_savedp;
struct list_head ts_stateid_list;
};

struct nfsd4_free_stateid {
Expand Down

0 comments on commit d30078e

Please sign in to comment.