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
c1f8b629
Commit
c1f8b629
authored
Jun 13, 2004
by
Steve French
Committed by
Steve French
Jun 13, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not filemap_fdatawrite when reconnecting in write to avoid potential deadlock
Signed-off-by: Steve French (sfrench@us.ibm.com)
parent
e70aaeb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
fs/cifs/connect.c
fs/cifs/connect.c
+1
-1
fs/cifs/file.c
fs/cifs/file.c
+25
-13
No files found.
fs/cifs/connect.c
View file @
c1f8b629
...
...
@@ -155,7 +155,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
}
}
spin_unlock
(
&
GlobalMid_Lock
);
up
(
&
se
s
->
se
rver
->
tcpSem
);
up
(
&
server
->
tcpSem
);
while
((
server
->
tcpStatus
!=
CifsExiting
)
&&
(
server
->
tcpStatus
!=
CifsGood
))
{
...
...
fs/cifs/file.c
View file @
c1f8b629
...
...
@@ -267,7 +267,7 @@ static int cifs_relock_file(struct cifsFileInfo * cifsFile)
return
rc
;
}
static
int
cifs_reopen_file
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
cifs_reopen_file
(
struct
inode
*
inode
,
struct
file
*
file
,
int
can_flush
)
{
int
rc
=
-
EACCES
;
int
xid
,
oplock
;
...
...
@@ -358,19 +358,25 @@ and we can never tell if the caller already has the rename_sem */
up
(
&
pCifsFile
->
fh_sem
);
pCifsInode
=
CIFS_I
(
inode
);
if
(
pCifsInode
)
{
filemap_fdatawrite
(
inode
->
i_mapping
);
filemap_fdatawait
(
inode
->
i_mapping
);
if
(
can_flush
)
{
filemap_fdatawrite
(
inode
->
i_mapping
);
filemap_fdatawait
(
inode
->
i_mapping
);
/* temporarily disable caching while we
go to server to get inode info */
pCifsInode
->
clientCanCacheAll
=
FALSE
;
pCifsInode
->
clientCanCacheRead
=
FALSE
;
if
(
pTcon
->
ses
->
capabilities
&
CAP_UNIX
)
rc
=
cifs_get_inode_info_unix
(
&
inode
,
pCifsInode
->
clientCanCacheAll
=
FALSE
;
pCifsInode
->
clientCanCacheRead
=
FALSE
;
if
(
pTcon
->
ses
->
capabilities
&
CAP_UNIX
)
rc
=
cifs_get_inode_info_unix
(
&
inode
,
full_path
,
inode
->
i_sb
);
else
rc
=
cifs_get_inode_info
(
&
inode
,
else
rc
=
cifs_get_inode_info
(
&
inode
,
full_path
,
NULL
,
inode
->
i_sb
);
}
/* else we are writing out data to server already
and could deadlock if we tried to flush data, and
since we do not know if we have data that would
invalidate the current end of file on the server
we can not go to the server to get the new
inod info */
if
((
oplock
&
0xF
)
==
OPLOCK_EXCLUSIVE
)
{
pCifsInode
->
clientCanCacheAll
=
TRUE
;
pCifsInode
->
clientCanCacheRead
=
TRUE
;
...
...
@@ -621,7 +627,11 @@ cifs_write(struct file * file, const char *write_data,
FreeXid
(
xid
);
return
total_written
;
}
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
);
/* we could deadlock if we called
filemap_fdatawait from here so tell
reopen_file not to flush data to server now */
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
,
FALSE
);
if
(
rc
!=
0
)
break
;
}
...
...
@@ -977,7 +987,8 @@ cifs_read(struct file * file, char *read_data, size_t read_size,
rc
=
-
EAGAIN
;
while
(
rc
==
-
EAGAIN
)
{
if
((
open_file
->
invalidHandle
)
&&
(
!
open_file
->
closePend
))
{
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
);
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
,
TRUE
);
if
(
rc
!=
0
)
break
;
}
...
...
@@ -1132,7 +1143,8 @@ cifs_readpages(struct file *file, struct address_space *mapping,
rc
=
-
EAGAIN
;
while
(
rc
==
-
EAGAIN
)
{
if
((
open_file
->
invalidHandle
)
&&
(
!
open_file
->
closePend
))
{
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
);
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
,
TRUE
);
if
(
rc
!=
0
)
break
;
}
...
...
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