Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
874ce338
Commit
874ce338
authored
Oct 07, 2003
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up the nfs4_stateid and nfs4_verifier typedefs.
Convert them into structures
parent
1a7bc914
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
79 deletions
+78
-79
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+18
-21
fs/nfs/nfs4state.c
fs/nfs/nfs4state.c
+4
-3
fs/nfs/nfs4xdr.c
fs/nfs/nfs4xdr.c
+24
-23
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4proc.c
+3
-3
fs/nfsd/nfs4state.c
fs/nfsd/nfs4state.c
+22
-22
fs/nfsd/nfs4xdr.c
fs/nfsd/nfs4xdr.c
+5
-5
include/linux/nfs4.h
include/linux/nfs4.h
+2
-2
No files found.
fs/nfs/nfs4proc.c
View file @
874ce338
...
...
@@ -54,8 +54,7 @@
extern
u32
*
nfs4_decode_dirent
(
u32
*
p
,
struct
nfs_entry
*
entry
,
int
plus
);
extern
struct
rpc_procinfo
nfs4_procedures
[];
static
nfs4_stateid
zero_stateid
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
extern
nfs4_stateid
zero_stateid
;
static
spinlock_t
renew_lock
=
SPIN_LOCK_UNLOCKED
;
...
...
@@ -336,7 +335,7 @@ nfs4_setup_readdir(struct nfs4_compound *cp, u64 cookie, u32 *verifier,
BUG_ON
(
bufsize
<
80
);
readdir
->
rd_cookie
=
(
cookie
>
2
)
?
cookie
:
0
;
memcpy
(
readdir
->
rd_req_verifier
,
verifier
,
sizeof
(
nfs4
_verifier
));
memcpy
(
&
readdir
->
rd_req_verifier
,
verifier
,
sizeof
(
readdir
->
rd_req
_verifier
));
readdir
->
rd_count
=
bufsize
;
readdir
->
rd_bmval
[
0
]
=
FATTR4_WORD0_FILEID
;
readdir
->
rd_bmval
[
1
]
=
0
;
...
...
@@ -464,7 +463,7 @@ nfs4_setup_setclientid(struct nfs4_compound *cp, u32 program, unsigned short por
u32
*
p
;
tv
=
CURRENT_TIME
;
p
=
(
u32
*
)
setclientid
->
sc_verifier
;
p
=
(
u32
*
)
setclientid
->
sc_verifier
.
data
;
*
p
++
=
tv
.
tv_sec
;
*
p
++
=
tv
.
tv_nsec
;
setclientid
->
sc_name
=
server
->
ip_addr
;
...
...
@@ -606,7 +605,7 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
goto
out
;
}
if
(
o_arg
.
createmode
&
NFS4_CREATE_EXCLUSIVE
){
u32
*
p
=
(
u32
*
)
o_arg
.
u
.
verifier
;
u32
*
p
=
(
u32
*
)
o_arg
.
u
.
verifier
.
data
;
p
[
0
]
=
jiffies
;
p
[
1
]
=
current
->
pid
;
}
else
if
(
o_arg
.
createmode
==
NFS4_CREATE_UNCHECKED
)
{
...
...
@@ -648,14 +647,14 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
.
rpc_cred
=
cred
,
};
memcpy
(
oc_arg
.
stateid
,
o_res
.
stateid
,
sizeof
(
nfs4_
stateid
));
memcpy
(
&
oc_arg
.
stateid
,
&
o_res
.
stateid
,
sizeof
(
oc_arg
.
stateid
));
status
=
rpc_call_sync
(
server
->
client
,
&
msg
,
0
);
if
(
status
)
goto
out_up
;
nfs4_increment_seqid
(
status
,
sp
);
memcpy
(
state
->
stateid
,
oc_res
.
stateid
,
sizeof
(
state
->
stateid
));
memcpy
(
&
state
->
stateid
,
&
oc_res
.
stateid
,
sizeof
(
state
->
stateid
));
}
else
memcpy
(
state
->
stateid
,
o_res
.
stateid
,
sizeof
(
state
->
stateid
));
memcpy
(
&
state
->
stateid
,
&
o_res
.
stateid
,
sizeof
(
state
->
stateid
));
state
->
state
|=
flags
&
(
FMODE_READ
|
FMODE_WRITE
);
state
->
pid
=
current
->
pid
;
...
...
@@ -703,9 +702,9 @@ nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
fattr
->
valid
=
0
;
if
(
state
)
memcpy
(
arg
.
stateid
,
state
->
stateid
,
sizeof
(
arg
.
stateid
));
memcpy
(
&
arg
.
stateid
,
&
state
->
stateid
,
sizeof
(
arg
.
stateid
));
else
memcpy
(
arg
.
stateid
,
zero_stateid
,
sizeof
(
arg
.
stateid
));
memcpy
(
&
arg
.
stateid
,
&
zero_stateid
,
sizeof
(
arg
.
stateid
));
return
(
rpc_call_sync
(
server
->
client
,
&
msg
,
0
));
}
...
...
@@ -738,7 +737,7 @@ nfs4_do_close(struct inode *inode, struct nfs4_state *state)
.
rpc_resp
=
&
res
,
};
memcpy
(
arg
.
stateid
,
state
->
stateid
,
sizeof
(
arg
.
stateid
));
memcpy
(
&
arg
.
stateid
,
&
state
->
stateid
,
sizeof
(
arg
.
stateid
));
/* Serialization for the sequence id */
arg
.
seqid
=
sp
->
so_seqid
,
status
=
rpc_call_sync
(
NFS_SERVER
(
inode
)
->
client
,
&
msg
,
0
);
...
...
@@ -1034,7 +1033,6 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp)
int
flags
=
rdata
->
flags
;
struct
inode
*
inode
=
rdata
->
inode
;
struct
nfs_fattr
*
fattr
=
rdata
->
res
.
fattr
;
nfs4_stateid
*
stateid
=
&
rdata
->
args
.
stateid
;
struct
nfs_server
*
server
=
NFS_SERVER
(
inode
);
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_READ
],
...
...
@@ -1054,9 +1052,9 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp)
if
(
filp
)
{
struct
nfs4_state
*
state
;
state
=
(
struct
nfs4_state
*
)
filp
->
private_data
;
memcpy
(
stateid
,
state
->
stateid
,
sizeof
(
stateid
));
memcpy
(
&
rdata
->
args
.
stateid
,
&
state
->
stateid
,
sizeof
(
rdata
->
args
.
stateid
));
}
else
memcpy
(
stateid
,
zero_stateid
,
sizeof
(
stateid
));
memcpy
(
&
rdata
->
args
.
stateid
,
&
zero_stateid
,
sizeof
(
rdata
->
args
.
stateid
));
fattr
->
valid
=
0
;
status
=
rpc_call_sync
(
server
->
client
,
&
msg
,
flags
);
...
...
@@ -1076,7 +1074,6 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp)
int
rpcflags
=
wdata
->
flags
;
struct
inode
*
inode
=
wdata
->
inode
;
struct
nfs_fattr
*
fattr
=
wdata
->
res
.
fattr
;
nfs4_stateid
*
stateid
=
&
wdata
->
args
.
stateid
;
struct
nfs_server
*
server
=
NFS_SERVER
(
inode
);
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_WRITE
],
...
...
@@ -1095,9 +1092,9 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp)
if
(
filp
)
{
struct
nfs4_state
*
state
;
state
=
(
struct
nfs4_state
*
)
filp
->
private_data
;
memcpy
(
stateid
,
state
->
stateid
,
sizeof
(
stateid
));
memcpy
(
&
wdata
->
args
.
stateid
,
&
state
->
stateid
,
sizeof
(
wdata
->
args
.
stateid
));
}
else
memcpy
(
stateid
,
zero_stateid
,
sizeof
(
stateid
));
memcpy
(
&
wdata
->
args
.
stateid
,
&
zero_stateid
,
sizeof
(
wdata
->
args
.
stateid
));
fattr
->
valid
=
0
;
status
=
rpc_call_sync
(
server
->
client
,
&
msg
,
rpcflags
);
...
...
@@ -1476,9 +1473,9 @@ nfs4_proc_read_setup(struct nfs_read_data *data, unsigned int count)
data
->
timestamp
=
jiffies
;
if
(
req
->
wb_state
)
memcpy
(
data
->
args
.
stateid
,
req
->
wb_state
->
stateid
,
sizeof
(
data
->
args
.
stateid
));
memcpy
(
&
data
->
args
.
stateid
,
&
req
->
wb_state
->
stateid
,
sizeof
(
data
->
args
.
stateid
));
else
memcpy
(
data
->
args
.
stateid
,
zero_stateid
,
sizeof
(
data
->
args
.
stateid
));
memcpy
(
&
data
->
args
.
stateid
,
&
zero_stateid
,
sizeof
(
data
->
args
.
stateid
));
/* N.B. Do we need to test? Never called for swapfile inode */
flags
=
RPC_TASK_ASYNC
|
(
IS_SWAPFILE
(
inode
)
?
NFS_RPC_SWAPFLAGS
:
0
);
...
...
@@ -1555,9 +1552,9 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
data
->
timestamp
=
jiffies
;
if
(
req
->
wb_state
)
memcpy
(
data
->
args
.
stateid
,
req
->
wb_state
->
stateid
,
sizeof
(
data
->
args
.
stateid
));
memcpy
(
&
data
->
args
.
stateid
,
&
req
->
wb_state
->
stateid
,
sizeof
(
data
->
args
.
stateid
));
else
memcpy
(
data
->
args
.
stateid
,
zero_stateid
,
sizeof
(
data
->
args
.
stateid
));
memcpy
(
&
data
->
args
.
stateid
,
&
zero_stateid
,
sizeof
(
data
->
args
.
stateid
));
/* Set the initial flags for the task. */
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
...
...
fs/nfs/nfs4state.c
View file @
874ce338
...
...
@@ -46,11 +46,12 @@
static
spinlock_t
state_spinlock
=
SPIN_LOCK_UNLOCKED
;
nfs4_stateid
zero_stateid
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
nfs4_stateid
zero_stateid
;
#if 0
nfs4_stateid one_stateid =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#endif
static
LIST_HEAD
(
nfs4_clientid_list
);
...
...
@@ -228,7 +229,7 @@ nfs4_alloc_open_state(void)
return
NULL
;
state
->
pid
=
current
->
pid
;
state
->
state
=
0
;
memset
(
state
->
stateid
,
0
,
sizeof
(
state
->
stateid
));
memset
(
state
->
stateid
.
data
,
0
,
sizeof
(
state
->
stateid
.
data
));
atomic_set
(
&
state
->
count
,
1
);
return
state
;
}
...
...
fs/nfs/nfs4xdr.c
View file @
874ce338
...
...
@@ -205,6 +205,7 @@ struct compound_hdr {
#define RESERVE_SPACE(nbytes) do { \
p = xdr_reserve_space(xdr, nbytes); \
if (!p) printk("RESERVE_SPACE(%d) failed in function %s\n", nbytes, __FUNCTION__); \
BUG_ON(!p); \
} while (0)
...
...
@@ -382,10 +383,10 @@ encode_close(struct xdr_stream *xdr, struct nfs_closeargs *arg)
{
uint32_t
*
p
;
RESERVE_SPACE
(
8
+
sizeof
(
nfs4_stateid
));
RESERVE_SPACE
(
8
+
sizeof
(
arg
->
stateid
.
data
));
WRITE32
(
OP_CLOSE
);
WRITE32
(
arg
->
seqid
);
WRITEMEM
(
arg
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITEMEM
(
arg
->
stateid
.
data
,
sizeof
(
arg
->
stateid
.
data
));
return
0
;
}
...
...
@@ -575,7 +576,7 @@ encode_open(struct xdr_stream *xdr, struct nfs_openargs *arg)
if
(
arg
->
createmode
==
NFS4_CREATE_EXCLUSIVE
)
{
RESERVE_SPACE
(
12
);
WRITE32
(
arg
->
createmode
);
WRITEMEM
(
arg
->
u
.
verifier
,
sizeof
(
nfs4_verifier
));
WRITEMEM
(
arg
->
u
.
verifier
.
data
,
sizeof
(
arg
->
u
.
verifier
.
data
));
}
else
if
(
arg
->
u
.
attrs
)
{
RESERVE_SPACE
(
4
);
...
...
@@ -604,9 +605,9 @@ encode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmargs *arg)
{
uint32_t
*
p
;
RESERVE_SPACE
(
8
+
sizeof
(
nfs4_stateid
));
RESERVE_SPACE
(
8
+
sizeof
(
arg
->
stateid
.
data
));
WRITE32
(
OP_OPEN_CONFIRM
);
WRITEMEM
(
arg
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITEMEM
(
arg
->
stateid
.
data
,
sizeof
(
arg
->
stateid
.
data
));
WRITE32
(
arg
->
seqid
);
return
0
;
...
...
@@ -645,7 +646,7 @@ encode_read(struct xdr_stream *xdr, struct nfs_readargs *args)
RESERVE_SPACE
(
32
);
WRITE32
(
OP_READ
);
WRITEMEM
(
args
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITEMEM
(
args
->
stateid
.
data
,
sizeof
(
args
->
stateid
.
data
));
WRITE64
(
args
->
offset
);
WRITE32
(
args
->
count
);
...
...
@@ -662,7 +663,7 @@ encode_readdir(struct xdr_stream *xdr, struct nfs4_readdir *readdir, struct rpc_
RESERVE_SPACE
(
32
+
sizeof
(
nfs4_verifier
));
WRITE32
(
OP_READDIR
);
WRITE64
(
readdir
->
rd_cookie
);
WRITEMEM
(
readdir
->
rd_req_verifier
,
sizeof
(
nfs4_verifier
));
WRITEMEM
(
readdir
->
rd_req_verifier
.
data
,
sizeof
(
readdir
->
rd_req_verifier
.
data
));
WRITE32
(
readdir
->
rd_count
>>
5
);
/* meaningless "dircount" field */
WRITE32
(
readdir
->
rd_count
);
WRITE32
(
2
);
...
...
@@ -771,9 +772,9 @@ encode_setattr(struct xdr_stream *xdr, struct nfs_setattrargs *arg,
int
status
;
uint32_t
*
p
;
RESERVE_SPACE
(
4
+
sizeof
(
nfs4_stateid
));
RESERVE_SPACE
(
4
+
sizeof
(
arg
->
stateid
.
data
));
WRITE32
(
OP_SETATTR
);
WRITEMEM
(
arg
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITEMEM
(
arg
->
stateid
.
data
,
sizeof
(
arg
->
stateid
.
data
));
if
((
status
=
encode_attrs
(
xdr
,
arg
->
iap
,
server
)))
return
status
;
...
...
@@ -792,11 +793,11 @@ encode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid)
len2
=
strlen
(
setclientid
->
sc_netid
);
len3
=
strlen
(
setclientid
->
sc_uaddr
);
total_len
=
XDR_QUADLEN
(
len1
)
+
XDR_QUADLEN
(
len2
)
+
XDR_QUADLEN
(
len3
);
total_len
=
(
total_len
<<
2
)
+
24
+
sizeof
(
nfs4_verifier
);
total_len
=
(
total_len
<<
2
)
+
24
+
sizeof
(
setclientid
->
sc_verifier
.
data
);
RESERVE_SPACE
(
total_len
);
WRITE32
(
OP_SETCLIENTID
);
WRITEMEM
(
setclientid
->
sc_verifier
,
sizeof
(
nfs4_verifier
));
WRITEMEM
(
setclientid
->
sc_verifier
.
data
,
sizeof
(
setclientid
->
sc_verifier
.
data
));
WRITE32
(
len1
);
WRITEMEM
(
setclientid
->
sc_name
,
len1
);
WRITE32
(
setclientid
->
sc_prog
);
...
...
@@ -814,10 +815,10 @@ encode_setclientid_confirm(struct xdr_stream *xdr, struct nfs4_client *client_st
{
uint32_t
*
p
;
RESERVE_SPACE
(
12
+
sizeof
(
nfs4_verifier
));
RESERVE_SPACE
(
12
+
sizeof
(
client_state
->
cl_confirm
.
data
));
WRITE32
(
OP_SETCLIENTID_CONFIRM
);
WRITE64
(
client_state
->
cl_clientid
);
WRITEMEM
(
client_state
->
cl_confirm
,
sizeof
(
nfs4_verifier
));
WRITEMEM
(
client_state
->
cl_confirm
.
data
,
sizeof
(
client_state
->
cl_confirm
.
data
));
return
0
;
}
...
...
@@ -829,7 +830,7 @@ encode_write(struct xdr_stream *xdr, struct nfs_writeargs *args)
RESERVE_SPACE
(
36
);
WRITE32
(
OP_WRITE
);
WRITEMEM
(
args
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITEMEM
(
args
->
stateid
.
data
,
sizeof
(
args
->
stateid
.
data
));
WRITE64
(
args
->
offset
);
WRITE32
(
args
->
stable
);
WRITE32
(
args
->
count
);
...
...
@@ -1256,8 +1257,8 @@ decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
status
=
decode_op_hdr
(
xdr
,
OP_CLOSE
);
if
(
status
)
return
status
;
READ_BUF
(
sizeof
(
nfs4_stateid
));
COPYMEM
(
res
->
stateid
,
sizeof
(
nfs4_stateid
));
READ_BUF
(
sizeof
(
res
->
stateid
.
data
));
COPYMEM
(
res
->
stateid
.
data
,
sizeof
(
res
->
stateid
.
data
));
return
0
;
}
...
...
@@ -1744,8 +1745,8 @@ decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
status
=
decode_op_hdr
(
xdr
,
OP_OPEN
);
if
(
status
)
return
status
;
READ_BUF
(
sizeof
(
nfs4_stateid
));
COPYMEM
(
res
->
stateid
,
sizeof
(
nfs4_stateid
));
READ_BUF
(
sizeof
(
res
->
stateid
.
data
));
COPYMEM
(
res
->
stateid
.
data
,
sizeof
(
res
->
stateid
.
data
));
decode_change_info
(
xdr
,
res
->
cinfo
);
...
...
@@ -1772,8 +1773,8 @@ decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res)
res
->
status
=
decode_op_hdr
(
xdr
,
OP_OPEN_CONFIRM
);
if
(
res
->
status
)
return
res
->
status
;
READ_BUF
(
sizeof
(
nfs4_stateid
));
COPYMEM
(
res
->
stateid
,
sizeof
(
nfs4_stateid
));
READ_BUF
(
sizeof
(
res
->
stateid
.
data
));
COPYMEM
(
res
->
stateid
.
data
,
sizeof
(
res
->
stateid
.
data
));
return
0
;
}
...
...
@@ -1833,7 +1834,7 @@ decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir
if
(
status
)
return
status
;
READ_BUF
(
8
);
COPYMEM
(
readdir
->
rd_resp_verifier
,
8
);
COPYMEM
(
readdir
->
rd_resp_verifier
.
data
,
8
);
hdrlen
=
(
char
*
)
p
-
(
char
*
)
iov
->
iov_base
;
recvd
=
req
->
rq_received
-
hdrlen
;
...
...
@@ -2026,9 +2027,9 @@ decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid)
}
READ32
(
nfserr
);
if
(
nfserr
==
NFS_OK
)
{
READ_BUF
(
8
+
sizeof
(
nfs4_verifier
));
READ_BUF
(
8
+
sizeof
(
setclientid
->
sc_state
->
cl_confirm
.
data
));
READ64
(
setclientid
->
sc_state
->
cl_clientid
);
COPYMEM
(
setclientid
->
sc_state
->
cl_confirm
,
sizeof
(
nfs4_verifier
));
COPYMEM
(
setclientid
->
sc_state
->
cl_confirm
.
data
,
sizeof
(
setclientid
->
sc_state
->
cl_confirm
.
data
));
}
else
if
(
nfserr
==
NFSERR_CLID_INUSE
)
{
uint32_t
len
;
...
...
fs/nfsd/nfs4proc.c
View file @
874ce338
...
...
@@ -78,7 +78,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
status
=
nfsd_create_v3
(
rqstp
,
current_fh
,
open
->
op_fname
.
data
,
open
->
op_fname
.
len
,
&
open
->
op_iattr
,
&
resfh
,
open
->
op_createmode
,
(
u32
*
)
open
->
op_verf
,
&
open
->
op_truncate
);
(
u32
*
)
open
->
op_verf
.
data
,
&
open
->
op_truncate
);
}
else
{
status
=
nfsd_lookup
(
rqstp
,
current_fh
,
...
...
@@ -204,7 +204,7 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
static
inline
int
nfsd4_commit
(
struct
svc_rqst
*
rqstp
,
struct
svc_fh
*
current_fh
,
struct
nfsd4_commit
*
commit
)
{
u32
*
p
=
(
u32
*
)
commit
->
co_verf
;
u32
*
p
=
(
u32
*
)
commit
->
co_verf
.
data
;
*
p
++
=
nfssvc_boot
.
tv_sec
;
*
p
++
=
nfssvc_boot
.
tv_usec
;
...
...
@@ -522,7 +522,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
nfs4_unlock_state
();
write
->
wr_bytes_written
=
write
->
wr_buflen
;
write
->
wr_how_written
=
write
->
wr_stable_how
;
p
=
(
u32
*
)
write
->
wr_verifier
;
p
=
(
u32
*
)
write
->
wr_verifier
.
data
;
*
p
++
=
nfssvc_boot
.
tv_sec
;
*
p
++
=
nfssvc_boot
.
tv_usec
;
...
...
fs/nfsd/nfs4state.c
View file @
874ce338
...
...
@@ -228,8 +228,8 @@ create_client(struct xdr_netobj name) {
}
static
void
copy_verf
(
struct
nfs4_client
*
target
,
nfs4_verifier
source
)
{
memcpy
(
&
target
->
cl_verifier
,
source
,
sizeof
(
nfs4_verifier
));
copy_verf
(
struct
nfs4_client
*
target
,
nfs4_verifier
*
source
)
{
memcpy
(
target
->
cl_verifier
.
data
,
source
->
data
,
sizeof
(
target
->
cl_verifier
.
data
));
}
static
void
...
...
@@ -256,8 +256,8 @@ cmp_name(struct xdr_netobj *n1, struct xdr_netobj *n2) {
}
static
int
cmp_verf
(
nfs4_verifier
v1
,
nfs4_verifier
v2
)
{
return
(
!
memcmp
(
v1
,
v2
,
sizeof
(
nfs4_verifier
)));
cmp_verf
(
nfs4_verifier
*
v1
,
nfs4_verifier
*
v2
)
{
return
(
!
memcmp
(
v1
->
data
,
v2
->
data
,
sizeof
(
v1
->
data
)));
}
static
int
...
...
@@ -286,7 +286,7 @@ gen_confirm(struct nfs4_client *clp) {
u32
*
p
;
tv
=
CURRENT_TIME
;
p
=
(
u32
*
)
clp
->
cl_confirm
;
p
=
(
u32
*
)
clp
->
cl_confirm
.
data
;
*
p
++
=
tv
.
tv_sec
;
*
p
++
=
tv
.
tv_nsec
;
}
...
...
@@ -371,7 +371,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
.
len
=
setclid
->
se_namelen
,
.
data
=
setclid
->
se_name
,
};
char
*
clverifier
=
setclid
->
se_verf
;
nfs4_verifier
clverifier
=
setclid
->
se_verf
;
unsigned
int
strhashval
;
struct
nfs4_client
*
conf
,
*
unconf
,
*
new
,
*
clp
;
int
status
;
...
...
@@ -439,13 +439,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
expire_client
(
unconf
);
if
(
!
(
new
=
create_client
(
clname
)))
goto
out
;
copy_verf
(
new
,
clverifier
);
copy_verf
(
new
,
&
clverifier
);
new
->
cl_addr
=
ip_addr
;
copy_cred
(
&
new
->
cl_cred
,
&
rqstp
->
rq_cred
);
gen_clid
(
new
);
gen_confirm
(
new
);
add_to_unconfirmed
(
new
,
strhashval
);
}
else
if
(
cmp_verf
(
conf
->
cl_verifier
,
clverifier
))
{
}
else
if
(
cmp_verf
(
&
conf
->
cl_verifier
,
&
clverifier
))
{
/*
* CASE 1:
* cl_name match, confirmed, principal match
...
...
@@ -460,13 +460,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
* new cl_confirm
*/
if
((
unconf
)
&&
cmp_verf
(
unconf
->
cl_verifier
,
conf
->
cl_verifier
)
&&
cmp_verf
(
&
unconf
->
cl_verifier
,
&
conf
->
cl_verifier
)
&&
cmp_clid
(
&
unconf
->
cl_clientid
,
&
conf
->
cl_clientid
))
{
expire_client
(
unconf
);
}
if
(
!
(
new
=
create_client
(
clname
)))
goto
out
;
copy_verf
(
new
,
conf
->
cl_verifier
);
copy_verf
(
new
,
&
conf
->
cl_verifier
);
new
->
cl_addr
=
ip_addr
;
copy_cred
(
&
new
->
cl_cred
,
&
rqstp
->
rq_cred
);
copy_clid
(
new
,
conf
);
...
...
@@ -483,14 +483,14 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
*/
if
(
!
(
new
=
create_client
(
clname
)))
goto
out
;
copy_verf
(
new
,
clverifier
);
copy_verf
(
new
,
&
clverifier
);
new
->
cl_addr
=
ip_addr
;
copy_cred
(
&
new
->
cl_cred
,
&
rqstp
->
rq_cred
);
gen_clid
(
new
);
gen_confirm
(
new
);
add_to_unconfirmed
(
new
,
strhashval
);
}
else
if
(
!
cmp_clid
(
&
conf
->
cl_clientid
,
&
unconf
->
cl_clientid
)
&&
!
cmp_verf
(
conf
->
cl_confirm
,
unconf
->
cl_confirm
))
{
!
cmp_verf
(
&
conf
->
cl_confirm
,
&
unconf
->
cl_confirm
))
{
/*
* CASE3:
* confirmed found (name, principal match)
...
...
@@ -510,7 +510,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
expire_client
(
unconf
);
if
(
!
(
new
=
create_client
(
clname
)))
goto
out
;
copy_verf
(
new
,
clverifier
);
copy_verf
(
new
,
&
clverifier
);
new
->
cl_addr
=
ip_addr
;
copy_cred
(
&
new
->
cl_cred
,
&
rqstp
->
rq_cred
);
gen_clid
(
new
);
...
...
@@ -524,7 +524,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
}
setclid
->
se_clientid
.
cl_boot
=
new
->
cl_clientid
.
cl_boot
;
setclid
->
se_clientid
.
cl_id
=
new
->
cl_clientid
.
cl_id
;
memcpy
(
&
setclid
->
se_confirm
,
new
->
cl_confirm
,
sizeof
(
nfs4_verifier
));
memcpy
(
setclid
->
se_confirm
.
data
,
new
->
cl_confirm
.
data
,
sizeof
(
setclid
->
se_confirm
.
data
));
printk
(
KERN_INFO
"NFSD: this client will not receive delegations
\n
"
);
status
=
nfs_ok
;
out:
...
...
@@ -546,7 +546,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
u32
ip_addr
=
rqstp
->
rq_addr
.
sin_addr
.
s_addr
;
unsigned
int
idhashval
;
struct
nfs4_client
*
clp
,
*
conf
=
NULL
,
*
unconf
=
NULL
;
char
*
confirm
=
setclientid_confirm
->
sc_confirm
;
nfs4_verifier
confirm
=
setclientid_confirm
->
sc_confirm
;
clientid_t
*
clid
=
&
setclientid_confirm
->
sc_clientid
;
struct
list_head
*
pos
,
*
next
;
int
status
;
...
...
@@ -601,10 +601,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* conf and unconf records match names, verifiers
*/
if
((
conf
&&
unconf
)
&&
(
cmp_verf
(
unconf
->
cl_confirm
,
confirm
))
&&
(
cmp_verf
(
conf
->
cl_verifier
,
unconf
->
cl_verifier
))
&&
(
cmp_verf
(
&
unconf
->
cl_confirm
,
&
confirm
))
&&
(
cmp_verf
(
&
conf
->
cl_verifier
,
&
unconf
->
cl_verifier
))
&&
(
cmp_name
(
&
conf
->
cl_name
,
&
unconf
->
cl_name
))
&&
(
!
cmp_verf
(
conf
->
cl_confirm
,
unconf
->
cl_confirm
)))
{
(
!
cmp_verf
(
&
conf
->
cl_confirm
,
&
unconf
->
cl_confirm
)))
{
if
(
!
cmp_creds
(
&
conf
->
cl_cred
,
&
unconf
->
cl_cred
))
status
=
nfserr_clid_inuse
;
else
{
...
...
@@ -621,7 +621,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
*/
if
((
conf
&&
!
unconf
)
||
((
conf
&&
unconf
)
&&
(
!
cmp_verf
(
conf
->
cl_verifier
,
unconf
->
cl_verifier
)
||
(
!
cmp_verf
(
&
conf
->
cl_verifier
,
&
unconf
->
cl_verifier
)
||
!
cmp_name
(
&
conf
->
cl_name
,
&
unconf
->
cl_name
))))
{
if
(
!
cmp_creds
(
&
conf
->
cl_cred
,
&
rqstp
->
rq_cred
))
{
status
=
nfserr_clid_inuse
;
...
...
@@ -635,7 +635,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* unconf record found.
* unconf->cl_confirm matches input confirm
*/
if
(
!
conf
&&
unconf
&&
cmp_verf
(
unconf
->
cl_confirm
,
confirm
))
{
if
(
!
conf
&&
unconf
&&
cmp_verf
(
&
unconf
->
cl_confirm
,
&
confirm
))
{
if
(
!
cmp_creds
(
&
unconf
->
cl_cred
,
&
rqstp
->
rq_cred
))
{
status
=
nfserr_clid_inuse
;
}
else
{
...
...
@@ -650,8 +650,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* unconf record not found, or if unconf, then unconf->cl_confirm
* does not match input confirm.
*/
if
((
!
conf
||
(
conf
&&
!
cmp_verf
(
conf
->
cl_confirm
,
confirm
)))
&&
(
!
unconf
||
(
unconf
&&
!
cmp_verf
(
unconf
->
cl_confirm
,
confirm
))))
{
if
((
!
conf
||
(
conf
&&
!
cmp_verf
(
&
conf
->
cl_confirm
,
&
confirm
)))
&&
(
!
unconf
||
(
unconf
&&
!
cmp_verf
(
&
unconf
->
cl_confirm
,
&
confirm
))))
{
status
=
nfserr_stale_clientid
;
goto
out
;
}
...
...
fs/nfsd/nfs4xdr.c
View file @
874ce338
...
...
@@ -691,7 +691,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
break
;
case
NFS4_CREATE_EXCLUSIVE
:
READ_BUF
(
8
);
COPYMEM
(
open
->
op_verf
,
8
);
COPYMEM
(
open
->
op_verf
.
data
,
8
);
break
;
default:
goto
xdr_error
;
...
...
@@ -798,7 +798,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
READ_BUF
(
24
);
READ64
(
readdir
->
rd_cookie
);
COPYMEM
(
readdir
->
rd_verf
,
sizeof
(
nfs4_verifier
));
COPYMEM
(
readdir
->
rd_verf
.
data
,
sizeof
(
readdir
->
rd_verf
.
data
));
READ32
(
readdir
->
rd_dircount
);
/* just in case you needed a useless field... */
READ32
(
readdir
->
rd_maxcount
);
if
((
status
=
nfsd4_decode_bitmap
(
argp
,
readdir
->
rd_bmval
)))
...
...
@@ -873,7 +873,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
DECODE_HEAD
;
READ_BUF
(
12
);
COPYMEM
(
setclientid
->
se_verf
,
8
);
COPYMEM
(
setclientid
->
se_verf
.
data
,
8
);
READ32
(
setclientid
->
se_namelen
);
READ_BUF
(
setclientid
->
se_namelen
+
8
);
...
...
@@ -1740,7 +1740,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com
if
(
!
nfserr
)
{
RESERVE_SPACE
(
8
);
WRITEMEM
(
commit
->
co_verf
,
8
);
WRITEMEM
(
commit
->
co_verf
.
data
,
8
);
ADJUST_ARGS
();
}
}
...
...
@@ -2224,7 +2224,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
RESERVE_SPACE
(
16
);
WRITE32
(
write
->
wr_bytes_written
);
WRITE32
(
write
->
wr_how_written
);
WRITEMEM
(
write
->
wr_verifier
,
8
);
WRITEMEM
(
write
->
wr_verifier
.
data
,
8
);
ADJUST_ARGS
();
}
}
...
...
include/linux/nfs4.h
View file @
874ce338
...
...
@@ -46,8 +46,8 @@
#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2
#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3
typedef
char
nfs4_verifier
[
NFS4_VERIFIER_SIZE
]
;
typedef
char
nfs4_stateid
[
16
]
;
typedef
struct
{
char
data
[
NFS4_VERIFIER_SIZE
];
}
nfs4_verifier
;
typedef
struct
{
char
data
[
16
];
}
nfs4_stateid
;
enum
nfs_opnum4
{
OP_ACCESS
=
3
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment