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
cd21f96e
Commit
cd21f96e
authored
Oct 08, 2003
by
Trond Myklebust
Committed by
Linus Torvalds
Oct 08, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] NFS: synchronous NFSv3/v4 COMMIT
Add support for synchronous calls to the NFSv3/v4 COMMIT functions.
parent
88a88295
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
3 deletions
+61
-3
fs/nfs/nfs3proc.c
fs/nfs/nfs3proc.c
+24
-0
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+36
-1
include/linux/nfs_xdr.h
include/linux/nfs_xdr.h
+1
-2
No files found.
fs/nfs/nfs3proc.c
View file @
cd21f96e
...
...
@@ -284,6 +284,29 @@ nfs3_proc_write(struct nfs_write_data *wdata, struct file *filp)
return
status
<
0
?
status
:
wdata
->
res
.
count
;
}
static
int
nfs3_proc_commit
(
struct
nfs_write_data
*
cdata
,
struct
file
*
filp
)
{
struct
inode
*
inode
=
cdata
->
inode
;
struct
nfs_fattr
*
fattr
=
cdata
->
res
.
fattr
;
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs3_procedures
[
NFS3PROC_COMMIT
],
.
rpc_argp
=
&
cdata
->
args
,
.
rpc_resp
=
&
cdata
->
res
,
};
int
status
;
dprintk
(
"NFS call commit %d @ %Ld
\n
"
,
cdata
->
args
.
count
,
(
long
long
)
cdata
->
args
.
offset
);
fattr
->
valid
=
0
;
msg
.
rpc_cred
=
nfs_cred
(
inode
,
filp
);
status
=
rpc_call_sync
(
NFS_CLIENT
(
inode
),
&
msg
,
0
);
if
(
status
>=
0
)
nfs3_write_refresh_inode
(
inode
,
fattr
);
dprintk
(
"NFS reply commit: %d
\n
"
,
status
);
return
status
;
}
/*
* Create a regular file.
* For now, we don't implement O_EXCL.
...
...
@@ -883,6 +906,7 @@ struct nfs_rpc_ops nfs_v3_clientops = {
.
readlink
=
nfs3_proc_readlink
,
.
read
=
nfs3_proc_read
,
.
write
=
nfs3_proc_write
,
.
commit
=
nfs3_proc_commit
,
.
create
=
nfs3_proc_create
,
.
remove
=
nfs3_proc_remove
,
.
unlink_setup
=
nfs3_proc_unlink_setup
,
...
...
fs/nfs/nfs4proc.c
View file @
cd21f96e
...
...
@@ -1107,6 +1107,41 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp)
return
status
;
}
static
int
nfs4_proc_commit
(
struct
nfs_write_data
*
cdata
,
struct
file
*
filp
)
{
struct
inode
*
inode
=
cdata
->
inode
;
struct
nfs_fattr
*
fattr
=
cdata
->
res
.
fattr
;
struct
nfs_server
*
server
=
NFS_SERVER
(
inode
);
struct
rpc_message
msg
=
{
.
rpc_proc
=
&
nfs4_procedures
[
NFSPROC4_CLNT_COMMIT
],
.
rpc_argp
=
&
cdata
->
args
,
.
rpc_resp
=
&
cdata
->
res
,
};
int
status
;
dprintk
(
"NFS call commit %d @ %Ld
\n
"
,
cdata
->
args
.
count
,
(
long
long
)
cdata
->
args
.
offset
);
/*
* Try first to use O_WRONLY, then O_RDWR stateid.
*/
if
(
filp
)
{
struct
nfs4_state
*
state
;
state
=
(
struct
nfs4_state
*
)
filp
->
private_data
;
memcpy
(
&
cdata
->
args
.
stateid
,
&
state
->
stateid
,
sizeof
(
cdata
->
args
.
stateid
));
msg
.
rpc_cred
=
state
->
owner
->
so_cred
;
}
else
{
memcpy
(
&
cdata
->
args
.
stateid
,
&
zero_stateid
,
sizeof
(
cdata
->
args
.
stateid
));
msg
.
rpc_cred
=
NFS_I
(
inode
)
->
mm_cred
;
}
fattr
->
valid
=
0
;
status
=
rpc_call_sync
(
server
->
client
,
&
msg
,
0
);
dprintk
(
"NFS reply commit: %d
\n
"
,
status
);
return
status
;
}
/*
* Got race?
* We will need to arrange for the VFS layer to provide an atomic open.
...
...
@@ -1777,7 +1812,7 @@ struct nfs_rpc_ops nfs_v4_clientops = {
.
readlink
=
nfs4_proc_readlink
,
.
read
=
nfs4_proc_read
,
.
write
=
nfs4_proc_write
,
.
commit
=
NULL
,
.
commit
=
nfs4_proc_commit
,
.
create
=
nfs4_proc_create
,
.
remove
=
nfs4_proc_remove
,
.
unlink_setup
=
nfs4_proc_unlink_setup
,
...
...
include/linux/nfs_xdr.h
View file @
cd21f96e
...
...
@@ -639,8 +639,7 @@ struct nfs_rpc_ops {
int
(
*
readlink
)(
struct
inode
*
,
struct
page
*
);
int
(
*
read
)
(
struct
nfs_read_data
*
,
struct
file
*
);
int
(
*
write
)
(
struct
nfs_write_data
*
,
struct
file
*
);
int
(
*
commit
)
(
struct
inode
*
,
struct
nfs_fattr
*
,
unsigned
long
,
unsigned
int
);
int
(
*
commit
)
(
struct
nfs_write_data
*
,
struct
file
*
);
struct
inode
*
(
*
create
)
(
struct
inode
*
,
struct
qstr
*
,
struct
iattr
*
,
int
);
int
(
*
remove
)
(
struct
inode
*
,
struct
qstr
*
);
...
...
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