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
nexedi
linux
Commits
ec0e388d
Commit
ec0e388d
authored
Apr 08, 2003
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the NFSv4 write code use the stateid if it exists.
parent
47462c3c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
+33
-5
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+31
-1
fs/nfs/nfs4xdr.c
fs/nfs/nfs4xdr.c
+1
-4
include/linux/nfs_xdr.h
include/linux/nfs_xdr.h
+1
-0
No files found.
fs/nfs/nfs4proc.c
View file @
ec0e388d
...
@@ -55,7 +55,8 @@ extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
...
@@ -55,7 +55,8 @@ extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
extern
struct
rpc_procinfo
nfs4_procedures
[];
extern
struct
rpc_procinfo
nfs4_procedures
[];
static
nfs4_stateid
zero_stateid
=
static
nfs4_stateid
zero_stateid
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
static
spinlock_t
renew_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
renew_lock
=
SPIN_LOCK_UNLOCKED
;
static
void
static
void
...
@@ -1067,6 +1068,7 @@ nfs4_proc_write(struct inode *inode, struct rpc_cred *cred,
...
@@ -1067,6 +1068,7 @@ nfs4_proc_write(struct inode *inode, struct rpc_cred *cred,
struct
page
*
page
,
struct
nfs_writeverf
*
verf
)
struct
page
*
page
,
struct
nfs_writeverf
*
verf
)
{
{
struct
nfs_server
*
server
=
NFS_SERVER
(
inode
);
struct
nfs_server
*
server
=
NFS_SERVER
(
inode
);
struct
nfs4_shareowner
*
sp
;
uint64_t
offset
=
page_offset
(
page
)
+
base
;
uint64_t
offset
=
page_offset
(
page
)
+
base
;
struct
nfs_writeargs
arg
=
{
struct
nfs_writeargs
arg
=
{
.
fh
=
NFS_FH
(
inode
),
.
fh
=
NFS_FH
(
inode
),
...
@@ -1090,6 +1092,19 @@ nfs4_proc_write(struct inode *inode, struct rpc_cred *cred,
...
@@ -1090,6 +1092,19 @@ nfs4_proc_write(struct inode *inode, struct rpc_cred *cred,
int
rpcflags
=
(
flags
&
NFS_RW_SWAP
)
?
NFS_RPC_SWAPFLAGS
:
0
;
int
rpcflags
=
(
flags
&
NFS_RW_SWAP
)
?
NFS_RPC_SWAPFLAGS
:
0
;
dprintk
(
"NFS call write %d @ %Ld
\n
"
,
count
,
(
long
long
)
offset
);
dprintk
(
"NFS call write %d @ %Ld
\n
"
,
count
,
(
long
long
)
offset
);
/*
* Try first to use O_WRONLY, then O_RDWR stateid.
*/
sp
=
nfs4_get_inode_share
(
inode
,
O_WRONLY
);
if
(
!
sp
)
sp
=
nfs4_get_inode_share
(
inode
,
O_RDWR
);
if
(
sp
)
memcpy
(
arg
.
stateid
,
sp
->
so_stateid
,
sizeof
(
nfs4_stateid
));
else
memcpy
(
arg
.
stateid
,
zero_stateid
,
sizeof
(
nfs4_stateid
));
fattr
->
valid
=
0
;
fattr
->
valid
=
0
;
return
rpc_call_sync
(
server
->
client
,
&
msg
,
rpcflags
);
return
rpc_call_sync
(
server
->
client
,
&
msg
,
rpcflags
);
}
}
...
@@ -1531,6 +1546,7 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
...
@@ -1531,6 +1546,7 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
};
};
struct
inode
*
inode
=
data
->
inode
;
struct
inode
*
inode
=
data
->
inode
;
struct
nfs_page
*
req
=
nfs_list_entry
(
data
->
pages
.
next
);
struct
nfs_page
*
req
=
nfs_list_entry
(
data
->
pages
.
next
);
struct
nfs4_shareowner
*
sp
;
int
stable
;
int
stable
;
int
flags
;
int
flags
;
...
@@ -1553,6 +1569,20 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
...
@@ -1553,6 +1569,20 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
data
->
res
.
verf
=
&
data
->
verf
;
data
->
res
.
verf
=
&
data
->
verf
;
data
->
timestamp
=
jiffies
;
data
->
timestamp
=
jiffies
;
if
(
req
->
wb_file
)
{
unsigned
int
oflags
=
req
->
wb_file
->
f_flags
;
sp
=
nfs4_get_inode_share
(
inode
,
oflags
);
}
else
{
sp
=
nfs4_get_inode_share
(
inode
,
O_WRONLY
);
if
(
!
sp
)
sp
=
nfs4_get_inode_share
(
inode
,
O_RDWR
);
}
if
(
sp
)
memcpy
(
data
->
args
.
stateid
,
sp
->
so_stateid
,
sizeof
(
nfs4_stateid
));
else
memcpy
(
data
->
args
.
stateid
,
zero_stateid
,
sizeof
(
nfs4_stateid
));
/* Set the initial flags for the task. */
/* Set the initial flags for the task. */
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
...
...
fs/nfs/nfs4xdr.c
View file @
ec0e388d
...
@@ -837,10 +837,7 @@ encode_write(struct xdr_stream *xdr, struct nfs_writeargs *args)
...
@@ -837,10 +837,7 @@ encode_write(struct xdr_stream *xdr, struct nfs_writeargs *args)
RESERVE_SPACE
(
36
);
RESERVE_SPACE
(
36
);
WRITE32
(
OP_WRITE
);
WRITE32
(
OP_WRITE
);
WRITE32
(
0xffffffff
);
/* magic stateid -1 */
WRITEMEM
(
args
->
stateid
,
sizeof
(
nfs4_stateid
));
WRITE32
(
0xffffffff
);
WRITE32
(
0xffffffff
);
WRITE32
(
0xffffffff
);
WRITE64
(
args
->
offset
);
WRITE64
(
args
->
offset
);
WRITE32
(
args
->
stable
);
WRITE32
(
args
->
stable
);
WRITE32
(
args
->
count
);
WRITE32
(
args
->
count
);
...
...
include/linux/nfs_xdr.h
View file @
ec0e388d
...
@@ -180,6 +180,7 @@ struct nfs_readres {
...
@@ -180,6 +180,7 @@ struct nfs_readres {
struct
nfs_writeargs
{
struct
nfs_writeargs
{
struct
nfs_fh
*
fh
;
struct
nfs_fh
*
fh
;
nfs4_stateid
stateid
;
__u64
offset
;
__u64
offset
;
__u32
count
;
__u32
count
;
enum
nfs3_stable_how
stable
;
enum
nfs3_stable_how
stable
;
...
...
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