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
03da633a
Commit
03da633a
authored
Sep 16, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atomic_open: take care of EEXIST in no-open case with O_CREAT|O_EXCL in fs/namei.c
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
116cc022
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
fs/9p/vfs_inode_dotl.c
fs/9p/vfs_inode_dotl.c
+1
-7
fs/namei.c
fs/namei.c
+19
-14
No files found.
fs/9p/vfs_inode_dotl.c
View file @
03da633a
...
...
@@ -267,14 +267,8 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
}
/* Only creates */
if
(
!
(
flags
&
O_CREAT
))
if
(
!
(
flags
&
O_CREAT
)
||
dentry
->
d_inode
)
return
finish_no_open
(
file
,
res
);
else
if
(
dentry
->
d_inode
)
{
if
((
flags
&
(
O_CREAT
|
O_EXCL
))
==
(
O_CREAT
|
O_EXCL
))
return
-
EEXIST
;
else
return
finish_no_open
(
file
,
res
);
}
v9ses
=
v9fs_inode2v9ses
(
dir
);
...
...
fs/namei.c
View file @
03da633a
...
...
@@ -2725,16 +2725,6 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
goto
out
;
}
acc_mode
=
op
->
acc_mode
;
if
(
WARN_ON
(
excl
&&
!
(
*
opened
&
FILE_CREATED
)))
*
opened
|=
FILE_CREATED
;
if
(
*
opened
&
FILE_CREATED
)
{
WARN_ON
(
!
(
open_flag
&
O_CREAT
));
fsnotify_create
(
dir
,
dentry
);
acc_mode
=
MAY_OPEN
;
}
if
(
error
)
{
/* returned 1, that is */
if
(
WARN_ON
(
file
->
f_path
.
dentry
==
DENTRY_NOT_SET
))
{
error
=
-
EIO
;
...
...
@@ -2744,10 +2734,19 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
dput
(
dentry
);
dentry
=
file
->
f_path
.
dentry
;
}
WARN_ON
(
!
dentry
->
d_inode
&&
(
*
opened
&
FILE_CREATED
));
if
(
create_error
&&
dentry
->
d_inode
==
NULL
)
{
error
=
create_error
;
goto
out
;
if
(
*
opened
&
FILE_CREATED
)
fsnotify_create
(
dir
,
dentry
);
if
(
!
dentry
->
d_inode
)
{
WARN_ON
(
*
opened
&
FILE_CREATED
);
if
(
create_error
)
{
error
=
create_error
;
goto
out
;
}
}
else
{
if
(
excl
&&
!
(
*
opened
&
FILE_CREATED
))
{
error
=
-
EEXIST
;
goto
out
;
}
}
goto
looked_up
;
}
...
...
@@ -2756,6 +2755,12 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
* We didn't have the inode before the open, so check open permission
* here.
*/
acc_mode
=
op
->
acc_mode
;
if
(
*
opened
&
FILE_CREATED
)
{
WARN_ON
(
!
(
open_flag
&
O_CREAT
));
fsnotify_create
(
dir
,
dentry
);
acc_mode
=
MAY_OPEN
;
}
error
=
may_open
(
&
file
->
f_path
,
acc_mode
,
open_flag
);
if
(
error
)
fput
(
file
);
...
...
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