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
62bbc304
Commit
62bbc304
authored
Jun 11, 2004
by
Steve French
Committed by
Steve French
Jun 11, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle rename of hardlinked files properly (treat as a noop)
Signed-off-by: Steve French (sfrench@us.ibm.com)
parent
e3e741aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
5 deletions
+39
-5
fs/cifs/CHANGES
fs/cifs/CHANGES
+5
-0
fs/cifs/cifs_debug.c
fs/cifs/cifs_debug.c
+1
-1
fs/cifs/cifsfs.h
fs/cifs/cifsfs.h
+1
-1
fs/cifs/inode.c
fs/cifs/inode.c
+32
-3
No files found.
fs/cifs/CHANGES
View file @
62bbc304
Version 1.18
------------
Do not rename hardlinked files (since that should be a noop). Flush
cached write behind data when reopening a file after session abend.
Version 1.17
------------
Update number of blocks in file so du command is happier (in Linux a fake
...
...
fs/cifs/cifs_debug.c
View file @
62bbc304
...
...
@@ -209,7 +209,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
length
+=
item_length
;
buf
+=
item_length
;
item_length
=
sprintf
(
buf
,
"%d session
s and %d shares reconnected after failure
\n
"
,
"%d session
%d share reconnects
\n
"
,
tcpSesReconnectCount
.
counter
,
tconInfoReconnectCount
.
counter
);
length
+=
item_length
;
buf
+=
item_length
;
...
...
fs/cifs/cifsfs.h
View file @
62bbc304
...
...
@@ -93,5 +93,5 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t
,
int
);
extern
ssize_t
cifs_getxattr
(
struct
dentry
*
,
const
char
*
,
void
*
,
size_t
);
extern
ssize_t
cifs_listxattr
(
struct
dentry
*
,
char
*
,
size_t
);
#define CIFS_VERSION "1.1
7
"
#define CIFS_VERSION "1.1
8
"
#endif
/* _CIFSFS_H */
fs/cifs/inode.c
View file @
62bbc304
...
...
@@ -568,9 +568,38 @@ cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
rc
=
CIFSSMBRename
(
xid
,
pTcon
,
fromName
,
toName
,
cifs_sb_source
->
local_nls
);
if
(
rc
==
-
EEXIST
)
{
cifs_unlink
(
target_inode
,
target_direntry
);
rc
=
CIFSSMBRename
(
xid
,
pTcon
,
fromName
,
toName
,
cifs_sb_source
->
local_nls
);
/* check if they are the same file
because rename of hardlinked files is a noop */
FILE_UNIX_BASIC_INFO
*
info_buf_source
;
FILE_UNIX_BASIC_INFO
*
info_buf_target
;
info_buf_source
=
kmalloc
(
2
*
sizeof
(
FILE_UNIX_BASIC_INFO
),
GFP_KERNEL
);
if
(
info_buf_source
!=
NULL
)
{
info_buf_target
=
info_buf_source
+
1
;
rc
=
CIFSSMBUnixQPathInfo
(
xid
,
pTcon
,
fromName
,
info_buf_source
,
cifs_sb_source
->
local_nls
);
if
(
rc
==
0
)
{
rc
=
CIFSSMBUnixQPathInfo
(
xid
,
pTcon
,
toName
,
info_buf_target
,
cifs_sb_target
->
local_nls
);
}
if
((
rc
==
0
)
&&
(
info_buf_source
->
UniqueId
==
info_buf_target
->
UniqueId
))
{
/* do not rename since the files are hardlinked
which is a noop */
}
else
{
/* we either can not tell the files are hardlinked
(as with Windows servers) or files are not hardlinked
so delete the target manually before renaming to
follow POSIX rather than Windows semantics */
cifs_unlink
(
target_inode
,
target_direntry
);
rc
=
CIFSSMBRename
(
xid
,
pTcon
,
fromName
,
toName
,
cifs_sb_source
->
local_nls
);
}
kfree
(
info_buf_source
);
}
/* if we can not get memory just leave rc as EEXIST */
}
if
((
rc
==
-
EIO
)
||
(
rc
==
-
EEXIST
))
{
...
...
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